Skip to content

Commit

Permalink
add get/set RGB coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarbey authored Nov 14, 2016
1 parent 8ec46ff commit ba00b0a
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tests/Phue/Test/GroupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,41 @@ public function testGetSetXY()
), $this->group->getXY());
}

/**
* Test: Get/Set RGB
*
* @covers \Phue\Group::getRGB
* @covers \Phue\Group::setRGB
*/
public function testGetSetRGB()
{
$this->stubMockClientSendSetGroupStateCommand();

// Make sure original rgb is retrievable
$rgb = ColorConversion::convertXYToRGB(
$this->attributes->action->xy[0],
$this->attributes->action->xy[1],
$this->attributes->action->bri
);
$this->assertEquals(
array(
'red' => $rgb['red'],
'green' => $rgb['green'],
'blue' => $rgb['blue']
), $this->light->getRGB());

// Ensure setRGB returns self
$this->assertEquals($this->group, $this->group->setRGB(50, 50, 50));

// Make sure group attributes are updated
$this->assertEquals(
array(
'red' => 50,
'green' => 50,
'blue' => 50
), $this->group->getRGB());
}

/**
* Test: Get/Set Color temp
*
Expand Down

0 comments on commit ba00b0a

Please sign in to comment.