function let(SpecificationNode $specificationNode, ExampleEvent $exampleEvent, ServiceContainer $container, CodeCoverageSession $coverageSession) { $r = new \ReflectionClass(__CLASS__); $specificationNode->getClassReflection()->willReturn($r); $specificationNode->getTitle()->willReturn('Specification'); $exampleEvent->getSpecification()->willReturn($specificationNode); $exampleEvent->getTitle()->willReturn('it should do something'); $this->cwd = getcwd(); chdir(sys_get_temp_dir()); $container->get('coverage.session')->willReturn($coverageSession); $this->setCoverageRunner($coverageSession); $this->load($container); }
private function addResult($result, SpecificationNode $spec, $title = null) { $map = array(ResultEvent::SUCCEED => 'Succeed: %title%', ResultEvent::FAILED => 'Failed: %title%', ResultEvent::BROKEN => 'Broken: %title%', ResultEvent::ERROR => 'Error: %title%'); $r = $spec->getClassReflection(); $arguments = array('file' => $r->getFileName()); $key = md5($r->getFileName() . $title); $format = $map[$result]; $title = $title == null ? $spec->getTitle() : $spec->getTitle() . '::' . $title; $message = strtr($format, array('%title%' => '<highlight>' . $title . '</highlight>')); $this->results[$key] = ResultEvent::create($result, $message, $arguments); }