/** * @covers ::__construct */ public function test_construct() { # Check properties $this->assertAttributeSame('php', '_Command', $this->Command, 'ICommand::__construct() Failed to set $_Command'); $this->assertAttributeSame($this->Config, '_Config', $this->Command, 'ICommand::__construct() Failed to set $_Config'); $this->assertSame('ShellCommand', $this->Command->getID(), 'ICommand::__construct() Failed to set $_ID'); $this->assertSame($this->Mediator, $this->Command->getMediator(), 'ICommand::__construct() Failed to set $_Mediator'); # Null ID $this->Command = new Command('php', $this->Config, $this->Mediator); $this->assertRegExp('!BLW_[0-9a-z]+!', $this->Command->getID(), 'ICommand::__construct() Failed to set $_ID'); # Invalid ID try { $this->Command = $this->getMockForAbstractClass('\\BLW\\Type\\Command\\ACommand', array('ping', $this->Config, $this->Mediator, array())); $this->fail('Failed to generate error with invalid $ID'); } catch (\PHPUnit_Framework_Error_Notice $e) { } # Invalid arguments for ($i = $this->generateInvalidArgs(); list($k, list($Command, $Config, $Mediator, $ID)) = each($i);) { try { new Command($Command, $Config, $Mediator, $ID); $this->fail('Failed to generate exception with invalid arguments'); } catch (InvalidArgumentException $e) { } } }