public function testRunException() { $expectedScenario = $this->_fixtureDir . DIRECTORY_SEPARATOR . 'scenario_error.jmx'; $this->setExpectedException('Magento_Exception', "Unable to run scenario '{$expectedScenario}', format is not supported."); $this->_handler->expects($this->atLeastOnce())->method('run')->will($this->returnValue(false)); $this->_object->run(); }
public function testRunStopOnSuccess() { $callSequence = new ArrayObject(); $this->_handleOne->expects($this->once())->method('run')->will($this->returnCallback($this->_createCallRecorder($callSequence, 'handleOne', false))); $this->_handleTwo->expects($this->once())->method('run')->will($this->returnCallback($this->_createCallRecorder($callSequence, 'handleTwo', true))); $this->_handleThree->expects($this->never())->method('run'); $this->assertTrue($this->_object->run('scenario.jmx', new Magento_Performance_Scenario_Arguments(array()))); $this->assertEquals(array('handleOne', 'handleTwo'), (array) $callSequence); }
public function testOnScenarioRun() { $this->_handler->expects($this->any())->method('run'); $notifications = array(); $this->_object->onScenarioRun(function ($scenario) use(&$notifications) { $notifications[] = $scenario->getFile(); }); $this->_object->run(); $this->assertEquals(array($this->_fixtureDir . DIRECTORY_SEPARATOR . 'scenario_error.jmx', $this->_fixtureDir . DIRECTORY_SEPARATOR . 'scenario_failure.jmx', $this->_fixtureDir . DIRECTORY_SEPARATOR . 'scenario.jmx'), $notifications); }
public function testOnScenarioFailure() { $failure = new Magento_Performance_Scenario_FailureException(); $this->_handler->expects($this->any())->method('run')->will($this->throwException($failure)); $notifications = array(); $this->_object->onScenarioFailure(function ($scenarioFile, $actualFailure) use(&$notifications, $failure) { PHPUnit_Framework_Assert::assertSame($failure, $actualFailure); $notifications[] = $scenarioFile; }); $this->_object->run('scenario.jmx', $this->_scenarioArgs); $this->assertEquals(array('scenario.jmx'), $notifications); $this->_object->run('scenario.jmx', $this->_scenarioArgs); $this->assertEquals(array('scenario.jmx', 'scenario.jmx'), $notifications); }
public function testRunDelegation() { $reportFile = 'scenario.jtl'; $this->_handler->expects($this->once())->method('run')->with($this->_scenario, $reportFile); $this->_object->run($this->_scenario, $reportFile); }