/** * Invoking the setLocking method with a parameter that is not a boolean should throw an exception * * @expectedException \Afrihost\BaseCommandBundle\Exceptions\BaseCommandException */ public function testSetLockingNonBooleanException() { EncapsulationViolator::invokeMethod($this->command, 'setLocking', array(42)); }
public function testGetAndSetAllowMultipleExecution() { $command = new HelloWorldCommand(); EncapsulationViolator::invokeMethod($command, 'setAllowMultipleExecution', array(true)); $this->assertTrue(EncapsulationViolator::invokeMethod($command, 'isMultipleExecutionAllowed'), 'The value for allowMultipleExecution that we just set is different the the value we read'); }
/** * @expectedException \Afrihost\BaseCommandBundle\Exceptions\BaseCommandException * @expectedExceptionMessage Logger is already initialised */ public function testExceptionOnSetLogToConsoleAfterInitialize() { $command = $this->registerCommand(new HelloWorldCommand()); $this->executeCommand($command); EncapsulationViolator::invokeMethod($command, 'setLogToConsole', array(false)); }
/** * @expectedException \Afrihost\BaseCommandBundle\Exceptions\BaseCommandException * @expectedExceptionMessage Cannot access the Container yet. It has not yet been initialised and set */ public function testFriendlyExceptionWhenAccessingContainerBeforeItIsSet() { $config = new RuntimeConfig(new HelloWorldCommand()); EncapsulationViolator::invokeMethod($config, 'getContainer'); }