addLoader() public method

Adds loader to manager.
public addLoader ( Behat\Gherkin\Loader\LoaderInterface $loader )
$loader Behat\Gherkin\Loader\LoaderInterface Feature loader
示例#1
0
 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);
 }
示例#2
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();
 }