Exemplo n.º 1
0
 /**
  * @Then I should see:
  */
 public function iShouldSee(PyStringNode $content)
 {
     $displayArray = explode("\n", $this->tester->getDisplay());
     array_walk($displayArray, function (&$line) {
         $line = rtrim($line);
     });
     expect($displayArray)->shouldBeLike($content->getStrings());
 }
Exemplo n.º 2
0
 /**
  * @Then /^the console output should have lines ending in:$/
  */
 public function theConsoleOutputShouldHaveLinesEndingIn(PyStringNode $string)
 {
     $stdOutLines = explode(PHP_EOL, $this->lastBehatStdOut);
     $expectedLines = $string->getStrings();
     \PHPUnit_Framework_Assert::assertCount(count($expectedLines), $stdOutLines);
     foreach ($stdOutLines as $idx => $stdOutLine) {
         $suffix = isset($expectedLines[$idx]) ? $expectedLines[$idx] : '(NONE)';
         $constraint = \PHPUnit_Framework_Assert::stringEndsWith($suffix);
         $constraint->evaluate($stdOutLine);
     }
 }
Exemplo n.º 3
0
 /**
  * Expect until all of the named events have been fired.
  *
  * @Then I expect the following events:
  */
 public function iExpectTheFollowingEvents(PyStringNode $eventNames)
 {
     $this->waitForAuraEvents($eventNames->getStrings(), 5000);
 }
Exemplo n.º 4
0
 /**
  * @Given output should not be:
  */
 public function outputShouldNotBe(PyStringNode $string)
 {
     $expected = $string->getStrings();
     $check = false;
     foreach ($this->output as $index => $line) {
         if ($line !== $expected[$index]) {
             $check = true;
             break;
         }
     }
     if ($check === false) {
         throw new \Exception("Output should not be");
     }
 }
Exemplo n.º 5
0
 /**
  * @Given /^the output should contain:$/
  */
 public function theOutputShouldContain(PyStringNode $string)
 {
     foreach ($string->getStrings() as $line) {
         \PHPUnit_Framework_Assert::assertContains($line, $this->getOutput());
     }
 }
Exemplo n.º 6
0
 public function testGetStrings()
 {
     $str = new PyStringNode(array('line1', 'line2', 'line3'), 0);
     $this->assertEquals(array('line1', 'line2', 'line3'), $str->getStrings());
 }
 /**
  * @Then the headers contain
  */
 public function theHeadersContain(PyStringNode $string)
 {
     $response = $this->getClient()->getResponse();
     foreach ($string->getStrings() as $header) {
         list($name, $value) = preg_split('/\\s*:\\s*/', $header, 2);
         \assertTrue($response->headers->has($name));
         \assertEquals($value, $response->headers->get($name));
     }
 }
Exemplo n.º 8
0
 /**
  * @Then I should get:
  */
 public function iShouldGet(PyStringNode $string)
 {
     assertEquals($this->outputLines, $string->getStrings());
 }
Exemplo n.º 9
0
 /**
  * @param PyStringNode $options
  *
  * @return array
  */
 private function parseOptions(PyStringNode $options)
 {
     $return = array();
     foreach ($options->getStrings() as $option) {
         if (preg_match('/(?P<option>\\-\\-[a-zA-Z0-9\\-]*)((\\=|\\s)(?P<value>[^\\n\\s]*))?/', $option, $matches)) {
             $return[$matches['option']] = isset($matches['value']) ? $matches['value'] : true;
         }
         if (preg_match('/(?P<option>\\-[a-zA-Z0-9\\-]*) (?P<value>[^\\n\\s]*)?/', $option, $matches)) {
             $return[$matches['option']] = isset($matches['value']) ? $matches['value'] : true;
         }
     }
     return $return;
 }