protected function Framework_AssertTest::equalValues

2 calls to Framework_AssertTest::equalValues()
Framework_AssertTest::equalProvider in drupal/core/vendor/phpunit/phpunit/Tests/Framework/AssertTest.php
Framework_AssertTest::notSameProvider in drupal/core/vendor/phpunit/phpunit/Tests/Framework/AssertTest.php

File

drupal/core/vendor/phpunit/phpunit/Tests/Framework/AssertTest.php, line 691

Class

Framework_AssertTest
@package PHPUnit @author Sebastian Bergmann <sebastian@phpunit.de> @author Bernhard Schussek <bschussek@2bepublished.at> @copyright 2001-2013 Sebastian Bergmann <sebastian@phpunit.de> @license …

Code

protected function equalValues() {

  // cyclic dependencies
  $book1 = new Book();
  $book1->author = new Author('Terry Pratchett');
  $book1->author->books[] = $book1;
  $book2 = new Book();
  $book2->author = new Author('Terry Pratchett');
  $book2->author->books[] = $book2;
  $object1 = new SampleClass(4, 8, 15);
  $object2 = new SampleClass(4, 8, 15);
  $storage1 = new SplObjectStorage();
  $storage1
    ->attach($object1);
  $storage2 = new SplObjectStorage();
  $storage2
    ->attach($object1);
  return array(
    // strings
    array(
      'a',
      'A',
      0,
      FALSE,
      TRUE,
    ),
    // ignore case
    // arrays
    array(
      array(
        'a' => 1,
        'b' => 2,
      ),
      array(
        'b' => 2,
        'a' => 1,
      ),
    ),
    array(
      array(
        1,
      ),
      array(
        '1',
      ),
    ),
    array(
      array(
        3,
        2,
        1,
      ),
      array(
        2,
        3,
        1,
      ),
      0,
      TRUE,
    ),
    // canonicalized comparison
    // floats
    array(
      2.3,
      2.5,
      0.5,
    ),
    array(
      array(
        2.3,
      ),
      array(
        2.5,
      ),
      0.5,
    ),
    array(
      array(
        array(
          2.3,
        ),
      ),
      array(
        array(
          2.5,
        ),
      ),
      0.5,
    ),
    array(
      new Struct(2.3),
      new Struct(2.5),
      0.5,
    ),
    array(
      array(
        new Struct(2.3),
      ),
      array(
        new Struct(2.5),
      ),
      0.5,
    ),
    // numeric with delta
    array(
      1,
      2,
      1,
    ),
    // objects
    array(
      $object1,
      $object2,
    ),
    array(
      $book1,
      $book2,
    ),
    // SplObjectStorage
    array(
      $storage1,
      $storage2,
    ),
    // DOMDocument
    array(
      $this
        ->createDOMDocument('<root></root>'),
      $this
        ->createDOMDocument('<root/>'),
    ),
    array(
      $this
        ->createDOMDocument('<root attr="bar"></root>'),
      $this
        ->createDOMDocument('<root attr="bar"/>'),
    ),
    array(
      $this
        ->createDOMDocument('<root><foo attr="bar"></foo></root>'),
      $this
        ->createDOMDocument('<root><foo attr="bar"/></root>'),
    ),
    array(
      $this
        ->createDOMDocument("<root>\n  <child/>\n</root>"),
      $this
        ->createDOMDocument('<root><child/></root>'),
    ),
    // Exception

    //array(new Exception('Exception 1'), new Exception('Exception 1')),

    // mixed types
    array(
      0,
      '0',
    ),
    array(
      '0',
      0,
    ),
    array(
      2.3,
      '2.3',
    ),
    array(
      '2.3',
      2.3,
    ),
    array(
      (string) (1 / 3),
      1 - 2 / 3,
    ),
    array(
      1 / 3,
      (string) (1 - 2 / 3),
    ),
    array(
      'string representation',
      new ClassWithToString(),
    ),
    array(
      new ClassWithToString(),
      'string representation',
    ),
  );
}