/** * @covers ::__construct */ public function test_construct() { # Valid arguments $this->Command = new Command($this->Action, $this->Config, $this->Mediator); $this->assertAttributeInstanceOf('\\Jeremeamia\\SuperClosure\\SerializableClosure', '_Command', $this->Command, 'ICommand::__construct() Failed to set $_Command'); $this->assertAttributeSame($this->Config, '_Config', $this->Command, 'ICommand::__construct() Failed to set $_Config'); $this->assertRegExp('!BLW_.*!', $this->Command->getID(), 'ICommand::__construct() Failed to set $_ID'); $this->assertSame($this->Mediator, $this->Command->getMediator(), 'ICommand::__construct() Failed to set $_Mediator'); # Invalid arguments try { $this->Command = new Command('ping', $this->Config, $this->Mediator, 'CallbackCommand'); $this->fail('Failed to generate notice with invalid $ID'); } catch (InvalidArgumentException $e) { } try { $this->Command = new Command($this->Action, new GenericConfig(), $this->Mediator, 'CallbackCommand'); $this->fail('Failed to generate exception with invalid $ID'); } catch (InvalidArgumentException $e) { } try { $this->Command = new Command($this->Action, $this->Config, $this->Mediator, array()); $this->fail('Failed to generate exception with invalid $ID'); } catch (\PHPUnit_Framework_Error_Notice $e) { } }