protected function validateScenarioNameOrThrowException(Expectation $expectation, LoggerInterface $logger) { if (!$expectation->getScenarioName() && ($expectation->getScenarioStateIs() || $expectation->getNewScenarioState())) { $logger->error('Scenario name related misconfiguration'); throw new \RuntimeException('Expecting or trying to set scenario state without specifying scenario name'); } }
private function isExpectedScenarioState(Expectation $expectation) { if ($expectation->getScenarioStateIs()) { $this->checkScenarioNameOrThrowException($expectation); $this->logger->debug('Checking scenario state again expectation'); $scenarioState = $this->scenarioStorage->getScenarioState($expectation->getScenarioName()); if ($expectation->getScenarioStateIs() != $scenarioState) { return false; } } return true; }