X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=vendor%2Fbehat%2Fgherkin%2Fsrc%2FBehat%2FGherkin%2FNode%2FScenarioNode.php;fp=vendor%2Fbehat%2Fgherkin%2Fsrc%2FBehat%2FGherkin%2FNode%2FScenarioNode.php;h=58267e1e225987671c11f566cedff2534effa182;hb=1270d9129ce8f27c9b28b10518e32132c58e0aca;hp=0000000000000000000000000000000000000000;hpb=c27c0f0cdaa3f354b1fe54a56ae7e854be6e3f68;p=yaffs-website diff --git a/vendor/behat/gherkin/src/Behat/Gherkin/Node/ScenarioNode.php b/vendor/behat/gherkin/src/Behat/Gherkin/Node/ScenarioNode.php new file mode 100644 index 000000000..58267e1e2 --- /dev/null +++ b/vendor/behat/gherkin/src/Behat/Gherkin/Node/ScenarioNode.php @@ -0,0 +1,150 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Behat\Gherkin\Node; + +/** + * Represents Gherkin Scenario. + * + * @author Konstantin Kudryashov + */ +class ScenarioNode implements ScenarioInterface +{ + /** + * @var string + */ + private $title; + /** + * @var array + */ + private $tags = array(); + /** + * @var StepNode[] + */ + private $steps = array(); + /** + * @var string + */ + private $keyword; + /** + * @var integer + */ + private $line; + + /** + * Initializes scenario. + * + * @param null|string $title + * @param array $tags + * @param StepNode[] $steps + * @param string $keyword + * @param integer $line + */ + public function __construct($title, array $tags, array $steps, $keyword, $line) + { + $this->title = $title; + $this->tags = $tags; + $this->steps = $steps; + $this->keyword = $keyword; + $this->line = $line; + } + + /** + * Returns node type string + * + * @return string + */ + public function getNodeType() + { + return 'Scenario'; + } + + /** + * Returns scenario title. + * + * @return null|string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Checks if scenario is tagged with tag. + * + * @param string $tag + * + * @return Boolean + */ + public function hasTag($tag) + { + return in_array($tag, $this->getTags()); + } + + /** + * Checks if scenario has tags (both inherited from feature and own). + * + * @return Boolean + */ + public function hasTags() + { + return 0 < count($this->getTags()); + } + + /** + * Returns scenario tags (including inherited from feature). + * + * @return array + */ + public function getTags() + { + return $this->tags; + } + + /** + * Checks if scenario has steps. + * + * @return Boolean + */ + public function hasSteps() + { + return 0 < count($this->steps); + } + + /** + * Returns scenario steps. + * + * @return StepNode[] + */ + public function getSteps() + { + return $this->steps; + } + + /** + * Returns scenario keyword. + * + * @return string + */ + public function getKeyword() + { + return $this->keyword; + } + + /** + * Returns scenario declaration line number. + * + * @return integer + */ + public function getLine() + { + return $this->line; + } +}