コード例 #1
0
ファイル: EditorSpec.php プロジェクト: electrobits/redaktilo
 function it_checks_pattern_existence_below_the_given_line(SearchEngine $searchEngine, SearchStrategy $searchStrategy, Text $text)
 {
     $pattern = 'No one expects the Spanish inquisition!';
     $foundLineNumber = 42;
     $searchEngine->resolve($pattern)->willReturn($searchStrategy);
     $searchStrategy->findBelow($text, $pattern, 0)->willReturn($foundLineNumber);
     $this->hasBelow($text, $pattern, 0)->shouldBe(true);
     $searchStrategy->findBelow($text, $pattern, 0)->willReturn(false);
     $this->hasBelow($text, $pattern, 0)->shouldBe(false);
 }
コード例 #2
0
ファイル: Editor.php プロジェクト: lead-worker/redaktilo
 /**
  * Checks the presence of the given pattern in the Text below the current
  * line.
  *
  * @param Text  $text
  * @param mixed $pattern
  * @param int   $location
  *
  * @return bool
  *
  * @throws \Gnugat\Redaktilo\Exception\NotSupportedException If the given pattern isn't supported by any registered strategy
  *
  * @api
  */
 public function hasBelow(Text $text, $pattern, $location = null)
 {
     $searchStrategy = $this->searchEngine->resolve($pattern);
     $foundLineNumber = $searchStrategy->findBelow($text, $pattern, $location);
     return false !== $foundLineNumber;
 }