public function startWebserver(BeforeSuiteTested $suiteEvent)
 {
     $suite = $suiteEvent->getSuite();
     if ($this->suiteIdentifier->suiteNeedsWebserver($suite) && !$this->isStarted) {
         $this->webserverController->startServer();
         $this->isStarted = true;
     }
 }
 public function onBeforeSuite(BeforeSuiteTested $event)
 {
     $this->filesystemCleaner->clean([$this->masterPath]);
     if (is_dir($this->drupal->getSitePath())) {
         // The site exists, it doesn't need to be installed at this point.
         $event->stopPropagation();
     }
 }
 /**
  * @test
  */
 public function itStopsTheInstallIfTheSiteExistsBeforeTheSuiteIsRun()
 {
     $dispatcher = $this->prophesize('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface');
     $root = vfsStream::setup('foo');
     $root->addChild($sites = vfsStream::newDirectory('sites'));
     $sites->addChild(vfsStream::newDirectory('localhost'));
     $drupal = new Drupal('vfs://foo/', 'http://localhost/', 'standard');
     $processRunner = $this->prophesize('eLife\\IsolatedDrupalBehatExtension\\Process\\ProcessRunner');
     $cleaner = $this->prophesize('eLife\\IsolatedDrupalBehatExtension\\Filesystem\\FilesystemCleaner');
     $lazyCleaner = $this->prophesize('eLife\\IsolatedDrupalBehatExtension\\Filesystem\\LazyFilesystemCleaner');
     $listener = new BypassInstallSiteListener($dispatcher->reveal(), $drupal, new Filesystem(), '/path/to/drush', $processRunner->reveal(), $cleaner->reveal(), $lazyCleaner->reveal());
     $realDispatcher = $this->getDispatcher($listener);
     $suite = new GenericSuite('foo', []);
     $realDispatcher->dispatch(SuiteTested::BEFORE, $event = new BeforeSuiteTested(new StaticEnvironment($suite), new NoSpecificationsIterator($suite)));
     $this->assertTrue($event->isPropagationStopped());
 }
 /**
  * @param BeforeSuiteTested $event
  */
 public function onBeforeSuiteTested(BeforeSuiteTested $event)
 {
     $this->currentSuite = new Suite();
     $this->currentSuite->setName($event->getSuite()->getName());
     $print = $this->renderer->renderBeforeSuite($this);
     $this->printer->writeln($print);
 }
 /**
  * @param TestworkEvent\BeforeSuiteTested $event
  */
 public function onBeforeSuiteTested(TestworkEvent\BeforeSuiteTested $event)
 {
     $this->currentSuite = new Node\Suite();
     $this->currentSuite->setName($event->getSuite()->getName());
 }
 /**
  * @param BeforeSuiteTested $event
  */
 public function onBeforeSuiteTested(BeforeSuiteTested $event)
 {
     $this->currentSuite = new Suite();
     $this->currentSuite->setName($event->getSuite()->getName());
     $this->getCurrentFeature();
     $print = $this->renderer->renderBeforeSuite($this);
     /*Old logic, commet as tag for current suite noy used in index file*/
     /*        $this->printer->writeln($print);*/
 }
Example #7
0
 public function setUpTestRun(BeforeSuiteTested $event)
 {
     print "Rails logger initialised to use new suite id\n";
     $this->initRails();
     $suite_id = TestRailApiWrapper::create_new_testsuite(" " . $this->testrun_basename);
     $gerkin = new Gherkin();
     $base_path = $event->getSuite()->getSetting("paths")["features"];
     $gerkin->setBasePath($base_path);
     $i18nPath = dirname(dirname(dirname(dirname(dirname(__DIR__))))) . DIRECTORY_SEPARATOR . 'behat' . DIRECTORY_SEPARATOR . 'gherkin' . DIRECTORY_SEPARATOR . 'i18n.php';
     $gerkin->addLoader(new GherkinFileLoader(new Parser(new Lexer(new CachedArrayKeywords($i18nPath)))));
     $list = (new FilesystemFeatureLocator($gerkin, $base_path))->locateSpecifications($event->getSuite(), $base_path);
     $list->rewind();
     while ($list->valid()) {
         $suite_section = TestRailApiWrapper::create_new_section($list->current()->getTitle());
         // read scenarious from feaure
         foreach ($list->current()->getScenarios() as $scenario) {
             $test_case_id = TestRailApiWrapper::create_new_testcase($scenario->getTitle(), $suite_section);
             $this->testcases[$test_case_id] = $scenario->getTitle();
         }
         $list->next();
     }
     TestRailApiWrapper::create_new_testrun();
 }
 /**
  * @throws \InvalidArgumentException
  *
  * @param BeforeSuiteTestedEvent $event
  * @param string                 $eventName
  * @param EventDispatcher        $eventDispatcher
  */
 public function beNotifiedOfSuiteStartingEvent(BeforeSuiteTestedEvent $event, $eventName, EventDispatcher $eventDispatcher)
 {
     $suiteName = $event->getSuite()->getName();
     $this->phpUnitCodeCoverageTool->startRecordingCodeUsageWithTestName($suiteName);
 }