Sets base features path.
public setBasePath ( string $path ) | ||
$path | string | Loaders base path |
public function testSetBasePath() { $gherkin = new Gherkin(); $gherkin->addLoader($loader1 = $this->getLoaderMock()); $gherkin->addLoader($loader2 = $this->getLoaderMock()); $loader1->expects($this->once())->method('setBasePath')->with($basePath = '/base/path')->will($this->returnValue(null)); $loader2->expects($this->once())->method('setBasePath')->with($basePath = '/base/path')->will($this->returnValue(null)); $gherkin->setBasePath($basePath); }
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(); }