-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
82 changed files
with
2,256 additions
and
1,495 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Behat Gherkin. | ||
* This file is part of the Behat Gherkin Parser. | ||
* (c) Konstantin Kudryashov <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
|
@@ -22,8 +22,8 @@ interface CacheInterface | |
/** | ||
* Checks that cache for feature exists and is fresh. | ||
* | ||
* @param string $path Feature path | ||
* @param integer $timestamp The last time feature was updated | ||
* @param string $path Feature path | ||
* @param int $timestamp The last time feature was updated | ||
* | ||
* @return bool | ||
*/ | ||
|
@@ -41,7 +41,7 @@ public function read($path); | |
/** | ||
* Caches feature node. | ||
* | ||
* @param string $path Feature path | ||
* @param string $path Feature path | ||
* @param FeatureNode $feature Feature instance | ||
*/ | ||
public function write($path, FeatureNode $feature); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Behat Gherkin. | ||
* (c) Konstantin Kudryashov <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
* This file is part of the Behat Gherkin Parser. | ||
* (c) Konstantin Kudryashov <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Behat\Gherkin\Cache; | ||
|
||
use Behat\Gherkin\Exception\CacheException; | ||
use Behat\Gherkin\Node\FeatureNode; | ||
use Behat\Gherkin\Gherkin; | ||
use Behat\Gherkin\Node\FeatureNode; | ||
|
||
/** | ||
* File cache. | ||
|
@@ -27,13 +27,13 @@ class FileCache implements CacheInterface | |
/** | ||
* Initializes file cache. | ||
* | ||
* @param string $path Path to the folder where to store caches. | ||
* @param string $path path to the folder where to store caches | ||
* | ||
* @throws CacheException | ||
*/ | ||
public function __construct($path) | ||
{ | ||
$this->path = rtrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.'v'.Gherkin::VERSION; | ||
$this->path = rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'v' . Gherkin::VERSION; | ||
|
||
if (!is_dir($this->path)) { | ||
@mkdir($this->path, 0777, true); | ||
|
@@ -47,8 +47,8 @@ public function __construct($path) | |
/** | ||
* Checks that cache for feature exists and is fresh. | ||
* | ||
* @param string $path Feature path | ||
* @param integer $timestamp The last time feature was updated | ||
* @param string $path Feature path | ||
* @param int $timestamp The last time feature was updated | ||
* | ||
* @return bool | ||
*/ | ||
|
@@ -78,7 +78,7 @@ public function read($path) | |
$feature = unserialize(file_get_contents($cachePath)); | ||
|
||
if (!$feature instanceof FeatureNode) { | ||
throw new CacheException(sprintf('Can not load cache for a feature "%s" from "%s".', $path, $cachePath )); | ||
throw new CacheException(sprintf('Can not load cache for a feature "%s" from "%s".', $path, $cachePath)); | ||
} | ||
|
||
return $feature; | ||
|
@@ -87,7 +87,7 @@ public function read($path) | |
/** | ||
* Caches feature node. | ||
* | ||
* @param string $path Feature path | ||
* @param string $path Feature path | ||
* @param FeatureNode $feature Feature instance | ||
*/ | ||
public function write($path, FeatureNode $feature) | ||
|
@@ -104,6 +104,6 @@ public function write($path, FeatureNode $feature) | |
*/ | ||
protected function getCachePathFor($path) | ||
{ | ||
return $this->path.'/'.md5($path).'.feature.cache'; | ||
return $this->path . '/' . md5($path) . '.feature.cache'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Behat Gherkin. | ||
* (c) Konstantin Kudryashov <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
* This file is part of the Behat Gherkin Parser. | ||
* (c) Konstantin Kudryashov <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Behat\Gherkin\Cache; | ||
|
||
|
@@ -20,14 +20,14 @@ | |
*/ | ||
class MemoryCache implements CacheInterface | ||
{ | ||
private $features = array(); | ||
private $timestamps = array(); | ||
private $features = []; | ||
private $timestamps = []; | ||
|
||
/** | ||
* Checks that cache for feature exists and is fresh. | ||
* | ||
* @param string $path Feature path | ||
* @param integer $timestamp The last time feature was updated | ||
* @param string $path Feature path | ||
* @param int $timestamp The last time feature was updated | ||
* | ||
* @return bool | ||
*/ | ||
|
@@ -55,12 +55,12 @@ public function read($path) | |
/** | ||
* Caches feature node. | ||
* | ||
* @param string $path Feature path | ||
* @param string $path Feature path | ||
* @param FeatureNode $feature Feature instance | ||
*/ | ||
public function write($path, FeatureNode $feature) | ||
{ | ||
$this->features[$path] = $feature; | ||
$this->features[$path] = $feature; | ||
$this->timestamps[$path] = time(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Behat Gherkin. | ||
* This file is part of the Behat Gherkin Parser. | ||
* (c) Konstantin Kudryashov <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
|
@@ -10,13 +10,11 @@ | |
|
||
namespace Behat\Gherkin\Exception; | ||
|
||
use RuntimeException; | ||
|
||
/** | ||
* Cache exception. | ||
* | ||
* @author Konstantin Kudryashov <[email protected]> | ||
*/ | ||
class CacheException extends RuntimeException implements Exception | ||
class CacheException extends \RuntimeException implements Exception | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Behat Gherkin. | ||
* This file is part of the Behat Gherkin Parser. | ||
* (c) Konstantin Kudryashov <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Behat Gherkin. | ||
* This file is part of the Behat Gherkin Parser. | ||
* (c) Konstantin Kudryashov <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
|
@@ -10,8 +10,6 @@ | |
|
||
namespace Behat\Gherkin\Exception; | ||
|
||
use RuntimeException; | ||
|
||
class LexerException extends RuntimeException implements Exception | ||
class LexerException extends \RuntimeException implements Exception | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Behat Gherkin. | ||
* This file is part of the Behat Gherkin Parser. | ||
* (c) Konstantin Kudryashov <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
|
@@ -10,8 +10,6 @@ | |
|
||
namespace Behat\Gherkin\Exception; | ||
|
||
use RuntimeException; | ||
|
||
class NodeException extends RuntimeException implements Exception | ||
class NodeException extends \RuntimeException implements Exception | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Behat Gherkin. | ||
* This file is part of the Behat Gherkin Parser. | ||
* (c) Konstantin Kudryashov <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
|
@@ -10,8 +10,6 @@ | |
|
||
namespace Behat\Gherkin\Exception; | ||
|
||
use RuntimeException; | ||
|
||
class ParserException extends RuntimeException implements Exception | ||
class ParserException extends \RuntimeException implements Exception | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Behat Gherkin. | ||
* This file is part of the Behat Gherkin Parser. | ||
* (c) Konstantin Kudryashov <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
|
@@ -22,13 +22,11 @@ abstract class ComplexFilter implements ComplexFilterInterface | |
/** | ||
* Filters feature according to the filter. | ||
* | ||
* @param FeatureNode $feature | ||
* | ||
* @return FeatureNode | ||
*/ | ||
public function filterFeature(FeatureNode $feature) | ||
{ | ||
$scenarios = array(); | ||
$scenarios = []; | ||
foreach ($feature->getScenarios() as $scenario) { | ||
if (!$this->isScenarioMatch($feature, $scenario)) { | ||
continue; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Behat Gherkin. | ||
* This file is part of the Behat Gherkin Parser. | ||
* (c) Konstantin Kudryashov <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
|
@@ -23,7 +23,7 @@ interface ComplexFilterInterface extends FeatureFilterInterface | |
/** | ||
* Checks if scenario or outline matches specified filter. | ||
* | ||
* @param FeatureNode $feature Feature node instance | ||
* @param FeatureNode $feature Feature node instance | ||
* @param ScenarioInterface $scenario Scenario or Outline node instance | ||
* | ||
* @return bool | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Behat Gherkin. | ||
* This file is part of the Behat Gherkin Parser. | ||
* (c) Konstantin Kudryashov <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
|
@@ -31,8 +31,6 @@ public function isFeatureMatch(FeatureNode $feature); | |
/** | ||
* Filters feature according to the filter and returns new one. | ||
* | ||
* @param FeatureNode $feature | ||
* | ||
* @return FeatureNode | ||
*/ | ||
public function filterFeature(FeatureNode $feature); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Behat Gherkin. | ||
* This file is part of the Behat Gherkin Parser. | ||
* (c) Konstantin Kudryashov <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Behat Gherkin. | ||
* This file is part of the Behat Gherkin Parser. | ||
* (c) Konstantin Kudryashov <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
|
@@ -70,13 +70,11 @@ public function isScenarioMatch(ScenarioInterface $scenario) | |
/** | ||
* Filters feature according to the filter and returns new one. | ||
* | ||
* @param FeatureNode $feature | ||
* | ||
* @return FeatureNode | ||
*/ | ||
public function filterFeature(FeatureNode $feature) | ||
{ | ||
$scenarios = array(); | ||
$scenarios = []; | ||
foreach ($feature->getScenarios() as $scenario) { | ||
if (!$this->isScenarioMatch($scenario)) { | ||
continue; | ||
|
@@ -88,7 +86,7 @@ public function filterFeature(FeatureNode $feature) | |
$lines = array_keys($table); | ||
|
||
if (in_array($this->filterLine, $lines)) { | ||
$filteredTable = array($lines[0] => $table[$lines[0]]); | ||
$filteredTable = [$lines[0] => $table[$lines[0]]]; | ||
|
||
if ($lines[0] !== $this->filterLine) { | ||
$filteredTable[$this->filterLine] = $table[$this->filterLine]; | ||
|
@@ -98,7 +96,7 @@ public function filterFeature(FeatureNode $feature) | |
$scenario->getTitle(), | ||
$scenario->getTags(), | ||
$scenario->getSteps(), | ||
array(new ExampleTableNode($filteredTable, $exampleTable->getKeyword(), $exampleTable->getTags())), | ||
[new ExampleTableNode($filteredTable, $exampleTable->getKeyword(), $exampleTable->getTags())], | ||
$scenario->getKeyword(), | ||
$scenario->getLine() | ||
); | ||
|
Oops, something went wrong.