/**
  * @param RawTqContext $context
  *   Behat context.
  * @param string $selector
  *   Field selector.
  * @param bool $not
  *   Negate the condition.
  * @param string $expected
  *   Expected value.
  */
 public function __construct(RawTqContext $context, $selector, $not, $expected = '')
 {
     $this->not = (bool) $not;
     $this->context = $context;
     $this->selector = $selector;
     $this->expected = $expected;
     $this->element = $this->context->element('field', $selector);
     $this->value = $this->element->getValue();
     $this->tag = $this->element->getTagName();
 }
Example #2
0
 /**
  * @throws \Exception
  *
  * @return self
  */
 public function isDateSelected()
 {
     $value = $this->datePicker(['getDate']);
     $initial = $this->execute($this->date);
     // By some reasons DatePicker could not return a date using "getDate" method
     // and we'll try to use it from input value directly. An issue could occur
     // after saving the form and/or reloading the page.
     if (empty($value)) {
         $value = $this->execute(self::jsDate($this->element->getValue()));
     }
     self::debug(['Comparing "%s" with "%s".'], [$value, $initial]);
     if ($value !== $initial) {
         throw new \Exception(sprintf('DatePicker contains the "%s" but should "%s".', $value, $initial));
     }
     return $this;
 }
Example #3
0
 public function testGetValue()
 {
     $expected = 'val1';
     $node = new NodeElement('input_tag', $this->session);
     $this->driver->expects($this->once())->method('getValue')->with('input_tag')->will($this->returnValue($expected));
     $this->assertEquals($expected, $node->getValue());
 }