3
* This file is part of the Comparator package.
5
* (c) Sebastian Bergmann <sebastian@phpunit.de>
7
* For the full copyright and license information, please view the LICENSE
8
* file that was distributed with this source code.
11
namespace SebastianBergmann\Comparator;
14
* @coversDefaultClass SebastianBergmann\Comparator\ResourceComparator
17
* @author Jeff Welch <whatthejeff@gmail.com>
18
* @copyright Sebastian Bergmann <sebastian@phpunit.de>
19
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
20
* @link http://www.github.com/sebastianbergmann/comparator
22
class ResourceComparatorTest extends \PHPUnit_Framework_TestCase
26
protected function setUp()
28
$this->comparator = new ResourceComparator;
31
public function acceptsSucceedsProvider()
33
$tmpfile1 = tmpfile();
34
$tmpfile2 = tmpfile();
37
array($tmpfile1, $tmpfile1),
38
array($tmpfile2, $tmpfile2),
39
array($tmpfile1, $tmpfile2)
43
public function acceptsFailsProvider()
45
$tmpfile1 = tmpfile();
48
array($tmpfile1, null),
49
array(null, $tmpfile1),
54
public function assertEqualsSucceedsProvider()
56
$tmpfile1 = tmpfile();
57
$tmpfile2 = tmpfile();
60
array($tmpfile1, $tmpfile1),
61
array($tmpfile2, $tmpfile2)
65
public function assertEqualsFailsProvider()
67
$tmpfile1 = tmpfile();
68
$tmpfile2 = tmpfile();
71
array($tmpfile1, $tmpfile2),
72
array($tmpfile2, $tmpfile1)
78
* @dataProvider acceptsSucceedsProvider
80
public function testAcceptsSucceeds($expected, $actual)
83
$this->comparator->accepts($expected, $actual)
89
* @dataProvider acceptsFailsProvider
91
public function testAcceptsFails($expected, $actual)
94
$this->comparator->accepts($expected, $actual)
99
* @covers ::assertEquals
100
* @dataProvider assertEqualsSucceedsProvider
102
public function testAssertEqualsSucceeds($expected, $actual)
107
$this->comparator->assertEquals($expected, $actual);
110
catch (ComparisonFailure $exception) {
113
$this->assertNull($exception, 'Unexpected ComparisonFailure');
117
* @covers ::assertEquals
118
* @dataProvider assertEqualsFailsProvider
120
public function testAssertEqualsFails($expected, $actual)
122
$this->setExpectedException('SebastianBergmann\\Comparator\\ComparisonFailure');
123
$this->comparator->assertEquals($expected, $actual);