Inheritance: implements Phue\Command\CommandInterface
Beispiel #1
0
 /**
  * Test: Send create user command
  *
  * @covers \Phue\Command\CreateUser::send
  * @covers \Phue\Command\CreateUser::buildRequestData
  */
 public function testSend()
 {
     // Set up device type to pass to create user command
     $deviceType = 'phpunit';
     // Stub transport's sendRequest method
     $this->mockTransport->expects($this->once())->method('sendRequest')->with($this->equalTo('/api'), $this->equalTo('POST'), $this->anything())->will($this->returnValue('success!'));
     $x = new CreateUser('phpunit');
     $this->assertEquals('success!', $x->send($this->mockClient));
 }
Beispiel #2
0
 /**
  * Test: Setting invalid username
  *
  * @covers \Phue\Command\CreateUser::setUsername
  *
  * @expectedException \InvalidArgumentException
  */
 public function testExceptionOnInvalidUsername()
 {
     $command = new CreateUser();
     $command->setUsername('test');
 }
Beispiel #3
0
 /**
  * Test: Setting invalid device type
  *
  * @covers \Phue\Command\CreateUser::setDeviceType
  *
  * @expectedException \InvalidArgumentException
  */
 public function testExceptionOnInvalidDeviceType()
 {
     $command = new CreateUser();
     $command->setDeviceType(str_repeat('X', 41));
 }