You are here

public function NodeElementTest::testWaitForTimeout in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/behat/mink/tests/Element/NodeElementTest.php \Behat\Mink\Tests\Element\NodeElementTest::testWaitForTimeout()

@medium

File

vendor/behat/mink/tests/Element/NodeElementTest.php, line 99

Class

NodeElementTest

Namespace

Behat\Mink\Tests\Element

Code

public function testWaitForTimeout() {
  $node = new NodeElement('some xpath', $this->session);
  $expectedTimeout = 2;
  $startTime = microtime(true);
  $result = $node
    ->waitFor($expectedTimeout, function () {
    return null;
  });
  $endTime = microtime(true);
  $this
    ->assertNull($result, '->waitFor() returns whatever callback gives');
  $this
    ->assertEquals($expectedTimeout, round($endTime - $startTime));
}