diff --git a/tests/Phue/Test/GroupTest.php b/tests/Phue/Test/GroupTest.php index 5006626..675084e 100644 --- a/tests/Phue/Test/GroupTest.php +++ b/tests/Phue/Test/GroupTest.php @@ -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 *