/** * 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)); }
/** * Test: Setting invalid username * * @covers \Phue\Command\CreateUser::setUsername * * @expectedException \InvalidArgumentException */ public function testExceptionOnInvalidUsername() { $command = new CreateUser(); $command->setUsername('test'); }
/** * Test: Setting invalid device type * * @covers \Phue\Command\CreateUser::setDeviceType * * @expectedException \InvalidArgumentException */ public function testExceptionOnInvalidDeviceType() { $command = new CreateUser(); $command->setDeviceType(str_repeat('X', 41)); }