protected function Framework_AssertTest::notEqualValues

2 calls to Framework_AssertTest::notEqualValues()
Framework_AssertTest::notEqualProvider 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 594

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 notEqualValues() {

  // cyclic dependencies
  $book1 = new Book();
  $book1->author = new Author('Terry Pratchett');
  $book1->author->books[] = $book1;
  $book2 = new Book();
  $book2->author = new Author('Terry Pratch');
  $book2->author->books[] = $book2;
  $book3 = new Book();
  $book3->author = 'Terry Pratchett';
  $book4 = new stdClass();
  $book4->author = 'Terry Pratchett';
  $object1 = new SampleClass(4, 8, 15);
  $object2 = new SampleClass(16, 23, 42);
  $object3 = new SampleClass(4, 8, 15);
  $storage1 = new SplObjectStorage();
  $storage1
    ->attach($object1);
  $storage2 = new SplObjectStorage();
  $storage2
    ->attach($object3);

  // same content, different object
  // cannot use $filesDirectory, because neither setUp() nor
  // setUpBeforeClass() are executed before the data providers
  $file = dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'foo.xml';
  return array(
    // strings
    array(
      'a',
      'b',
    ),
    array(
      'a',
      'A',
    ),
    // integers
    array(
      1,
      2,
    ),
    array(
      2,
      1,
    ),
    // floats
    array(
      2.3,
      4.2,
    ),
    array(
      2.3,
      4.2,
      0.5,
    ),
    array(
      array(
        2.3,
      ),
      array(
        4.2,
      ),
      0.5,
    ),
    array(
      array(
        array(
          2.3,
        ),
      ),
      array(
        array(
          4.2,
        ),
      ),
      0.5,
    ),
    array(
      new Struct(2.3),
      new Struct(4.2),
      0.5,
    ),
    array(
      array(
        new Struct(2.3),
      ),
      array(
        new Struct(4.2),
      ),
      0.5,
    ),
    // NAN
    array(
      NAN,
      NAN,
    ),
    // arrays
    array(
      array(),
      array(
        0 => 1,
      ),
    ),
    array(
      array(
        0 => 1,
      ),
      array(),
    ),
    array(
      array(
        0 => NULL,
      ),
      array(),
    ),
    array(
      array(
        0 => 1,
        1 => 2,
      ),
      array(
        0 => 1,
        1 => 3,
      ),
    ),
    array(
      array(
        'a',
        'b' => array(
          1,
          2,
        ),
      ),
      array(
        'a',
        'b' => array(
          2,
          1,
        ),
      ),
    ),
    // objects
    array(
      new SampleClass(4, 8, 15),
      new SampleClass(16, 23, 42),
    ),
    array(
      $object1,
      $object2,
    ),
    array(
      $book1,
      $book2,
    ),
    array(
      $book3,
      $book4,
    ),
    // same content, different class
    // resources
    array(
      fopen($file, 'r'),
      fopen($file, 'r'),
    ),
    // SplObjectStorage
    array(
      $storage1,
      $storage2,
    ),
    // DOMDocument
    array(
      $this
        ->createDOMDocument('<root></root>'),
      $this
        ->createDOMDocument('<bar/>'),
    ),
    array(
      $this
        ->createDOMDocument('<foo attr1="bar"/>'),
      $this
        ->createDOMDocument('<foo attr1="foobar"/>'),
    ),
    array(
      $this
        ->createDOMDocument('<foo> bar </foo>'),
      $this
        ->createDOMDocument('<foo />'),
    ),
    array(
      $this
        ->createDOMDocument('<foo xmlns="urn:myns:bar"/>'),
      $this
        ->createDOMDocument('<foo xmlns="urn:notmyns:bar"/>'),
    ),
    array(
      $this
        ->createDOMDocument('<foo> bar </foo>'),
      $this
        ->createDOMDocument('<foo> bir </foo>'),
    ),
    // Exception

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

    // different types
    array(
      new SampleClass(4, 8, 15),
      FALSE,
    ),
    array(
      FALSE,
      new SampleClass(4, 8, 15),
    ),
    array(
      array(
        0 => 1,
        1 => 2,
      ),
      FALSE,
    ),
    array(
      FALSE,
      array(
        0 => 1,
        1 => 2,
      ),
    ),
    array(
      array(),
      new stdClass(),
    ),
    array(
      new stdClass(),
      array(),
    ),
    // PHP: 0 == 'Foobar' => TRUE!
    // We want these values to differ
    array(
      0,
      'Foobar',
    ),
    array(
      'Foobar',
      0,
    ),
    array(
      3,
      acos(8),
    ),
    array(
      acos(8),
      3,
    ),
  );
}