You are here

class ResourceComparatorTest in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/sebastian/comparator/tests/ResourceComparatorTest.php \SebastianBergmann\Comparator\ResourceComparatorTest

@coversDefaultClass SebastianBergmann\Comparator\ResourceComparator

Hierarchy

  • class \SebastianBergmann\Comparator\ResourceComparatorTest extends \SebastianBergmann\Comparator\PHPUnit_Framework_TestCase

Expanded class hierarchy of ResourceComparatorTest

File

vendor/sebastian/comparator/tests/ResourceComparatorTest.php, line 17

Namespace

SebastianBergmann\Comparator
View source
class ResourceComparatorTest extends \PHPUnit_Framework_TestCase {
  private $comparator;
  protected function setUp() {
    $this->comparator = new ResourceComparator();
  }
  public function acceptsSucceedsProvider() {
    $tmpfile1 = tmpfile();
    $tmpfile2 = tmpfile();
    return array(
      array(
        $tmpfile1,
        $tmpfile1,
      ),
      array(
        $tmpfile2,
        $tmpfile2,
      ),
      array(
        $tmpfile1,
        $tmpfile2,
      ),
    );
  }
  public function acceptsFailsProvider() {
    $tmpfile1 = tmpfile();
    return array(
      array(
        $tmpfile1,
        null,
      ),
      array(
        null,
        $tmpfile1,
      ),
      array(
        null,
        null,
      ),
    );
  }
  public function assertEqualsSucceedsProvider() {
    $tmpfile1 = tmpfile();
    $tmpfile2 = tmpfile();
    return array(
      array(
        $tmpfile1,
        $tmpfile1,
      ),
      array(
        $tmpfile2,
        $tmpfile2,
      ),
    );
  }
  public function assertEqualsFailsProvider() {
    $tmpfile1 = tmpfile();
    $tmpfile2 = tmpfile();
    return array(
      array(
        $tmpfile1,
        $tmpfile2,
      ),
      array(
        $tmpfile2,
        $tmpfile1,
      ),
    );
  }

  /**
   * @covers       ::accepts
   * @dataProvider acceptsSucceedsProvider
   */
  public function testAcceptsSucceeds($expected, $actual) {
    $this
      ->assertTrue($this->comparator
      ->accepts($expected, $actual));
  }

  /**
   * @covers       ::accepts
   * @dataProvider acceptsFailsProvider
   */
  public function testAcceptsFails($expected, $actual) {
    $this
      ->assertFalse($this->comparator
      ->accepts($expected, $actual));
  }

  /**
   * @covers       ::assertEquals
   * @dataProvider assertEqualsSucceedsProvider
   */
  public function testAssertEqualsSucceeds($expected, $actual) {
    $exception = null;
    try {
      $this->comparator
        ->assertEquals($expected, $actual);
    } catch (ComparisonFailure $exception) {
    }
    $this
      ->assertNull($exception, 'Unexpected ComparisonFailure');
  }

  /**
   * @covers       ::assertEquals
   * @dataProvider assertEqualsFailsProvider
   */
  public function testAssertEqualsFails($expected, $actual) {
    $this
      ->setExpectedException('SebastianBergmann\\Comparator\\ComparisonFailure');
    $this->comparator
      ->assertEquals($expected, $actual);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ResourceComparatorTest::$comparator private property
ResourceComparatorTest::acceptsFailsProvider public function
ResourceComparatorTest::acceptsSucceedsProvider public function
ResourceComparatorTest::assertEqualsFailsProvider public function
ResourceComparatorTest::assertEqualsSucceedsProvider public function
ResourceComparatorTest::setUp protected function
ResourceComparatorTest::testAcceptsFails public function @covers ::accepts @dataProvider acceptsFailsProvider
ResourceComparatorTest::testAcceptsSucceeds public function @covers ::accepts @dataProvider acceptsSucceedsProvider
ResourceComparatorTest::testAssertEqualsFails public function @covers ::assertEquals @dataProvider assertEqualsFailsProvider
ResourceComparatorTest::testAssertEqualsSucceeds public function @covers ::assertEquals @dataProvider assertEqualsSucceedsProvider