You are here

public static function PHPUnit_Framework_Assert::assertSelectEquals in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpunit/phpunit/src/Framework/Assert.php \PHPUnit_Framework_Assert::assertSelectEquals()

assertSelectEquals("#binder .name", "Chuck", true, $xml); // any? assertSelectEquals("#binder .name", "Chuck", false, $xml); // none?

@since Method available since Release 3.3.0

Parameters

array $selector:

string $content:

int|bool|array $count:

mixed $actual:

string $message:

bool $isHtml:

Deprecated

@codeCoverageIgnore

2 calls to PHPUnit_Framework_Assert::assertSelectEquals()
PHPUnit_Framework_Assert::assertSelectCount in vendor/phpunit/phpunit/src/Framework/Assert.php
Assert the presence, absence, or count of elements in a document matching the CSS $selector, regardless of the contents of those elements.
PHPUnit_Framework_Assert::assertSelectRegExp in vendor/phpunit/phpunit/src/Framework/Assert.php
assertSelectRegExp("#binder .name", "/Mike|Derek/", true, $xml); // any? assertSelectRegExp("#binder .name", "/Mike|Derek/", 3, $xml); // 3?

File

vendor/phpunit/phpunit/src/Framework/Assert.php, line 1948

Class

PHPUnit_Framework_Assert
A set of assert methods.

Code

public static function assertSelectEquals($selector, $content, $count, $actual, $message = '', $isHtml = true) {
  trigger_error(__METHOD__ . ' is deprecated', E_USER_DEPRECATED);
  $tags = PHPUnit_Util_XML::cssSelect($selector, $content, $actual, $isHtml);

  // assert specific number of elements
  if (is_numeric($count)) {
    $counted = $tags ? count($tags) : 0;
    self::assertEquals($count, $counted, $message);
  }
  elseif (is_bool($count)) {
    $any = count($tags) > 0 && $tags[0] instanceof DOMNode;
    if ($count) {
      self::assertTrue($any, $message);
    }
    else {
      self::assertFalse($any, $message);
    }
  }
  elseif (is_array($count) && (isset($count['>']) || isset($count['<']) || isset($count['>=']) || isset($count['<=']))) {
    $counted = $tags ? count($tags) : 0;
    if (isset($count['>'])) {
      self::assertTrue($counted > $count['>'], $message);
    }
    if (isset($count['>='])) {
      self::assertTrue($counted >= $count['>='], $message);
    }
    if (isset($count['<'])) {
      self::assertTrue($counted < $count['<'], $message);
    }
    if (isset($count['<='])) {
      self::assertTrue($counted <= $count['<='], $message);
    }
  }
  else {
    throw new PHPUnit_Framework_Exception();
  }
}