@@ -14,69 +14,69 @@ |
||
| 14 | 14 | |
| 15 | 15 | class JsonMatchesErrorMessageProviderTest extends TestCase |
| 16 | 16 | { |
| 17 | - /** |
|
| 18 | - * @dataProvider translateTypeToPrefixDataprovider |
|
| 19 | - */ |
|
| 20 | - public function testTranslateTypeToPrefix($expected, $type) |
|
| 21 | - { |
|
| 22 | - $this->assertEquals( |
|
| 23 | - $expected, |
|
| 24 | - JsonMatchesErrorMessageProvider::translateTypeToPrefix($type) |
|
| 25 | - ); |
|
| 26 | - } |
|
| 17 | + /** |
|
| 18 | + * @dataProvider translateTypeToPrefixDataprovider |
|
| 19 | + */ |
|
| 20 | + public function testTranslateTypeToPrefix($expected, $type) |
|
| 21 | + { |
|
| 22 | + $this->assertEquals( |
|
| 23 | + $expected, |
|
| 24 | + JsonMatchesErrorMessageProvider::translateTypeToPrefix($type) |
|
| 25 | + ); |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * @dataProvider determineJsonErrorDataprovider |
|
| 30 | - */ |
|
| 31 | - public function testDetermineJsonError($expected, $error, $prefix) |
|
| 32 | - { |
|
| 33 | - $this->assertEquals( |
|
| 34 | - $expected, |
|
| 35 | - JsonMatchesErrorMessageProvider::determineJsonError( |
|
| 36 | - $error, |
|
| 37 | - $prefix |
|
| 38 | - ) |
|
| 39 | - ); |
|
| 40 | - } |
|
| 28 | + /** |
|
| 29 | + * @dataProvider determineJsonErrorDataprovider |
|
| 30 | + */ |
|
| 31 | + public function testDetermineJsonError($expected, $error, $prefix) |
|
| 32 | + { |
|
| 33 | + $this->assertEquals( |
|
| 34 | + $expected, |
|
| 35 | + JsonMatchesErrorMessageProvider::determineJsonError( |
|
| 36 | + $error, |
|
| 37 | + $prefix |
|
| 38 | + ) |
|
| 39 | + ); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - public static function determineJsonErrorDataprovider() |
|
| 43 | - { |
|
| 44 | - return [ |
|
| 45 | - 'JSON_ERROR_NONE' => [ |
|
| 46 | - null, 'json_error_none', '' |
|
| 47 | - ], |
|
| 48 | - 'JSON_ERROR_DEPTH' => [ |
|
| 49 | - 'Maximum stack depth exceeded', JSON_ERROR_DEPTH, '' |
|
| 50 | - ], |
|
| 51 | - 'prefixed JSON_ERROR_DEPTH' => [ |
|
| 52 | - 'TUX: Maximum stack depth exceeded', JSON_ERROR_DEPTH, 'TUX: ' |
|
| 53 | - ], |
|
| 54 | - 'JSON_ERROR_STATE_MISMatch' => [ |
|
| 55 | - 'Underflow or the modes mismatch', JSON_ERROR_STATE_MISMATCH, '' |
|
| 56 | - ], |
|
| 57 | - 'JSON_ERROR_CTRL_CHAR' => [ |
|
| 58 | - 'Unexpected control character found', JSON_ERROR_CTRL_CHAR, '' |
|
| 59 | - ], |
|
| 60 | - 'JSON_ERROR_SYNTAX' => [ |
|
| 61 | - 'Syntax error, malformed JSON', JSON_ERROR_SYNTAX, '' |
|
| 62 | - ], |
|
| 63 | - 'JSON_ERROR_UTF8`' => [ |
|
| 64 | - 'Malformed UTF-8 characters, possibly incorrectly encoded', |
|
| 65 | - JSON_ERROR_UTF8, |
|
| 66 | - '' |
|
| 67 | - ], |
|
| 68 | - 'Invalid error indicator' => [ |
|
| 69 | - 'Unknown error', 55, '' |
|
| 70 | - ], |
|
| 71 | - ]; |
|
| 72 | - } |
|
| 42 | + public static function determineJsonErrorDataprovider() |
|
| 43 | + { |
|
| 44 | + return [ |
|
| 45 | + 'JSON_ERROR_NONE' => [ |
|
| 46 | + null, 'json_error_none', '' |
|
| 47 | + ], |
|
| 48 | + 'JSON_ERROR_DEPTH' => [ |
|
| 49 | + 'Maximum stack depth exceeded', JSON_ERROR_DEPTH, '' |
|
| 50 | + ], |
|
| 51 | + 'prefixed JSON_ERROR_DEPTH' => [ |
|
| 52 | + 'TUX: Maximum stack depth exceeded', JSON_ERROR_DEPTH, 'TUX: ' |
|
| 53 | + ], |
|
| 54 | + 'JSON_ERROR_STATE_MISMatch' => [ |
|
| 55 | + 'Underflow or the modes mismatch', JSON_ERROR_STATE_MISMATCH, '' |
|
| 56 | + ], |
|
| 57 | + 'JSON_ERROR_CTRL_CHAR' => [ |
|
| 58 | + 'Unexpected control character found', JSON_ERROR_CTRL_CHAR, '' |
|
| 59 | + ], |
|
| 60 | + 'JSON_ERROR_SYNTAX' => [ |
|
| 61 | + 'Syntax error, malformed JSON', JSON_ERROR_SYNTAX, '' |
|
| 62 | + ], |
|
| 63 | + 'JSON_ERROR_UTF8`' => [ |
|
| 64 | + 'Malformed UTF-8 characters, possibly incorrectly encoded', |
|
| 65 | + JSON_ERROR_UTF8, |
|
| 66 | + '' |
|
| 67 | + ], |
|
| 68 | + 'Invalid error indicator' => [ |
|
| 69 | + 'Unknown error', 55, '' |
|
| 70 | + ], |
|
| 71 | + ]; |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - public static function translateTypeToPrefixDataprovider() |
|
| 75 | - { |
|
| 76 | - return [ |
|
| 77 | - 'expected' => ['Expected value JSON decode error - ', 'expected'], |
|
| 78 | - 'actual' => ['Actual value JSON decode error - ', 'actual'], |
|
| 79 | - 'default' => ['', ''], |
|
| 80 | - ]; |
|
| 81 | - } |
|
| 74 | + public static function translateTypeToPrefixDataprovider() |
|
| 75 | + { |
|
| 76 | + return [ |
|
| 77 | + 'expected' => ['Expected value JSON decode error - ', 'expected'], |
|
| 78 | + 'actual' => ['Actual value JSON decode error - ', 'actual'], |
|
| 79 | + 'default' => ['', ''], |
|
| 80 | + ]; |
|
| 81 | + } |
|
| 82 | 82 | } |
@@ -14,43 +14,43 @@ |
||
| 14 | 14 | |
| 15 | 15 | class ExceptionMessageRegExpTest extends TestCase |
| 16 | 16 | { |
| 17 | - /** |
|
| 18 | - * @expectedException \Exception |
|
| 19 | - * @expectedExceptionMessageRegExp /^A polymorphic \w+ message/ |
|
| 20 | - */ |
|
| 21 | - public function testRegexMessage() |
|
| 22 | - { |
|
| 23 | - throw new \Exception('A polymorphic exception message'); |
|
| 24 | - } |
|
| 17 | + /** |
|
| 18 | + * @expectedException \Exception |
|
| 19 | + * @expectedExceptionMessageRegExp /^A polymorphic \w+ message/ |
|
| 20 | + */ |
|
| 21 | + public function testRegexMessage() |
|
| 22 | + { |
|
| 23 | + throw new \Exception('A polymorphic exception message'); |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * @expectedException \Exception |
|
| 28 | - * @expectedExceptionMessageRegExp /^a poly[a-z]+ [a-zA-Z0-9_]+ me(s){2}age$/i |
|
| 29 | - */ |
|
| 30 | - public function testRegexMessageExtreme() |
|
| 31 | - { |
|
| 32 | - throw new \Exception('A polymorphic exception message'); |
|
| 33 | - } |
|
| 26 | + /** |
|
| 27 | + * @expectedException \Exception |
|
| 28 | + * @expectedExceptionMessageRegExp /^a poly[a-z]+ [a-zA-Z0-9_]+ me(s){2}age$/i |
|
| 29 | + */ |
|
| 30 | + public function testRegexMessageExtreme() |
|
| 31 | + { |
|
| 32 | + throw new \Exception('A polymorphic exception message'); |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * @runInSeparateProcess |
|
| 37 | - * @requires extension xdebug |
|
| 38 | - * @expectedException \Exception |
|
| 39 | - * @expectedExceptionMessageRegExp #Screaming preg_match# |
|
| 40 | - */ |
|
| 41 | - public function testMessageXdebugScreamCompatibility() |
|
| 42 | - { |
|
| 43 | - \ini_set('xdebug.scream', '1'); |
|
| 35 | + /** |
|
| 36 | + * @runInSeparateProcess |
|
| 37 | + * @requires extension xdebug |
|
| 38 | + * @expectedException \Exception |
|
| 39 | + * @expectedExceptionMessageRegExp #Screaming preg_match# |
|
| 40 | + */ |
|
| 41 | + public function testMessageXdebugScreamCompatibility() |
|
| 42 | + { |
|
| 43 | + \ini_set('xdebug.scream', '1'); |
|
| 44 | 44 | |
| 45 | - throw new \Exception('Screaming preg_match'); |
|
| 46 | - } |
|
| 45 | + throw new \Exception('Screaming preg_match'); |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * @expectedException \Exception variadic |
|
| 50 | - * @expectedExceptionMessageRegExp /^A variadic \w+ message/ |
|
| 51 | - */ |
|
| 52 | - public function testSimultaneousLiteralAndRegExpExceptionMessage() |
|
| 53 | - { |
|
| 54 | - throw new \Exception('A variadic exception message'); |
|
| 55 | - } |
|
| 48 | + /** |
|
| 49 | + * @expectedException \Exception variadic |
|
| 50 | + * @expectedExceptionMessageRegExp /^A variadic \w+ message/ |
|
| 51 | + */ |
|
| 52 | + public function testSimultaneousLiteralAndRegExpExceptionMessage() |
|
| 53 | + { |
|
| 54 | + throw new \Exception('A variadic exception message'); |
|
| 55 | + } |
|
| 56 | 56 | } |
@@ -12,101 +12,101 @@ |
||
| 12 | 12 | |
| 13 | 13 | class TestListenerTest extends TestCase implements TestListener |
| 14 | 14 | { |
| 15 | - protected $endCount; |
|
| 16 | - protected $errorCount; |
|
| 17 | - protected $failureCount; |
|
| 18 | - protected $warningCount; |
|
| 19 | - protected $notImplementedCount; |
|
| 20 | - protected $riskyCount; |
|
| 21 | - protected $skippedCount; |
|
| 22 | - protected $result; |
|
| 23 | - protected $startCount; |
|
| 24 | - |
|
| 25 | - public function addError(Test $test, \Exception $e, $time) |
|
| 26 | - { |
|
| 27 | - $this->errorCount++; |
|
| 28 | - } |
|
| 29 | - |
|
| 30 | - public function addWarning(Test $test, Warning $e, $time) |
|
| 31 | - { |
|
| 32 | - $this->warningCount++; |
|
| 33 | - } |
|
| 34 | - |
|
| 35 | - public function addFailure(Test $test, AssertionFailedError $e, $time) |
|
| 36 | - { |
|
| 37 | - $this->failureCount++; |
|
| 38 | - } |
|
| 39 | - |
|
| 40 | - public function addIncompleteTest(Test $test, \Exception $e, $time) |
|
| 41 | - { |
|
| 42 | - $this->notImplementedCount++; |
|
| 43 | - } |
|
| 44 | - |
|
| 45 | - public function addRiskyTest(Test $test, \Exception $e, $time) |
|
| 46 | - { |
|
| 47 | - $this->riskyCount++; |
|
| 48 | - } |
|
| 49 | - |
|
| 50 | - public function addSkippedTest(Test $test, \Exception $e, $time) |
|
| 51 | - { |
|
| 52 | - $this->skippedCount++; |
|
| 53 | - } |
|
| 54 | - |
|
| 55 | - public function startTestSuite(TestSuite $suite) |
|
| 56 | - { |
|
| 57 | - } |
|
| 58 | - |
|
| 59 | - public function endTestSuite(TestSuite $suite) |
|
| 60 | - { |
|
| 61 | - } |
|
| 62 | - |
|
| 63 | - public function startTest(Test $test) |
|
| 64 | - { |
|
| 65 | - $this->startCount++; |
|
| 66 | - } |
|
| 67 | - |
|
| 68 | - public function endTest(Test $test, $time) |
|
| 69 | - { |
|
| 70 | - $this->endCount++; |
|
| 71 | - } |
|
| 72 | - |
|
| 73 | - protected function setUp() |
|
| 74 | - { |
|
| 75 | - $this->result = new TestResult; |
|
| 76 | - $this->result->addListener($this); |
|
| 77 | - |
|
| 78 | - $this->endCount = 0; |
|
| 79 | - $this->failureCount = 0; |
|
| 80 | - $this->notImplementedCount = 0; |
|
| 81 | - $this->riskyCount = 0; |
|
| 82 | - $this->skippedCount = 0; |
|
| 83 | - $this->startCount = 0; |
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - public function testError() |
|
| 87 | - { |
|
| 88 | - $test = new \TestError; |
|
| 89 | - $test->run($this->result); |
|
| 90 | - |
|
| 91 | - $this->assertEquals(1, $this->errorCount); |
|
| 92 | - $this->assertEquals(1, $this->endCount); |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - public function testFailure() |
|
| 96 | - { |
|
| 97 | - $test = new \Failure; |
|
| 98 | - $test->run($this->result); |
|
| 99 | - |
|
| 100 | - $this->assertEquals(1, $this->failureCount); |
|
| 101 | - $this->assertEquals(1, $this->endCount); |
|
| 102 | - } |
|
| 103 | - |
|
| 104 | - public function testStartStop() |
|
| 105 | - { |
|
| 106 | - $test = new \Success; |
|
| 107 | - $test->run($this->result); |
|
| 108 | - |
|
| 109 | - $this->assertEquals(1, $this->startCount); |
|
| 110 | - $this->assertEquals(1, $this->endCount); |
|
| 111 | - } |
|
| 15 | + protected $endCount; |
|
| 16 | + protected $errorCount; |
|
| 17 | + protected $failureCount; |
|
| 18 | + protected $warningCount; |
|
| 19 | + protected $notImplementedCount; |
|
| 20 | + protected $riskyCount; |
|
| 21 | + protected $skippedCount; |
|
| 22 | + protected $result; |
|
| 23 | + protected $startCount; |
|
| 24 | + |
|
| 25 | + public function addError(Test $test, \Exception $e, $time) |
|
| 26 | + { |
|
| 27 | + $this->errorCount++; |
|
| 28 | + } |
|
| 29 | + |
|
| 30 | + public function addWarning(Test $test, Warning $e, $time) |
|
| 31 | + { |
|
| 32 | + $this->warningCount++; |
|
| 33 | + } |
|
| 34 | + |
|
| 35 | + public function addFailure(Test $test, AssertionFailedError $e, $time) |
|
| 36 | + { |
|
| 37 | + $this->failureCount++; |
|
| 38 | + } |
|
| 39 | + |
|
| 40 | + public function addIncompleteTest(Test $test, \Exception $e, $time) |
|
| 41 | + { |
|
| 42 | + $this->notImplementedCount++; |
|
| 43 | + } |
|
| 44 | + |
|
| 45 | + public function addRiskyTest(Test $test, \Exception $e, $time) |
|
| 46 | + { |
|
| 47 | + $this->riskyCount++; |
|
| 48 | + } |
|
| 49 | + |
|
| 50 | + public function addSkippedTest(Test $test, \Exception $e, $time) |
|
| 51 | + { |
|
| 52 | + $this->skippedCount++; |
|
| 53 | + } |
|
| 54 | + |
|
| 55 | + public function startTestSuite(TestSuite $suite) |
|
| 56 | + { |
|
| 57 | + } |
|
| 58 | + |
|
| 59 | + public function endTestSuite(TestSuite $suite) |
|
| 60 | + { |
|
| 61 | + } |
|
| 62 | + |
|
| 63 | + public function startTest(Test $test) |
|
| 64 | + { |
|
| 65 | + $this->startCount++; |
|
| 66 | + } |
|
| 67 | + |
|
| 68 | + public function endTest(Test $test, $time) |
|
| 69 | + { |
|
| 70 | + $this->endCount++; |
|
| 71 | + } |
|
| 72 | + |
|
| 73 | + protected function setUp() |
|
| 74 | + { |
|
| 75 | + $this->result = new TestResult; |
|
| 76 | + $this->result->addListener($this); |
|
| 77 | + |
|
| 78 | + $this->endCount = 0; |
|
| 79 | + $this->failureCount = 0; |
|
| 80 | + $this->notImplementedCount = 0; |
|
| 81 | + $this->riskyCount = 0; |
|
| 82 | + $this->skippedCount = 0; |
|
| 83 | + $this->startCount = 0; |
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + public function testError() |
|
| 87 | + { |
|
| 88 | + $test = new \TestError; |
|
| 89 | + $test->run($this->result); |
|
| 90 | + |
|
| 91 | + $this->assertEquals(1, $this->errorCount); |
|
| 92 | + $this->assertEquals(1, $this->endCount); |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + public function testFailure() |
|
| 96 | + { |
|
| 97 | + $test = new \Failure; |
|
| 98 | + $test->run($this->result); |
|
| 99 | + |
|
| 100 | + $this->assertEquals(1, $this->failureCount); |
|
| 101 | + $this->assertEquals(1, $this->endCount); |
|
| 102 | + } |
|
| 103 | + |
|
| 104 | + public function testStartStop() |
|
| 105 | + { |
|
| 106 | + $test = new \Success; |
|
| 107 | + $test->run($this->result); |
|
| 108 | + |
|
| 109 | + $this->assertEquals(1, $this->startCount); |
|
| 110 | + $this->assertEquals(1, $this->endCount); |
|
| 111 | + } |
|
| 112 | 112 | } |
@@ -12,15 +12,15 @@ |
||
| 12 | 12 | |
| 13 | 13 | class TestImplementorTest extends TestCase |
| 14 | 14 | { |
| 15 | - public function testSuccessfulRun() |
|
| 16 | - { |
|
| 17 | - $result = new TestResult; |
|
| 15 | + public function testSuccessfulRun() |
|
| 16 | + { |
|
| 17 | + $result = new TestResult; |
|
| 18 | 18 | |
| 19 | - $test = new \DoubleTestCase(new \Success); |
|
| 20 | - $test->run($result); |
|
| 19 | + $test = new \DoubleTestCase(new \Success); |
|
| 20 | + $test->run($result); |
|
| 21 | 21 | |
| 22 | - $this->assertCount(\count($test), $result); |
|
| 23 | - $this->assertEquals(0, $result->errorCount()); |
|
| 24 | - $this->assertEquals(0, $result->failureCount()); |
|
| 25 | - } |
|
| 22 | + $this->assertCount(\count($test), $result); |
|
| 23 | + $this->assertEquals(0, $result->errorCount()); |
|
| 24 | + $this->assertEquals(0, $result->failureCount()); |
|
| 25 | + } |
|
| 26 | 26 | } |
@@ -14,3177 +14,3177 @@ |
||
| 14 | 14 | |
| 15 | 15 | class AssertTest extends TestCase |
| 16 | 16 | { |
| 17 | - /** |
|
| 18 | - * @var string |
|
| 19 | - */ |
|
| 20 | - private $filesDirectory; |
|
| 17 | + /** |
|
| 18 | + * @var string |
|
| 19 | + */ |
|
| 20 | + private $filesDirectory; |
|
| 21 | 21 | |
| 22 | - protected function setUp() |
|
| 23 | - { |
|
| 24 | - $this->filesDirectory = \dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR; |
|
| 25 | - } |
|
| 22 | + protected function setUp() |
|
| 23 | + { |
|
| 24 | + $this->filesDirectory = \dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR; |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - public function testFail() |
|
| 28 | - { |
|
| 29 | - try { |
|
| 30 | - $this->fail(); |
|
| 31 | - } catch (AssertionFailedError $e) { |
|
| 32 | - return; |
|
| 33 | - } |
|
| 27 | + public function testFail() |
|
| 28 | + { |
|
| 29 | + try { |
|
| 30 | + $this->fail(); |
|
| 31 | + } catch (AssertionFailedError $e) { |
|
| 32 | + return; |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - throw new AssertionFailedError('Fail did not throw fail exception'); |
|
| 36 | - } |
|
| 35 | + throw new AssertionFailedError('Fail did not throw fail exception'); |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - public function testAssertSplObjectStorageContainsObject() |
|
| 39 | - { |
|
| 40 | - $a = new \stdClass; |
|
| 41 | - $b = new \stdClass; |
|
| 42 | - $c = new \SplObjectStorage; |
|
| 43 | - $c->attach($a); |
|
| 38 | + public function testAssertSplObjectStorageContainsObject() |
|
| 39 | + { |
|
| 40 | + $a = new \stdClass; |
|
| 41 | + $b = new \stdClass; |
|
| 42 | + $c = new \SplObjectStorage; |
|
| 43 | + $c->attach($a); |
|
| 44 | 44 | |
| 45 | - $this->assertContains($a, $c); |
|
| 45 | + $this->assertContains($a, $c); |
|
| 46 | 46 | |
| 47 | - $this->expectException(AssertionFailedError::class); |
|
| 47 | + $this->expectException(AssertionFailedError::class); |
|
| 48 | 48 | |
| 49 | - $this->assertContains($b, $c); |
|
| 50 | - } |
|
| 49 | + $this->assertContains($b, $c); |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - public function testAssertArrayContainsObject() |
|
| 53 | - { |
|
| 54 | - $a = new \stdClass; |
|
| 55 | - $b = new \stdClass; |
|
| 52 | + public function testAssertArrayContainsObject() |
|
| 53 | + { |
|
| 54 | + $a = new \stdClass; |
|
| 55 | + $b = new \stdClass; |
|
| 56 | 56 | |
| 57 | - $this->assertContains($a, [$a]); |
|
| 57 | + $this->assertContains($a, [$a]); |
|
| 58 | 58 | |
| 59 | - $this->expectException(AssertionFailedError::class); |
|
| 59 | + $this->expectException(AssertionFailedError::class); |
|
| 60 | 60 | |
| 61 | - $this->assertContains($a, [$b]); |
|
| 62 | - } |
|
| 61 | + $this->assertContains($a, [$b]); |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - public function testAssertArrayContainsString() |
|
| 65 | - { |
|
| 66 | - $this->assertContains('foo', ['foo']); |
|
| 64 | + public function testAssertArrayContainsString() |
|
| 65 | + { |
|
| 66 | + $this->assertContains('foo', ['foo']); |
|
| 67 | 67 | |
| 68 | - $this->expectException(AssertionFailedError::class); |
|
| 68 | + $this->expectException(AssertionFailedError::class); |
|
| 69 | 69 | |
| 70 | - $this->assertContains('foo', ['bar']); |
|
| 71 | - } |
|
| 70 | + $this->assertContains('foo', ['bar']); |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - public function testAssertArrayContainsNonObject() |
|
| 74 | - { |
|
| 75 | - $this->assertContains('foo', [true]); |
|
| 73 | + public function testAssertArrayContainsNonObject() |
|
| 74 | + { |
|
| 75 | + $this->assertContains('foo', [true]); |
|
| 76 | 76 | |
| 77 | - $this->expectException(AssertionFailedError::class); |
|
| 77 | + $this->expectException(AssertionFailedError::class); |
|
| 78 | 78 | |
| 79 | - $this->assertContains('foo', [true], '', false, true, true); |
|
| 80 | - } |
|
| 79 | + $this->assertContains('foo', [true], '', false, true, true); |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | - public function testAssertContainsOnlyInstancesOf() |
|
| 83 | - { |
|
| 84 | - $test = [new \Book, new \Book]; |
|
| 82 | + public function testAssertContainsOnlyInstancesOf() |
|
| 83 | + { |
|
| 84 | + $test = [new \Book, new \Book]; |
|
| 85 | 85 | |
| 86 | - $this->assertContainsOnlyInstancesOf(\Book::class, $test); |
|
| 87 | - $this->assertContainsOnlyInstancesOf(\stdClass::class, [new \stdClass()]); |
|
| 86 | + $this->assertContainsOnlyInstancesOf(\Book::class, $test); |
|
| 87 | + $this->assertContainsOnlyInstancesOf(\stdClass::class, [new \stdClass()]); |
|
| 88 | 88 | |
| 89 | - $test2 = [new \Author('Test')]; |
|
| 89 | + $test2 = [new \Author('Test')]; |
|
| 90 | 90 | |
| 91 | - $this->expectException(AssertionFailedError::class); |
|
| 91 | + $this->expectException(AssertionFailedError::class); |
|
| 92 | 92 | |
| 93 | - $this->assertContainsOnlyInstancesOf(\Book::class, $test2); |
|
| 94 | - } |
|
| 93 | + $this->assertContainsOnlyInstancesOf(\Book::class, $test2); |
|
| 94 | + } |
|
| 95 | 95 | |
| 96 | - public function testAssertContainsEmptyStringInString() |
|
| 97 | - { |
|
| 98 | - $this->assertContains('', 'test'); |
|
| 99 | - } |
|
| 96 | + public function testAssertContainsEmptyStringInString() |
|
| 97 | + { |
|
| 98 | + $this->assertContains('', 'test'); |
|
| 99 | + } |
|
| 100 | 100 | |
| 101 | - public function testAssertArrayHasKeyThrowsExceptionForInvalidFirstArgument() |
|
| 102 | - { |
|
| 103 | - $this->expectException(Exception::class); |
|
| 101 | + public function testAssertArrayHasKeyThrowsExceptionForInvalidFirstArgument() |
|
| 102 | + { |
|
| 103 | + $this->expectException(Exception::class); |
|
| 104 | 104 | |
| 105 | - $this->assertArrayHasKey(null, []); |
|
| 106 | - } |
|
| 105 | + $this->assertArrayHasKey(null, []); |
|
| 106 | + } |
|
| 107 | 107 | |
| 108 | - public function testAssertArrayHasKeyThrowsExceptionForInvalidSecondArgument() |
|
| 109 | - { |
|
| 110 | - $this->expectException(Exception::class); |
|
| 108 | + public function testAssertArrayHasKeyThrowsExceptionForInvalidSecondArgument() |
|
| 109 | + { |
|
| 110 | + $this->expectException(Exception::class); |
|
| 111 | 111 | |
| 112 | - $this->assertArrayHasKey(0, null); |
|
| 113 | - } |
|
| 112 | + $this->assertArrayHasKey(0, null); |
|
| 113 | + } |
|
| 114 | 114 | |
| 115 | - public function testAssertArrayHasIntegerKey() |
|
| 116 | - { |
|
| 117 | - $this->assertArrayHasKey(0, ['foo']); |
|
| 115 | + public function testAssertArrayHasIntegerKey() |
|
| 116 | + { |
|
| 117 | + $this->assertArrayHasKey(0, ['foo']); |
|
| 118 | 118 | |
| 119 | - $this->expectException(AssertionFailedError::class); |
|
| 119 | + $this->expectException(AssertionFailedError::class); |
|
| 120 | 120 | |
| 121 | - $this->assertArrayHasKey(1, ['foo']); |
|
| 122 | - } |
|
| 121 | + $this->assertArrayHasKey(1, ['foo']); |
|
| 122 | + } |
|
| 123 | 123 | |
| 124 | - public function testAssertArraySubset() |
|
| 125 | - { |
|
| 126 | - $array = [ |
|
| 127 | - 'a' => 'item a', |
|
| 128 | - 'b' => 'item b', |
|
| 129 | - 'c' => ['a2' => 'item a2', 'b2' => 'item b2'], |
|
| 130 | - 'd' => ['a2' => ['a3' => 'item a3', 'b3' => 'item b3']] |
|
| 131 | - ]; |
|
| 124 | + public function testAssertArraySubset() |
|
| 125 | + { |
|
| 126 | + $array = [ |
|
| 127 | + 'a' => 'item a', |
|
| 128 | + 'b' => 'item b', |
|
| 129 | + 'c' => ['a2' => 'item a2', 'b2' => 'item b2'], |
|
| 130 | + 'd' => ['a2' => ['a3' => 'item a3', 'b3' => 'item b3']] |
|
| 131 | + ]; |
|
| 132 | 132 | |
| 133 | - $this->assertArraySubset(['a' => 'item a', 'c' => ['a2' => 'item a2']], $array); |
|
| 134 | - $this->assertArraySubset(['a' => 'item a', 'd' => ['a2' => ['b3' => 'item b3']]], $array); |
|
| 133 | + $this->assertArraySubset(['a' => 'item a', 'c' => ['a2' => 'item a2']], $array); |
|
| 134 | + $this->assertArraySubset(['a' => 'item a', 'd' => ['a2' => ['b3' => 'item b3']]], $array); |
|
| 135 | 135 | |
| 136 | - $arrayAccessData = new \ArrayObject($array); |
|
| 136 | + $arrayAccessData = new \ArrayObject($array); |
|
| 137 | 137 | |
| 138 | - $this->assertArraySubset(['a' => 'item a', 'c' => ['a2' => 'item a2']], $arrayAccessData); |
|
| 139 | - $this->assertArraySubset(['a' => 'item a', 'd' => ['a2' => ['b3' => 'item b3']]], $arrayAccessData); |
|
| 138 | + $this->assertArraySubset(['a' => 'item a', 'c' => ['a2' => 'item a2']], $arrayAccessData); |
|
| 139 | + $this->assertArraySubset(['a' => 'item a', 'd' => ['a2' => ['b3' => 'item b3']]], $arrayAccessData); |
|
| 140 | 140 | |
| 141 | - try { |
|
| 142 | - $this->assertArraySubset(['a' => 'bad value'], $array); |
|
| 143 | - } catch (AssertionFailedError $e) { |
|
| 144 | - } |
|
| 141 | + try { |
|
| 142 | + $this->assertArraySubset(['a' => 'bad value'], $array); |
|
| 143 | + } catch (AssertionFailedError $e) { |
|
| 144 | + } |
|
| 145 | 145 | |
| 146 | - try { |
|
| 147 | - $this->assertArraySubset(['d' => ['a2' => ['bad index' => 'item b3']]], $array); |
|
| 148 | - } catch (AssertionFailedError $e) { |
|
| 149 | - return; |
|
| 150 | - } |
|
| 146 | + try { |
|
| 147 | + $this->assertArraySubset(['d' => ['a2' => ['bad index' => 'item b3']]], $array); |
|
| 148 | + } catch (AssertionFailedError $e) { |
|
| 149 | + return; |
|
| 150 | + } |
|
| 151 | 151 | |
| 152 | - $this->fail(); |
|
| 153 | - } |
|
| 152 | + $this->fail(); |
|
| 153 | + } |
|
| 154 | 154 | |
| 155 | - public function testAssertArraySubsetWithDeepNestedArrays() |
|
| 156 | - { |
|
| 157 | - $array = [ |
|
| 158 | - 'path' => [ |
|
| 159 | - 'to' => [ |
|
| 160 | - 'the' => [ |
|
| 161 | - 'cake' => 'is a lie' |
|
| 162 | - ] |
|
| 163 | - ] |
|
| 164 | - ] |
|
| 165 | - ]; |
|
| 155 | + public function testAssertArraySubsetWithDeepNestedArrays() |
|
| 156 | + { |
|
| 157 | + $array = [ |
|
| 158 | + 'path' => [ |
|
| 159 | + 'to' => [ |
|
| 160 | + 'the' => [ |
|
| 161 | + 'cake' => 'is a lie' |
|
| 162 | + ] |
|
| 163 | + ] |
|
| 164 | + ] |
|
| 165 | + ]; |
|
| 166 | 166 | |
| 167 | - $this->assertArraySubset(['path' => []], $array); |
|
| 168 | - $this->assertArraySubset(['path' => ['to' => []]], $array); |
|
| 169 | - $this->assertArraySubset(['path' => ['to' => ['the' => []]]], $array); |
|
| 170 | - $this->assertArraySubset(['path' => ['to' => ['the' => ['cake' => 'is a lie']]]], $array); |
|
| 167 | + $this->assertArraySubset(['path' => []], $array); |
|
| 168 | + $this->assertArraySubset(['path' => ['to' => []]], $array); |
|
| 169 | + $this->assertArraySubset(['path' => ['to' => ['the' => []]]], $array); |
|
| 170 | + $this->assertArraySubset(['path' => ['to' => ['the' => ['cake' => 'is a lie']]]], $array); |
|
| 171 | 171 | |
| 172 | - $this->expectException(AssertionFailedError::class); |
|
| 172 | + $this->expectException(AssertionFailedError::class); |
|
| 173 | 173 | |
| 174 | - $this->assertArraySubset(['path' => ['to' => ['the' => ['cake' => 'is not a lie']]]], $array); |
|
| 175 | - } |
|
| 174 | + $this->assertArraySubset(['path' => ['to' => ['the' => ['cake' => 'is not a lie']]]], $array); |
|
| 175 | + } |
|
| 176 | 176 | |
| 177 | - public function testAssertArraySubsetWithNoStrictCheckAndObjects() |
|
| 178 | - { |
|
| 179 | - $obj = new \stdClass; |
|
| 180 | - $reference = &$obj; |
|
| 181 | - $array = ['a' => $obj]; |
|
| 177 | + public function testAssertArraySubsetWithNoStrictCheckAndObjects() |
|
| 178 | + { |
|
| 179 | + $obj = new \stdClass; |
|
| 180 | + $reference = &$obj; |
|
| 181 | + $array = ['a' => $obj]; |
|
| 182 | 182 | |
| 183 | - $this->assertArraySubset(['a' => $reference], $array); |
|
| 184 | - $this->assertArraySubset(['a' => new \stdClass], $array); |
|
| 185 | - } |
|
| 183 | + $this->assertArraySubset(['a' => $reference], $array); |
|
| 184 | + $this->assertArraySubset(['a' => new \stdClass], $array); |
|
| 185 | + } |
|
| 186 | 186 | |
| 187 | - public function testAssertArraySubsetWithStrictCheckAndObjects() |
|
| 188 | - { |
|
| 189 | - $obj = new \stdClass; |
|
| 190 | - $reference = &$obj; |
|
| 191 | - $array = ['a' => $obj]; |
|
| 187 | + public function testAssertArraySubsetWithStrictCheckAndObjects() |
|
| 188 | + { |
|
| 189 | + $obj = new \stdClass; |
|
| 190 | + $reference = &$obj; |
|
| 191 | + $array = ['a' => $obj]; |
|
| 192 | 192 | |
| 193 | - $this->assertArraySubset(['a' => $reference], $array, true); |
|
| 193 | + $this->assertArraySubset(['a' => $reference], $array, true); |
|
| 194 | 194 | |
| 195 | - $this->expectException(AssertionFailedError::class); |
|
| 195 | + $this->expectException(AssertionFailedError::class); |
|
| 196 | 196 | |
| 197 | - $this->assertArraySubset(['a' => new \stdClass], $array, true); |
|
| 198 | - } |
|
| 197 | + $this->assertArraySubset(['a' => new \stdClass], $array, true); |
|
| 198 | + } |
|
| 199 | 199 | |
| 200 | - /** |
|
| 201 | - * @dataProvider assertArraySubsetInvalidArgumentProvider |
|
| 202 | - */ |
|
| 203 | - public function testAssertArraySubsetRaisesExceptionForInvalidArguments($partial, $subject) |
|
| 204 | - { |
|
| 205 | - $this->expectException(Exception::class); |
|
| 200 | + /** |
|
| 201 | + * @dataProvider assertArraySubsetInvalidArgumentProvider |
|
| 202 | + */ |
|
| 203 | + public function testAssertArraySubsetRaisesExceptionForInvalidArguments($partial, $subject) |
|
| 204 | + { |
|
| 205 | + $this->expectException(Exception::class); |
|
| 206 | 206 | |
| 207 | - $this->assertArraySubset($partial, $subject); |
|
| 208 | - } |
|
| 207 | + $this->assertArraySubset($partial, $subject); |
|
| 208 | + } |
|
| 209 | 209 | |
| 210 | - /** |
|
| 211 | - * @return array |
|
| 212 | - */ |
|
| 213 | - public function assertArraySubsetInvalidArgumentProvider() |
|
| 214 | - { |
|
| 215 | - return [ |
|
| 216 | - [false, []], |
|
| 217 | - [[], false], |
|
| 218 | - ]; |
|
| 219 | - } |
|
| 210 | + /** |
|
| 211 | + * @return array |
|
| 212 | + */ |
|
| 213 | + public function assertArraySubsetInvalidArgumentProvider() |
|
| 214 | + { |
|
| 215 | + return [ |
|
| 216 | + [false, []], |
|
| 217 | + [[], false], |
|
| 218 | + ]; |
|
| 219 | + } |
|
| 220 | 220 | |
| 221 | - public function testAssertArrayNotHasKeyThrowsExceptionForInvalidFirstArgument() |
|
| 222 | - { |
|
| 223 | - $this->expectException(Exception::class); |
|
| 221 | + public function testAssertArrayNotHasKeyThrowsExceptionForInvalidFirstArgument() |
|
| 222 | + { |
|
| 223 | + $this->expectException(Exception::class); |
|
| 224 | 224 | |
| 225 | - $this->assertArrayNotHasKey(null, []); |
|
| 226 | - } |
|
| 225 | + $this->assertArrayNotHasKey(null, []); |
|
| 226 | + } |
|
| 227 | 227 | |
| 228 | - public function testAssertArrayNotHasKeyThrowsExceptionForInvalidSecondArgument() |
|
| 229 | - { |
|
| 230 | - $this->expectException(Exception::class); |
|
| 228 | + public function testAssertArrayNotHasKeyThrowsExceptionForInvalidSecondArgument() |
|
| 229 | + { |
|
| 230 | + $this->expectException(Exception::class); |
|
| 231 | 231 | |
| 232 | - $this->assertArrayNotHasKey(0, null); |
|
| 233 | - } |
|
| 232 | + $this->assertArrayNotHasKey(0, null); |
|
| 233 | + } |
|
| 234 | 234 | |
| 235 | - public function testAssertArrayNotHasIntegerKey() |
|
| 236 | - { |
|
| 237 | - $this->assertArrayNotHasKey(1, ['foo']); |
|
| 235 | + public function testAssertArrayNotHasIntegerKey() |
|
| 236 | + { |
|
| 237 | + $this->assertArrayNotHasKey(1, ['foo']); |
|
| 238 | 238 | |
| 239 | - $this->expectException(AssertionFailedError::class); |
|
| 239 | + $this->expectException(AssertionFailedError::class); |
|
| 240 | 240 | |
| 241 | - $this->assertArrayNotHasKey(0, ['foo']); |
|
| 242 | - } |
|
| 241 | + $this->assertArrayNotHasKey(0, ['foo']); |
|
| 242 | + } |
|
| 243 | 243 | |
| 244 | - public function testAssertArrayHasStringKey() |
|
| 245 | - { |
|
| 246 | - $this->assertArrayHasKey('foo', ['foo' => 'bar']); |
|
| 244 | + public function testAssertArrayHasStringKey() |
|
| 245 | + { |
|
| 246 | + $this->assertArrayHasKey('foo', ['foo' => 'bar']); |
|
| 247 | 247 | |
| 248 | - $this->expectException(AssertionFailedError::class); |
|
| 248 | + $this->expectException(AssertionFailedError::class); |
|
| 249 | 249 | |
| 250 | - $this->assertArrayHasKey('bar', ['foo' => 'bar']); |
|
| 251 | - } |
|
| 250 | + $this->assertArrayHasKey('bar', ['foo' => 'bar']); |
|
| 251 | + } |
|
| 252 | 252 | |
| 253 | - public function testAssertArrayNotHasStringKey() |
|
| 254 | - { |
|
| 255 | - $this->assertArrayNotHasKey('bar', ['foo' => 'bar']); |
|
| 253 | + public function testAssertArrayNotHasStringKey() |
|
| 254 | + { |
|
| 255 | + $this->assertArrayNotHasKey('bar', ['foo' => 'bar']); |
|
| 256 | 256 | |
| 257 | - $this->expectException(AssertionFailedError::class); |
|
| 257 | + $this->expectException(AssertionFailedError::class); |
|
| 258 | 258 | |
| 259 | - $this->assertArrayNotHasKey('foo', ['foo' => 'bar']); |
|
| 260 | - } |
|
| 259 | + $this->assertArrayNotHasKey('foo', ['foo' => 'bar']); |
|
| 260 | + } |
|
| 261 | 261 | |
| 262 | - public function testAssertArrayHasKeyAcceptsArrayObjectValue() |
|
| 263 | - { |
|
| 264 | - $array = new \ArrayObject; |
|
| 265 | - $array['foo'] = 'bar'; |
|
| 262 | + public function testAssertArrayHasKeyAcceptsArrayObjectValue() |
|
| 263 | + { |
|
| 264 | + $array = new \ArrayObject; |
|
| 265 | + $array['foo'] = 'bar'; |
|
| 266 | 266 | |
| 267 | - $this->assertArrayHasKey('foo', $array); |
|
| 268 | - } |
|
| 267 | + $this->assertArrayHasKey('foo', $array); |
|
| 268 | + } |
|
| 269 | 269 | |
| 270 | - public function testAssertArrayHasKeyProperlyFailsWithArrayObjectValue() |
|
| 271 | - { |
|
| 272 | - $array = new \ArrayObject; |
|
| 273 | - $array['bar'] = 'bar'; |
|
| 270 | + public function testAssertArrayHasKeyProperlyFailsWithArrayObjectValue() |
|
| 271 | + { |
|
| 272 | + $array = new \ArrayObject; |
|
| 273 | + $array['bar'] = 'bar'; |
|
| 274 | 274 | |
| 275 | - $this->expectException(AssertionFailedError::class); |
|
| 275 | + $this->expectException(AssertionFailedError::class); |
|
| 276 | 276 | |
| 277 | - $this->assertArrayHasKey('foo', $array); |
|
| 278 | - } |
|
| 277 | + $this->assertArrayHasKey('foo', $array); |
|
| 278 | + } |
|
| 279 | 279 | |
| 280 | - public function testAssertArrayHasKeyAcceptsArrayAccessValue() |
|
| 281 | - { |
|
| 282 | - $array = new \SampleArrayAccess; |
|
| 283 | - $array['foo'] = 'bar'; |
|
| 280 | + public function testAssertArrayHasKeyAcceptsArrayAccessValue() |
|
| 281 | + { |
|
| 282 | + $array = new \SampleArrayAccess; |
|
| 283 | + $array['foo'] = 'bar'; |
|
| 284 | 284 | |
| 285 | - $this->assertArrayHasKey('foo', $array); |
|
| 286 | - } |
|
| 285 | + $this->assertArrayHasKey('foo', $array); |
|
| 286 | + } |
|
| 287 | 287 | |
| 288 | - public function testAssertArrayHasKeyProperlyFailsWithArrayAccessValue() |
|
| 289 | - { |
|
| 290 | - $array = new \SampleArrayAccess; |
|
| 291 | - $array['bar'] = 'bar'; |
|
| 288 | + public function testAssertArrayHasKeyProperlyFailsWithArrayAccessValue() |
|
| 289 | + { |
|
| 290 | + $array = new \SampleArrayAccess; |
|
| 291 | + $array['bar'] = 'bar'; |
|
| 292 | 292 | |
| 293 | - $this->expectException(AssertionFailedError::class); |
|
| 293 | + $this->expectException(AssertionFailedError::class); |
|
| 294 | 294 | |
| 295 | - $this->assertArrayHasKey('foo', $array); |
|
| 296 | - } |
|
| 295 | + $this->assertArrayHasKey('foo', $array); |
|
| 296 | + } |
|
| 297 | 297 | |
| 298 | - public function testAssertArrayNotHasKeyAcceptsArrayAccessValue() |
|
| 299 | - { |
|
| 300 | - $array = new \ArrayObject; |
|
| 301 | - $array['foo'] = 'bar'; |
|
| 298 | + public function testAssertArrayNotHasKeyAcceptsArrayAccessValue() |
|
| 299 | + { |
|
| 300 | + $array = new \ArrayObject; |
|
| 301 | + $array['foo'] = 'bar'; |
|
| 302 | 302 | |
| 303 | - $this->assertArrayNotHasKey('bar', $array); |
|
| 304 | - } |
|
| 303 | + $this->assertArrayNotHasKey('bar', $array); |
|
| 304 | + } |
|
| 305 | 305 | |
| 306 | - public function testAssertArrayNotHasKeyPropertlyFailsWithArrayAccessValue() |
|
| 307 | - { |
|
| 308 | - $array = new \ArrayObject; |
|
| 309 | - $array['bar'] = 'bar'; |
|
| 306 | + public function testAssertArrayNotHasKeyPropertlyFailsWithArrayAccessValue() |
|
| 307 | + { |
|
| 308 | + $array = new \ArrayObject; |
|
| 309 | + $array['bar'] = 'bar'; |
|
| 310 | 310 | |
| 311 | - $this->expectException(AssertionFailedError::class); |
|
| 311 | + $this->expectException(AssertionFailedError::class); |
|
| 312 | 312 | |
| 313 | - $this->assertArrayNotHasKey('bar', $array); |
|
| 314 | - } |
|
| 313 | + $this->assertArrayNotHasKey('bar', $array); |
|
| 314 | + } |
|
| 315 | 315 | |
| 316 | - public function testAssertContainsThrowsException() |
|
| 317 | - { |
|
| 318 | - $this->expectException(Exception::class); |
|
| 316 | + public function testAssertContainsThrowsException() |
|
| 317 | + { |
|
| 318 | + $this->expectException(Exception::class); |
|
| 319 | 319 | |
| 320 | - $this->assertContains(null, null); |
|
| 321 | - } |
|
| 320 | + $this->assertContains(null, null); |
|
| 321 | + } |
|
| 322 | 322 | |
| 323 | - public function testAssertIteratorContainsObject() |
|
| 324 | - { |
|
| 325 | - $foo = new \stdClass; |
|
| 323 | + public function testAssertIteratorContainsObject() |
|
| 324 | + { |
|
| 325 | + $foo = new \stdClass; |
|
| 326 | 326 | |
| 327 | - $this->assertContains($foo, new \TestIterator([$foo])); |
|
| 327 | + $this->assertContains($foo, new \TestIterator([$foo])); |
|
| 328 | 328 | |
| 329 | - $this->expectException(AssertionFailedError::class); |
|
| 329 | + $this->expectException(AssertionFailedError::class); |
|
| 330 | 330 | |
| 331 | - $this->assertContains($foo, new \TestIterator([new \stdClass])); |
|
| 332 | - } |
|
| 331 | + $this->assertContains($foo, new \TestIterator([new \stdClass])); |
|
| 332 | + } |
|
| 333 | 333 | |
| 334 | - public function testAssertIteratorContainsString() |
|
| 335 | - { |
|
| 336 | - $this->assertContains('foo', new \TestIterator(['foo'])); |
|
| 334 | + public function testAssertIteratorContainsString() |
|
| 335 | + { |
|
| 336 | + $this->assertContains('foo', new \TestIterator(['foo'])); |
|
| 337 | 337 | |
| 338 | - $this->expectException(AssertionFailedError::class); |
|
| 338 | + $this->expectException(AssertionFailedError::class); |
|
| 339 | 339 | |
| 340 | - $this->assertContains('foo', new \TestIterator(['bar'])); |
|
| 341 | - } |
|
| 340 | + $this->assertContains('foo', new \TestIterator(['bar'])); |
|
| 341 | + } |
|
| 342 | 342 | |
| 343 | - public function testAssertStringContainsString() |
|
| 344 | - { |
|
| 345 | - $this->assertContains('foo', 'foobar'); |
|
| 343 | + public function testAssertStringContainsString() |
|
| 344 | + { |
|
| 345 | + $this->assertContains('foo', 'foobar'); |
|
| 346 | 346 | |
| 347 | - $this->expectException(AssertionFailedError::class); |
|
| 347 | + $this->expectException(AssertionFailedError::class); |
|
| 348 | 348 | |
| 349 | - $this->assertContains('foo', 'bar'); |
|
| 350 | - } |
|
| 349 | + $this->assertContains('foo', 'bar'); |
|
| 350 | + } |
|
| 351 | 351 | |
| 352 | - public function testAssertStringContainsStringForUtf8() |
|
| 353 | - { |
|
| 354 | - $this->assertContains('oryginał', 'oryginał'); |
|
| 352 | + public function testAssertStringContainsStringForUtf8() |
|
| 353 | + { |
|
| 354 | + $this->assertContains('oryginał', 'oryginał'); |
|
| 355 | 355 | |
| 356 | - $this->expectException(AssertionFailedError::class); |
|
| 356 | + $this->expectException(AssertionFailedError::class); |
|
| 357 | 357 | |
| 358 | - $this->assertContains('ORYGINAŁ', 'oryginał'); |
|
| 359 | - } |
|
| 358 | + $this->assertContains('ORYGINAŁ', 'oryginał'); |
|
| 359 | + } |
|
| 360 | 360 | |
| 361 | - public function testAssertStringContainsStringForUtf8WhenIgnoreCase() |
|
| 362 | - { |
|
| 363 | - $this->assertContains('oryginał', 'oryginał', '', true); |
|
| 364 | - $this->assertContains('ORYGINAŁ', 'oryginał', '', true); |
|
| 361 | + public function testAssertStringContainsStringForUtf8WhenIgnoreCase() |
|
| 362 | + { |
|
| 363 | + $this->assertContains('oryginał', 'oryginał', '', true); |
|
| 364 | + $this->assertContains('ORYGINAŁ', 'oryginał', '', true); |
|
| 365 | 365 | |
| 366 | - $this->expectException(AssertionFailedError::class); |
|
| 366 | + $this->expectException(AssertionFailedError::class); |
|
| 367 | 367 | |
| 368 | - $this->assertContains('foo', 'oryginał', '', true); |
|
| 369 | - } |
|
| 368 | + $this->assertContains('foo', 'oryginał', '', true); |
|
| 369 | + } |
|
| 370 | 370 | |
| 371 | - public function testAssertNotContainsThrowsException() |
|
| 372 | - { |
|
| 373 | - $this->expectException(Exception::class); |
|
| 371 | + public function testAssertNotContainsThrowsException() |
|
| 372 | + { |
|
| 373 | + $this->expectException(Exception::class); |
|
| 374 | 374 | |
| 375 | - $this->assertNotContains(null, null); |
|
| 376 | - } |
|
| 375 | + $this->assertNotContains(null, null); |
|
| 376 | + } |
|
| 377 | 377 | |
| 378 | - public function testAssertSplObjectStorageNotContainsObject() |
|
| 379 | - { |
|
| 380 | - $a = new \stdClass; |
|
| 381 | - $b = new \stdClass; |
|
| 382 | - $c = new \SplObjectStorage; |
|
| 383 | - $c->attach($a); |
|
| 378 | + public function testAssertSplObjectStorageNotContainsObject() |
|
| 379 | + { |
|
| 380 | + $a = new \stdClass; |
|
| 381 | + $b = new \stdClass; |
|
| 382 | + $c = new \SplObjectStorage; |
|
| 383 | + $c->attach($a); |
|
| 384 | 384 | |
| 385 | - $this->assertNotContains($b, $c); |
|
| 385 | + $this->assertNotContains($b, $c); |
|
| 386 | 386 | |
| 387 | - $this->expectException(AssertionFailedError::class); |
|
| 387 | + $this->expectException(AssertionFailedError::class); |
|
| 388 | 388 | |
| 389 | - $this->assertNotContains($a, $c); |
|
| 390 | - } |
|
| 389 | + $this->assertNotContains($a, $c); |
|
| 390 | + } |
|
| 391 | 391 | |
| 392 | - public function testAssertArrayNotContainsObject() |
|
| 393 | - { |
|
| 394 | - $a = new \stdClass; |
|
| 395 | - $b = new \stdClass; |
|
| 392 | + public function testAssertArrayNotContainsObject() |
|
| 393 | + { |
|
| 394 | + $a = new \stdClass; |
|
| 395 | + $b = new \stdClass; |
|
| 396 | 396 | |
| 397 | - $this->assertNotContains($a, [$b]); |
|
| 397 | + $this->assertNotContains($a, [$b]); |
|
| 398 | 398 | |
| 399 | - $this->expectException(AssertionFailedError::class); |
|
| 399 | + $this->expectException(AssertionFailedError::class); |
|
| 400 | 400 | |
| 401 | - $this->assertNotContains($a, [$a]); |
|
| 402 | - } |
|
| 401 | + $this->assertNotContains($a, [$a]); |
|
| 402 | + } |
|
| 403 | 403 | |
| 404 | - public function testAssertArrayNotContainsString() |
|
| 405 | - { |
|
| 406 | - $this->assertNotContains('foo', ['bar']); |
|
| 404 | + public function testAssertArrayNotContainsString() |
|
| 405 | + { |
|
| 406 | + $this->assertNotContains('foo', ['bar']); |
|
| 407 | 407 | |
| 408 | - $this->expectException(AssertionFailedError::class); |
|
| 408 | + $this->expectException(AssertionFailedError::class); |
|
| 409 | 409 | |
| 410 | - $this->assertNotContains('foo', ['foo']); |
|
| 411 | - } |
|
| 410 | + $this->assertNotContains('foo', ['foo']); |
|
| 411 | + } |
|
| 412 | 412 | |
| 413 | - public function testAssertArrayNotContainsNonObject() |
|
| 414 | - { |
|
| 415 | - $this->assertNotContains('foo', [true], '', false, true, true); |
|
| 413 | + public function testAssertArrayNotContainsNonObject() |
|
| 414 | + { |
|
| 415 | + $this->assertNotContains('foo', [true], '', false, true, true); |
|
| 416 | 416 | |
| 417 | - $this->expectException(AssertionFailedError::class); |
|
| 417 | + $this->expectException(AssertionFailedError::class); |
|
| 418 | 418 | |
| 419 | - $this->assertNotContains('foo', [true]); |
|
| 420 | - } |
|
| 419 | + $this->assertNotContains('foo', [true]); |
|
| 420 | + } |
|
| 421 | 421 | |
| 422 | - public function testAssertStringNotContainsString() |
|
| 423 | - { |
|
| 424 | - $this->assertNotContains('foo', 'bar'); |
|
| 422 | + public function testAssertStringNotContainsString() |
|
| 423 | + { |
|
| 424 | + $this->assertNotContains('foo', 'bar'); |
|
| 425 | 425 | |
| 426 | - $this->expectException(AssertionFailedError::class); |
|
| 426 | + $this->expectException(AssertionFailedError::class); |
|
| 427 | 427 | |
| 428 | - $this->assertNotContains('foo', 'foo'); |
|
| 429 | - } |
|
| 428 | + $this->assertNotContains('foo', 'foo'); |
|
| 429 | + } |
|
| 430 | 430 | |
| 431 | - public function testAssertStringNotContainsStringForUtf8() |
|
| 432 | - { |
|
| 433 | - $this->assertNotContains('ORYGINAŁ', 'oryginał'); |
|
| 431 | + public function testAssertStringNotContainsStringForUtf8() |
|
| 432 | + { |
|
| 433 | + $this->assertNotContains('ORYGINAŁ', 'oryginał'); |
|
| 434 | 434 | |
| 435 | - $this->expectException(AssertionFailedError::class); |
|
| 435 | + $this->expectException(AssertionFailedError::class); |
|
| 436 | 436 | |
| 437 | - $this->assertNotContains('oryginał', 'oryginał'); |
|
| 438 | - } |
|
| 437 | + $this->assertNotContains('oryginał', 'oryginał'); |
|
| 438 | + } |
|
| 439 | 439 | |
| 440 | - public function testAssertStringNotContainsStringForUtf8WhenIgnoreCase() |
|
| 441 | - { |
|
| 442 | - $this->expectException(AssertionFailedError::class); |
|
| 440 | + public function testAssertStringNotContainsStringForUtf8WhenIgnoreCase() |
|
| 441 | + { |
|
| 442 | + $this->expectException(AssertionFailedError::class); |
|
| 443 | 443 | |
| 444 | - $this->assertNotContains('ORYGINAŁ', 'oryginał', '', true); |
|
| 445 | - } |
|
| 444 | + $this->assertNotContains('ORYGINAŁ', 'oryginał', '', true); |
|
| 445 | + } |
|
| 446 | 446 | |
| 447 | - public function testAssertContainsOnlyThrowsException() |
|
| 448 | - { |
|
| 449 | - $this->expectException(Exception::class); |
|
| 447 | + public function testAssertContainsOnlyThrowsException() |
|
| 448 | + { |
|
| 449 | + $this->expectException(Exception::class); |
|
| 450 | 450 | |
| 451 | - $this->assertContainsOnly(null, null); |
|
| 452 | - } |
|
| 451 | + $this->assertContainsOnly(null, null); |
|
| 452 | + } |
|
| 453 | 453 | |
| 454 | - public function testAssertNotContainsOnlyThrowsException() |
|
| 455 | - { |
|
| 456 | - $this->expectException(Exception::class); |
|
| 454 | + public function testAssertNotContainsOnlyThrowsException() |
|
| 455 | + { |
|
| 456 | + $this->expectException(Exception::class); |
|
| 457 | 457 | |
| 458 | - $this->assertNotContainsOnly(null, null); |
|
| 459 | - } |
|
| 458 | + $this->assertNotContainsOnly(null, null); |
|
| 459 | + } |
|
| 460 | 460 | |
| 461 | - public function testAssertContainsOnlyInstancesOfThrowsException() |
|
| 462 | - { |
|
| 463 | - $this->expectException(Exception::class); |
|
| 461 | + public function testAssertContainsOnlyInstancesOfThrowsException() |
|
| 462 | + { |
|
| 463 | + $this->expectException(Exception::class); |
|
| 464 | 464 | |
| 465 | - $this->assertContainsOnlyInstancesOf(null, null); |
|
| 466 | - } |
|
| 465 | + $this->assertContainsOnlyInstancesOf(null, null); |
|
| 466 | + } |
|
| 467 | 467 | |
| 468 | - public function testAssertArrayContainsOnlyIntegers() |
|
| 469 | - { |
|
| 470 | - $this->assertContainsOnly('integer', [1, 2, 3]); |
|
| 471 | - |
|
| 472 | - $this->expectException(AssertionFailedError::class); |
|
| 473 | - |
|
| 474 | - $this->assertContainsOnly('integer', ['1', 2, 3]); |
|
| 475 | - } |
|
| 476 | - |
|
| 477 | - public function testAssertArrayNotContainsOnlyIntegers() |
|
| 478 | - { |
|
| 479 | - $this->assertNotContainsOnly('integer', ['1', 2, 3]); |
|
| 480 | - |
|
| 481 | - $this->expectException(AssertionFailedError::class); |
|
| 482 | - |
|
| 483 | - $this->assertNotContainsOnly('integer', [1, 2, 3]); |
|
| 484 | - } |
|
| 485 | - |
|
| 486 | - public function testAssertArrayContainsOnlyStdClass() |
|
| 487 | - { |
|
| 488 | - $this->assertContainsOnly('StdClass', [new \stdClass]); |
|
| 489 | - |
|
| 490 | - $this->expectException(AssertionFailedError::class); |
|
| 491 | - |
|
| 492 | - $this->assertContainsOnly('StdClass', ['StdClass']); |
|
| 493 | - } |
|
| 494 | - |
|
| 495 | - public function testAssertArrayNotContainsOnlyStdClass() |
|
| 496 | - { |
|
| 497 | - $this->assertNotContainsOnly('StdClass', ['StdClass']); |
|
| 498 | - |
|
| 499 | - $this->expectException(AssertionFailedError::class); |
|
| 500 | - |
|
| 501 | - $this->assertNotContainsOnly('StdClass', [new \stdClass]); |
|
| 502 | - } |
|
| 503 | - |
|
| 504 | - protected function sameValues() |
|
| 505 | - { |
|
| 506 | - $object = new \SampleClass(4, 8, 15); |
|
| 507 | - // cannot use $filesDirectory, because neither setUp() nor |
|
| 508 | - // setUpBeforeClass() are executed before the data providers |
|
| 509 | - $file = \dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'foo.xml'; |
|
| 510 | - $resource = \fopen($file, 'r'); |
|
| 511 | - |
|
| 512 | - return [ |
|
| 513 | - // null |
|
| 514 | - [null, null], |
|
| 515 | - // strings |
|
| 516 | - ['a', 'a'], |
|
| 517 | - // integers |
|
| 518 | - [0, 0], |
|
| 519 | - // floats |
|
| 520 | - [2.3, 2.3], |
|
| 521 | - [1 / 3, 1 - 2 / 3], |
|
| 522 | - [\log(0), \log(0)], |
|
| 523 | - // arrays |
|
| 524 | - [[], []], |
|
| 525 | - [[0 => 1], [0 => 1]], |
|
| 526 | - [[0 => null], [0 => null]], |
|
| 527 | - [['a', 'b' => [1, 2]], ['a', 'b' => [1, 2]]], |
|
| 528 | - // objects |
|
| 529 | - [$object, $object], |
|
| 530 | - // resources |
|
| 531 | - [$resource, $resource], |
|
| 532 | - ]; |
|
| 533 | - } |
|
| 534 | - |
|
| 535 | - protected function notEqualValues() |
|
| 536 | - { |
|
| 537 | - // cyclic dependencies |
|
| 538 | - $book1 = new \Book; |
|
| 539 | - $book1->author = new \Author('Terry Pratchett'); |
|
| 540 | - $book1->author->books[] = $book1; |
|
| 541 | - $book2 = new \Book; |
|
| 542 | - $book2->author = new \Author('Terry Pratch'); |
|
| 543 | - $book2->author->books[] = $book2; |
|
| 544 | - |
|
| 545 | - $book3 = new \Book; |
|
| 546 | - $book3->author = 'Terry Pratchett'; |
|
| 547 | - $book4 = new \stdClass; |
|
| 548 | - $book4->author = 'Terry Pratchett'; |
|
| 549 | - |
|
| 550 | - $object1 = new \SampleClass(4, 8, 15); |
|
| 551 | - $object2 = new \SampleClass(16, 23, 42); |
|
| 552 | - $object3 = new \SampleClass(4, 8, 15); |
|
| 553 | - $storage1 = new \SplObjectStorage; |
|
| 554 | - $storage1->attach($object1); |
|
| 555 | - $storage2 = new \SplObjectStorage; |
|
| 556 | - $storage2->attach($object3); // same content, different object |
|
| 557 | - |
|
| 558 | - // cannot use $filesDirectory, because neither setUp() nor |
|
| 559 | - // setUpBeforeClass() are executed before the data providers |
|
| 560 | - $file = \dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'foo.xml'; |
|
| 561 | - |
|
| 562 | - return [ |
|
| 563 | - // strings |
|
| 564 | - ['a', 'b'], |
|
| 565 | - ['a', 'A'], |
|
| 566 | - // https://github.com/sebastianbergmann/phpunit/issues/1023 |
|
| 567 | - ['9E6666666','9E7777777'], |
|
| 568 | - // integers |
|
| 569 | - [1, 2], |
|
| 570 | - [2, 1], |
|
| 571 | - // floats |
|
| 572 | - [2.3, 4.2], |
|
| 573 | - [2.3, 4.2, 0.5], |
|
| 574 | - [[2.3], [4.2], 0.5], |
|
| 575 | - [[[2.3]], [[4.2]], 0.5], |
|
| 576 | - [new \Struct(2.3), new \Struct(4.2), 0.5], |
|
| 577 | - [[new \Struct(2.3)], [new \Struct(4.2)], 0.5], |
|
| 578 | - // NAN |
|
| 579 | - [NAN, NAN], |
|
| 580 | - // arrays |
|
| 581 | - [[], [0 => 1]], |
|
| 582 | - [[0 => 1], []], |
|
| 583 | - [[0 => null], []], |
|
| 584 | - [[0 => 1, 1 => 2], [0 => 1, 1 => 3]], |
|
| 585 | - [['a', 'b' => [1, 2]], ['a', 'b' => [2, 1]]], |
|
| 586 | - // objects |
|
| 587 | - [new \SampleClass(4, 8, 15), new \SampleClass(16, 23, 42)], |
|
| 588 | - [$object1, $object2], |
|
| 589 | - [$book1, $book2], |
|
| 590 | - [$book3, $book4], // same content, different class |
|
| 591 | - // resources |
|
| 592 | - [\fopen($file, 'r'), \fopen($file, 'r')], |
|
| 593 | - // SplObjectStorage |
|
| 594 | - [$storage1, $storage2], |
|
| 595 | - // DOMDocument |
|
| 596 | - [ |
|
| 597 | - Xml::load('<root></root>'), |
|
| 598 | - Xml::load('<bar/>'), |
|
| 599 | - ], |
|
| 600 | - [ |
|
| 601 | - Xml::load('<foo attr1="bar"/>'), |
|
| 602 | - Xml::load('<foo attr1="foobar"/>'), |
|
| 603 | - ], |
|
| 604 | - [ |
|
| 605 | - Xml::load('<foo> bar </foo>'), |
|
| 606 | - Xml::load('<foo />'), |
|
| 607 | - ], |
|
| 608 | - [ |
|
| 609 | - Xml::load('<foo xmlns="urn:myns:bar"/>'), |
|
| 610 | - Xml::load('<foo xmlns="urn:notmyns:bar"/>'), |
|
| 611 | - ], |
|
| 612 | - [ |
|
| 613 | - Xml::load('<foo> bar </foo>'), |
|
| 614 | - Xml::load('<foo> bir </foo>'), |
|
| 615 | - ], |
|
| 616 | - [ |
|
| 617 | - new \DateTime('2013-03-29 04:13:35', new \DateTimeZone('America/New_York')), |
|
| 618 | - new \DateTime('2013-03-29 03:13:35', new \DateTimeZone('America/New_York')), |
|
| 619 | - ], |
|
| 620 | - [ |
|
| 621 | - new \DateTime('2013-03-29 04:13:35', new \DateTimeZone('America/New_York')), |
|
| 622 | - new \DateTime('2013-03-29 03:13:35', new \DateTimeZone('America/New_York')), |
|
| 623 | - 3500 |
|
| 624 | - ], |
|
| 625 | - [ |
|
| 626 | - new \DateTime('2013-03-29 04:13:35', new \DateTimeZone('America/New_York')), |
|
| 627 | - new \DateTime('2013-03-29 05:13:35', new \DateTimeZone('America/New_York')), |
|
| 628 | - 3500 |
|
| 629 | - ], |
|
| 630 | - [ |
|
| 631 | - new \DateTime('2013-03-29', new \DateTimeZone('America/New_York')), |
|
| 632 | - new \DateTime('2013-03-30', new \DateTimeZone('America/New_York')), |
|
| 633 | - ], |
|
| 634 | - [ |
|
| 635 | - new \DateTime('2013-03-29', new \DateTimeZone('America/New_York')), |
|
| 636 | - new \DateTime('2013-03-30', new \DateTimeZone('America/New_York')), |
|
| 637 | - 43200 |
|
| 638 | - ], |
|
| 639 | - [ |
|
| 640 | - new \DateTime('2013-03-29 04:13:35', new \DateTimeZone('America/New_York')), |
|
| 641 | - new \DateTime('2013-03-29 04:13:35', new \DateTimeZone('America/Chicago')), |
|
| 642 | - ], |
|
| 643 | - [ |
|
| 644 | - new \DateTime('2013-03-29 04:13:35', new \DateTimeZone('America/New_York')), |
|
| 645 | - new \DateTime('2013-03-29 04:13:35', new \DateTimeZone('America/Chicago')), |
|
| 646 | - 3500 |
|
| 647 | - ], |
|
| 648 | - [ |
|
| 649 | - new \DateTime('2013-03-30', new \DateTimeZone('America/New_York')), |
|
| 650 | - new \DateTime('2013-03-30', new \DateTimeZone('America/Chicago')), |
|
| 651 | - ], |
|
| 652 | - [ |
|
| 653 | - new \DateTime('2013-03-29T05:13:35-0600'), |
|
| 654 | - new \DateTime('2013-03-29T04:13:35-0600'), |
|
| 655 | - ], |
|
| 656 | - [ |
|
| 657 | - new \DateTime('2013-03-29T05:13:35-0600'), |
|
| 658 | - new \DateTime('2013-03-29T05:13:35-0500'), |
|
| 659 | - ], |
|
| 660 | - // Exception |
|
| 661 | - //array(new Exception('Exception 1'), new Exception('Exception 2')), |
|
| 662 | - // different types |
|
| 663 | - [new \SampleClass(4, 8, 15), false], |
|
| 664 | - [false, new \SampleClass(4, 8, 15)], |
|
| 665 | - [[0 => 1, 1 => 2], false], |
|
| 666 | - [false, [0 => 1, 1 => 2]], |
|
| 667 | - [[], new \stdClass], |
|
| 668 | - [new \stdClass, []], |
|
| 669 | - // PHP: 0 == 'Foobar' => true! |
|
| 670 | - // We want these values to differ |
|
| 671 | - [0, 'Foobar'], |
|
| 672 | - ['Foobar', 0], |
|
| 673 | - [3, \acos(8)], |
|
| 674 | - [\acos(8), 3] |
|
| 675 | - ]; |
|
| 676 | - } |
|
| 677 | - |
|
| 678 | - protected function equalValues() |
|
| 679 | - { |
|
| 680 | - // cyclic dependencies |
|
| 681 | - $book1 = new \Book; |
|
| 682 | - $book1->author = new \Author('Terry Pratchett'); |
|
| 683 | - $book1->author->books[] = $book1; |
|
| 684 | - $book2 = new \Book; |
|
| 685 | - $book2->author = new \Author('Terry Pratchett'); |
|
| 686 | - $book2->author->books[] = $book2; |
|
| 687 | - |
|
| 688 | - $object1 = new \SampleClass(4, 8, 15); |
|
| 689 | - $object2 = new \SampleClass(4, 8, 15); |
|
| 690 | - $storage1 = new \SplObjectStorage; |
|
| 691 | - $storage1->attach($object1); |
|
| 692 | - $storage2 = new \SplObjectStorage; |
|
| 693 | - $storage2->attach($object1); |
|
| 694 | - |
|
| 695 | - return [ |
|
| 696 | - // strings |
|
| 697 | - ['a', 'A', 0, false, true], // ignore case |
|
| 698 | - // arrays |
|
| 699 | - [['a' => 1, 'b' => 2], ['b' => 2, 'a' => 1]], |
|
| 700 | - [[1], ['1']], |
|
| 701 | - [[3, 2, 1], [2, 3, 1], 0, true], // canonicalized comparison |
|
| 702 | - // floats |
|
| 703 | - [2.3, 2.5, 0.5], |
|
| 704 | - [[2.3], [2.5], 0.5], |
|
| 705 | - [[[2.3]], [[2.5]], 0.5], |
|
| 706 | - [new \Struct(2.3), new \Struct(2.5), 0.5], |
|
| 707 | - [[new \Struct(2.3)], [new \Struct(2.5)], 0.5], |
|
| 708 | - // numeric with delta |
|
| 709 | - [1, 2, 1], |
|
| 710 | - // objects |
|
| 711 | - [$object1, $object2], |
|
| 712 | - [$book1, $book2], |
|
| 713 | - // SplObjectStorage |
|
| 714 | - [$storage1, $storage2], |
|
| 715 | - // DOMDocument |
|
| 716 | - [ |
|
| 717 | - Xml::load('<root></root>'), |
|
| 718 | - Xml::load('<root/>'), |
|
| 719 | - ], |
|
| 720 | - [ |
|
| 721 | - Xml::load('<root attr="bar"></root>'), |
|
| 722 | - Xml::load('<root attr="bar"/>'), |
|
| 723 | - ], |
|
| 724 | - [ |
|
| 725 | - Xml::load('<root><foo attr="bar"></foo></root>'), |
|
| 726 | - Xml::load('<root><foo attr="bar"/></root>'), |
|
| 727 | - ], |
|
| 728 | - [ |
|
| 729 | - Xml::load("<root>\n <child/>\n</root>"), |
|
| 730 | - Xml::load('<root><child/></root>'), |
|
| 731 | - ], |
|
| 732 | - [ |
|
| 733 | - new \DateTime('2013-03-29 04:13:35', new \DateTimeZone('America/New_York')), |
|
| 734 | - new \DateTime('2013-03-29 04:13:35', new \DateTimeZone('America/New_York')), |
|
| 735 | - ], |
|
| 736 | - [ |
|
| 737 | - new \DateTime('2013-03-29 04:13:35', new \DateTimeZone('America/New_York')), |
|
| 738 | - new \DateTime('2013-03-29 04:13:25', new \DateTimeZone('America/New_York')), |
|
| 739 | - 10 |
|
| 740 | - ], |
|
| 741 | - [ |
|
| 742 | - new \DateTime('2013-03-29 04:13:35', new \DateTimeZone('America/New_York')), |
|
| 743 | - new \DateTime('2013-03-29 04:14:40', new \DateTimeZone('America/New_York')), |
|
| 744 | - 65 |
|
| 745 | - ], |
|
| 746 | - [ |
|
| 747 | - new \DateTime('2013-03-29', new \DateTimeZone('America/New_York')), |
|
| 748 | - new \DateTime('2013-03-29', new \DateTimeZone('America/New_York')), |
|
| 749 | - ], |
|
| 750 | - [ |
|
| 751 | - new \DateTime('2013-03-29 04:13:35', new \DateTimeZone('America/New_York')), |
|
| 752 | - new \DateTime('2013-03-29 03:13:35', new \DateTimeZone('America/Chicago')), |
|
| 753 | - ], |
|
| 754 | - [ |
|
| 755 | - new \DateTime('2013-03-29 04:13:35', new \DateTimeZone('America/New_York')), |
|
| 756 | - new \DateTime('2013-03-29 03:13:49', new \DateTimeZone('America/Chicago')), |
|
| 757 | - 15 |
|
| 758 | - ], |
|
| 759 | - [ |
|
| 760 | - new \DateTime('2013-03-30', new \DateTimeZone('America/New_York')), |
|
| 761 | - new \DateTime('2013-03-29 23:00:00', new \DateTimeZone('America/Chicago')), |
|
| 762 | - ], |
|
| 763 | - [ |
|
| 764 | - new \DateTime('2013-03-30', new \DateTimeZone('America/New_York')), |
|
| 765 | - new \DateTime('2013-03-29 23:01:30', new \DateTimeZone('America/Chicago')), |
|
| 766 | - 100 |
|
| 767 | - ], |
|
| 768 | - [ |
|
| 769 | - new \DateTime('@1364616000'), |
|
| 770 | - new \DateTime('2013-03-29 23:00:00', new \DateTimeZone('America/Chicago')), |
|
| 771 | - ], |
|
| 772 | - [ |
|
| 773 | - new \DateTime('2013-03-29T05:13:35-0500'), |
|
| 774 | - new \DateTime('2013-03-29T04:13:35-0600'), |
|
| 775 | - ], |
|
| 776 | - // Exception |
|
| 777 | - //array(new Exception('Exception 1'), new Exception('Exception 1')), |
|
| 778 | - // mixed types |
|
| 779 | - [0, '0'], |
|
| 780 | - ['0', 0], |
|
| 781 | - [2.3, '2.3'], |
|
| 782 | - ['2.3', 2.3], |
|
| 783 | - [(string) (1 / 3), 1 - 2 / 3], |
|
| 784 | - [1 / 3, (string) (1 - 2 / 3)], |
|
| 785 | - ['string representation', new \ClassWithToString], |
|
| 786 | - [new \ClassWithToString, 'string representation'], |
|
| 787 | - ]; |
|
| 788 | - } |
|
| 789 | - |
|
| 790 | - public function equalProvider() |
|
| 791 | - { |
|
| 792 | - // same |= equal |
|
| 793 | - return \array_merge($this->equalValues(), $this->sameValues()); |
|
| 794 | - } |
|
| 795 | - |
|
| 796 | - public function notEqualProvider() |
|
| 797 | - { |
|
| 798 | - return $this->notEqualValues(); |
|
| 799 | - } |
|
| 800 | - |
|
| 801 | - public function sameProvider() |
|
| 802 | - { |
|
| 803 | - return $this->sameValues(); |
|
| 804 | - } |
|
| 805 | - |
|
| 806 | - public function notSameProvider() |
|
| 807 | - { |
|
| 808 | - // not equal |= not same |
|
| 809 | - // equal, ¬same |= not same |
|
| 810 | - return \array_merge($this->notEqualValues(), $this->equalValues()); |
|
| 811 | - } |
|
| 812 | - |
|
| 813 | - /** |
|
| 814 | - * @dataProvider equalProvider |
|
| 815 | - */ |
|
| 816 | - public function testAssertEqualsSucceeds($a, $b, $delta = 0.0, $canonicalize = false, $ignoreCase = false) |
|
| 817 | - { |
|
| 818 | - $this->assertEquals($a, $b, '', $delta, 10, $canonicalize, $ignoreCase); |
|
| 819 | - } |
|
| 820 | - |
|
| 821 | - /** |
|
| 822 | - * @dataProvider notEqualProvider |
|
| 823 | - */ |
|
| 824 | - public function testAssertEqualsFails($a, $b, $delta = 0.0, $canonicalize = false, $ignoreCase = false) |
|
| 825 | - { |
|
| 826 | - $this->expectException(AssertionFailedError::class); |
|
| 827 | - |
|
| 828 | - $this->assertEquals($a, $b, '', $delta, 10, $canonicalize, $ignoreCase); |
|
| 829 | - } |
|
| 830 | - |
|
| 831 | - /** |
|
| 832 | - * @dataProvider notEqualProvider |
|
| 833 | - */ |
|
| 834 | - public function testAssertNotEqualsSucceeds($a, $b, $delta = 0.0, $canonicalize = false, $ignoreCase = false) |
|
| 835 | - { |
|
| 836 | - $this->assertNotEquals($a, $b, '', $delta, 10, $canonicalize, $ignoreCase); |
|
| 837 | - } |
|
| 838 | - |
|
| 839 | - /** |
|
| 840 | - * @dataProvider equalProvider |
|
| 841 | - */ |
|
| 842 | - public function testAssertNotEqualsFails($a, $b, $delta = 0.0, $canonicalize = false, $ignoreCase = false) |
|
| 843 | - { |
|
| 844 | - $this->expectException(AssertionFailedError::class); |
|
| 845 | - |
|
| 846 | - $this->assertNotEquals($a, $b, '', $delta, 10, $canonicalize, $ignoreCase); |
|
| 847 | - } |
|
| 848 | - |
|
| 849 | - /** |
|
| 850 | - * @dataProvider sameProvider |
|
| 851 | - */ |
|
| 852 | - public function testAssertSameSucceeds($a, $b) |
|
| 853 | - { |
|
| 854 | - $this->assertSame($a, $b); |
|
| 855 | - } |
|
| 856 | - |
|
| 857 | - /** |
|
| 858 | - * @dataProvider notSameProvider |
|
| 859 | - */ |
|
| 860 | - public function testAssertSameFails($a, $b) |
|
| 861 | - { |
|
| 862 | - $this->expectException(AssertionFailedError::class); |
|
| 863 | - |
|
| 864 | - $this->assertSame($a, $b); |
|
| 865 | - } |
|
| 866 | - |
|
| 867 | - /** |
|
| 868 | - * @dataProvider notSameProvider |
|
| 869 | - */ |
|
| 870 | - public function testAssertNotSameSucceeds($a, $b) |
|
| 871 | - { |
|
| 872 | - $this->assertNotSame($a, $b); |
|
| 873 | - } |
|
| 874 | - |
|
| 875 | - /** |
|
| 876 | - * @dataProvider sameProvider |
|
| 877 | - */ |
|
| 878 | - public function testAssertNotSameFails($a, $b) |
|
| 879 | - { |
|
| 880 | - $this->expectException(AssertionFailedError::class); |
|
| 881 | - |
|
| 882 | - $this->assertNotSame($a, $b); |
|
| 883 | - } |
|
| 884 | - |
|
| 885 | - public function testAssertXmlFileEqualsXmlFile() |
|
| 886 | - { |
|
| 887 | - $this->assertXmlFileEqualsXmlFile( |
|
| 888 | - $this->filesDirectory . 'foo.xml', |
|
| 889 | - $this->filesDirectory . 'foo.xml' |
|
| 890 | - ); |
|
| 891 | - |
|
| 892 | - $this->expectException(AssertionFailedError::class); |
|
| 893 | - |
|
| 894 | - $this->assertXmlFileEqualsXmlFile( |
|
| 895 | - $this->filesDirectory . 'foo.xml', |
|
| 896 | - $this->filesDirectory . 'bar.xml' |
|
| 897 | - ); |
|
| 898 | - } |
|
| 899 | - |
|
| 900 | - public function testAssertXmlFileNotEqualsXmlFile() |
|
| 901 | - { |
|
| 902 | - $this->assertXmlFileNotEqualsXmlFile( |
|
| 903 | - $this->filesDirectory . 'foo.xml', |
|
| 904 | - $this->filesDirectory . 'bar.xml' |
|
| 905 | - ); |
|
| 906 | - |
|
| 907 | - $this->expectException(AssertionFailedError::class); |
|
| 908 | - |
|
| 909 | - $this->assertXmlFileNotEqualsXmlFile( |
|
| 910 | - $this->filesDirectory . 'foo.xml', |
|
| 911 | - $this->filesDirectory . 'foo.xml' |
|
| 912 | - ); |
|
| 913 | - } |
|
| 914 | - |
|
| 915 | - public function testAssertXmlStringEqualsXmlFile() |
|
| 916 | - { |
|
| 917 | - $this->assertXmlStringEqualsXmlFile( |
|
| 918 | - $this->filesDirectory . 'foo.xml', |
|
| 919 | - \file_get_contents($this->filesDirectory . 'foo.xml') |
|
| 920 | - ); |
|
| 921 | - |
|
| 922 | - $this->expectException(AssertionFailedError::class); |
|
| 923 | - |
|
| 924 | - $this->assertXmlStringEqualsXmlFile( |
|
| 925 | - $this->filesDirectory . 'foo.xml', |
|
| 926 | - \file_get_contents($this->filesDirectory . 'bar.xml') |
|
| 927 | - ); |
|
| 928 | - } |
|
| 929 | - |
|
| 930 | - public function testXmlStringNotEqualsXmlFile() |
|
| 931 | - { |
|
| 932 | - $this->assertXmlStringNotEqualsXmlFile( |
|
| 933 | - $this->filesDirectory . 'foo.xml', |
|
| 934 | - \file_get_contents($this->filesDirectory . 'bar.xml') |
|
| 935 | - ); |
|
| 936 | - |
|
| 937 | - $this->expectException(AssertionFailedError::class); |
|
| 938 | - |
|
| 939 | - $this->assertXmlStringNotEqualsXmlFile( |
|
| 940 | - $this->filesDirectory . 'foo.xml', |
|
| 941 | - \file_get_contents($this->filesDirectory . 'foo.xml') |
|
| 942 | - ); |
|
| 943 | - } |
|
| 944 | - |
|
| 945 | - public function testAssertXmlStringEqualsXmlString() |
|
| 946 | - { |
|
| 947 | - $this->assertXmlStringEqualsXmlString('<root/>', '<root/>'); |
|
| 948 | - |
|
| 949 | - $this->expectException(AssertionFailedError::class); |
|
| 950 | - |
|
| 951 | - $this->assertXmlStringEqualsXmlString('<foo/>', '<bar/>'); |
|
| 952 | - } |
|
| 953 | - |
|
| 954 | - /** |
|
| 955 | - * @ticket 1860 |
|
| 956 | - */ |
|
| 957 | - public function testAssertXmlStringEqualsXmlString2() |
|
| 958 | - { |
|
| 959 | - $this->expectException(Exception::class); |
|
| 960 | - |
|
| 961 | - $this->assertXmlStringEqualsXmlString('<a></b>', '<c></d>'); |
|
| 962 | - } |
|
| 963 | - |
|
| 964 | - /** |
|
| 965 | - * @ticket 1860 |
|
| 966 | - */ |
|
| 967 | - public function testAssertXmlStringEqualsXmlString3() |
|
| 968 | - { |
|
| 969 | - $expected = <<<XML |
|
| 468 | + public function testAssertArrayContainsOnlyIntegers() |
|
| 469 | + { |
|
| 470 | + $this->assertContainsOnly('integer', [1, 2, 3]); |
|
| 471 | + |
|
| 472 | + $this->expectException(AssertionFailedError::class); |
|
| 473 | + |
|
| 474 | + $this->assertContainsOnly('integer', ['1', 2, 3]); |
|
| 475 | + } |
|
| 476 | + |
|
| 477 | + public function testAssertArrayNotContainsOnlyIntegers() |
|
| 478 | + { |
|
| 479 | + $this->assertNotContainsOnly('integer', ['1', 2, 3]); |
|
| 480 | + |
|
| 481 | + $this->expectException(AssertionFailedError::class); |
|
| 482 | + |
|
| 483 | + $this->assertNotContainsOnly('integer', [1, 2, 3]); |
|
| 484 | + } |
|
| 485 | + |
|
| 486 | + public function testAssertArrayContainsOnlyStdClass() |
|
| 487 | + { |
|
| 488 | + $this->assertContainsOnly('StdClass', [new \stdClass]); |
|
| 489 | + |
|
| 490 | + $this->expectException(AssertionFailedError::class); |
|
| 491 | + |
|
| 492 | + $this->assertContainsOnly('StdClass', ['StdClass']); |
|
| 493 | + } |
|
| 494 | + |
|
| 495 | + public function testAssertArrayNotContainsOnlyStdClass() |
|
| 496 | + { |
|
| 497 | + $this->assertNotContainsOnly('StdClass', ['StdClass']); |
|
| 498 | + |
|
| 499 | + $this->expectException(AssertionFailedError::class); |
|
| 500 | + |
|
| 501 | + $this->assertNotContainsOnly('StdClass', [new \stdClass]); |
|
| 502 | + } |
|
| 503 | + |
|
| 504 | + protected function sameValues() |
|
| 505 | + { |
|
| 506 | + $object = new \SampleClass(4, 8, 15); |
|
| 507 | + // cannot use $filesDirectory, because neither setUp() nor |
|
| 508 | + // setUpBeforeClass() are executed before the data providers |
|
| 509 | + $file = \dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'foo.xml'; |
|
| 510 | + $resource = \fopen($file, 'r'); |
|
| 511 | + |
|
| 512 | + return [ |
|
| 513 | + // null |
|
| 514 | + [null, null], |
|
| 515 | + // strings |
|
| 516 | + ['a', 'a'], |
|
| 517 | + // integers |
|
| 518 | + [0, 0], |
|
| 519 | + // floats |
|
| 520 | + [2.3, 2.3], |
|
| 521 | + [1 / 3, 1 - 2 / 3], |
|
| 522 | + [\log(0), \log(0)], |
|
| 523 | + // arrays |
|
| 524 | + [[], []], |
|
| 525 | + [[0 => 1], [0 => 1]], |
|
| 526 | + [[0 => null], [0 => null]], |
|
| 527 | + [['a', 'b' => [1, 2]], ['a', 'b' => [1, 2]]], |
|
| 528 | + // objects |
|
| 529 | + [$object, $object], |
|
| 530 | + // resources |
|
| 531 | + [$resource, $resource], |
|
| 532 | + ]; |
|
| 533 | + } |
|
| 534 | + |
|
| 535 | + protected function notEqualValues() |
|
| 536 | + { |
|
| 537 | + // cyclic dependencies |
|
| 538 | + $book1 = new \Book; |
|
| 539 | + $book1->author = new \Author('Terry Pratchett'); |
|
| 540 | + $book1->author->books[] = $book1; |
|
| 541 | + $book2 = new \Book; |
|
| 542 | + $book2->author = new \Author('Terry Pratch'); |
|
| 543 | + $book2->author->books[] = $book2; |
|
| 544 | + |
|
| 545 | + $book3 = new \Book; |
|
| 546 | + $book3->author = 'Terry Pratchett'; |
|
| 547 | + $book4 = new \stdClass; |
|
| 548 | + $book4->author = 'Terry Pratchett'; |
|
| 549 | + |
|
| 550 | + $object1 = new \SampleClass(4, 8, 15); |
|
| 551 | + $object2 = new \SampleClass(16, 23, 42); |
|
| 552 | + $object3 = new \SampleClass(4, 8, 15); |
|
| 553 | + $storage1 = new \SplObjectStorage; |
|
| 554 | + $storage1->attach($object1); |
|
| 555 | + $storage2 = new \SplObjectStorage; |
|
| 556 | + $storage2->attach($object3); // same content, different object |
|
| 557 | + |
|
| 558 | + // cannot use $filesDirectory, because neither setUp() nor |
|
| 559 | + // setUpBeforeClass() are executed before the data providers |
|
| 560 | + $file = \dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'foo.xml'; |
|
| 561 | + |
|
| 562 | + return [ |
|
| 563 | + // strings |
|
| 564 | + ['a', 'b'], |
|
| 565 | + ['a', 'A'], |
|
| 566 | + // https://github.com/sebastianbergmann/phpunit/issues/1023 |
|
| 567 | + ['9E6666666','9E7777777'], |
|
| 568 | + // integers |
|
| 569 | + [1, 2], |
|
| 570 | + [2, 1], |
|
| 571 | + // floats |
|
| 572 | + [2.3, 4.2], |
|
| 573 | + [2.3, 4.2, 0.5], |
|
| 574 | + [[2.3], [4.2], 0.5], |
|
| 575 | + [[[2.3]], [[4.2]], 0.5], |
|
| 576 | + [new \Struct(2.3), new \Struct(4.2), 0.5], |
|
| 577 | + [[new \Struct(2.3)], [new \Struct(4.2)], 0.5], |
|
| 578 | + // NAN |
|
| 579 | + [NAN, NAN], |
|
| 580 | + // arrays |
|
| 581 | + [[], [0 => 1]], |
|
| 582 | + [[0 => 1], []], |
|
| 583 | + [[0 => null], []], |
|
| 584 | + [[0 => 1, 1 => 2], [0 => 1, 1 => 3]], |
|
| 585 | + [['a', 'b' => [1, 2]], ['a', 'b' => [2, 1]]], |
|
| 586 | + // objects |
|
| 587 | + [new \SampleClass(4, 8, 15), new \SampleClass(16, 23, 42)], |
|
| 588 | + [$object1, $object2], |
|
| 589 | + [$book1, $book2], |
|
| 590 | + [$book3, $book4], // same content, different class |
|
| 591 | + // resources |
|
| 592 | + [\fopen($file, 'r'), \fopen($file, 'r')], |
|
| 593 | + // SplObjectStorage |
|
| 594 | + [$storage1, $storage2], |
|
| 595 | + // DOMDocument |
|
| 596 | + [ |
|
| 597 | + Xml::load('<root></root>'), |
|
| 598 | + Xml::load('<bar/>'), |
|
| 599 | + ], |
|
| 600 | + [ |
|
| 601 | + Xml::load('<foo attr1="bar"/>'), |
|
| 602 | + Xml::load('<foo attr1="foobar"/>'), |
|
| 603 | + ], |
|
| 604 | + [ |
|
| 605 | + Xml::load('<foo> bar </foo>'), |
|
| 606 | + Xml::load('<foo />'), |
|
| 607 | + ], |
|
| 608 | + [ |
|
| 609 | + Xml::load('<foo xmlns="urn:myns:bar"/>'), |
|
| 610 | + Xml::load('<foo xmlns="urn:notmyns:bar"/>'), |
|
| 611 | + ], |
|
| 612 | + [ |
|
| 613 | + Xml::load('<foo> bar </foo>'), |
|
| 614 | + Xml::load('<foo> bir </foo>'), |
|
| 615 | + ], |
|
| 616 | + [ |
|
| 617 | + new \DateTime('2013-03-29 04:13:35', new \DateTimeZone('America/New_York')), |
|
| 618 | + new \DateTime('2013-03-29 03:13:35', new \DateTimeZone('America/New_York')), |
|
| 619 | + ], |
|
| 620 | + [ |
|
| 621 | + new \DateTime('2013-03-29 04:13:35', new \DateTimeZone('America/New_York')), |
|
| 622 | + new \DateTime('2013-03-29 03:13:35', new \DateTimeZone('America/New_York')), |
|
| 623 | + 3500 |
|
| 624 | + ], |
|
| 625 | + [ |
|
| 626 | + new \DateTime('2013-03-29 04:13:35', new \DateTimeZone('America/New_York')), |
|
| 627 | + new \DateTime('2013-03-29 05:13:35', new \DateTimeZone('America/New_York')), |
|
| 628 | + 3500 |
|
| 629 | + ], |
|
| 630 | + [ |
|
| 631 | + new \DateTime('2013-03-29', new \DateTimeZone('America/New_York')), |
|
| 632 | + new \DateTime('2013-03-30', new \DateTimeZone('America/New_York')), |
|
| 633 | + ], |
|
| 634 | + [ |
|
| 635 | + new \DateTime('2013-03-29', new \DateTimeZone('America/New_York')), |
|
| 636 | + new \DateTime('2013-03-30', new \DateTimeZone('America/New_York')), |
|
| 637 | + 43200 |
|
| 638 | + ], |
|
| 639 | + [ |
|
| 640 | + new \DateTime('2013-03-29 04:13:35', new \DateTimeZone('America/New_York')), |
|
| 641 | + new \DateTime('2013-03-29 04:13:35', new \DateTimeZone('America/Chicago')), |
|
| 642 | + ], |
|
| 643 | + [ |
|
| 644 | + new \DateTime('2013-03-29 04:13:35', new \DateTimeZone('America/New_York')), |
|
| 645 | + new \DateTime('2013-03-29 04:13:35', new \DateTimeZone('America/Chicago')), |
|
| 646 | + 3500 |
|
| 647 | + ], |
|
| 648 | + [ |
|
| 649 | + new \DateTime('2013-03-30', new \DateTimeZone('America/New_York')), |
|
| 650 | + new \DateTime('2013-03-30', new \DateTimeZone('America/Chicago')), |
|
| 651 | + ], |
|
| 652 | + [ |
|
| 653 | + new \DateTime('2013-03-29T05:13:35-0600'), |
|
| 654 | + new \DateTime('2013-03-29T04:13:35-0600'), |
|
| 655 | + ], |
|
| 656 | + [ |
|
| 657 | + new \DateTime('2013-03-29T05:13:35-0600'), |
|
| 658 | + new \DateTime('2013-03-29T05:13:35-0500'), |
|
| 659 | + ], |
|
| 660 | + // Exception |
|
| 661 | + //array(new Exception('Exception 1'), new Exception('Exception 2')), |
|
| 662 | + // different types |
|
| 663 | + [new \SampleClass(4, 8, 15), false], |
|
| 664 | + [false, new \SampleClass(4, 8, 15)], |
|
| 665 | + [[0 => 1, 1 => 2], false], |
|
| 666 | + [false, [0 => 1, 1 => 2]], |
|
| 667 | + [[], new \stdClass], |
|
| 668 | + [new \stdClass, []], |
|
| 669 | + // PHP: 0 == 'Foobar' => true! |
|
| 670 | + // We want these values to differ |
|
| 671 | + [0, 'Foobar'], |
|
| 672 | + ['Foobar', 0], |
|
| 673 | + [3, \acos(8)], |
|
| 674 | + [\acos(8), 3] |
|
| 675 | + ]; |
|
| 676 | + } |
|
| 677 | + |
|
| 678 | + protected function equalValues() |
|
| 679 | + { |
|
| 680 | + // cyclic dependencies |
|
| 681 | + $book1 = new \Book; |
|
| 682 | + $book1->author = new \Author('Terry Pratchett'); |
|
| 683 | + $book1->author->books[] = $book1; |
|
| 684 | + $book2 = new \Book; |
|
| 685 | + $book2->author = new \Author('Terry Pratchett'); |
|
| 686 | + $book2->author->books[] = $book2; |
|
| 687 | + |
|
| 688 | + $object1 = new \SampleClass(4, 8, 15); |
|
| 689 | + $object2 = new \SampleClass(4, 8, 15); |
|
| 690 | + $storage1 = new \SplObjectStorage; |
|
| 691 | + $storage1->attach($object1); |
|
| 692 | + $storage2 = new \SplObjectStorage; |
|
| 693 | + $storage2->attach($object1); |
|
| 694 | + |
|
| 695 | + return [ |
|
| 696 | + // strings |
|
| 697 | + ['a', 'A', 0, false, true], // ignore case |
|
| 698 | + // arrays |
|
| 699 | + [['a' => 1, 'b' => 2], ['b' => 2, 'a' => 1]], |
|
| 700 | + [[1], ['1']], |
|
| 701 | + [[3, 2, 1], [2, 3, 1], 0, true], // canonicalized comparison |
|
| 702 | + // floats |
|
| 703 | + [2.3, 2.5, 0.5], |
|
| 704 | + [[2.3], [2.5], 0.5], |
|
| 705 | + [[[2.3]], [[2.5]], 0.5], |
|
| 706 | + [new \Struct(2.3), new \Struct(2.5), 0.5], |
|
| 707 | + [[new \Struct(2.3)], [new \Struct(2.5)], 0.5], |
|
| 708 | + // numeric with delta |
|
| 709 | + [1, 2, 1], |
|
| 710 | + // objects |
|
| 711 | + [$object1, $object2], |
|
| 712 | + [$book1, $book2], |
|
| 713 | + // SplObjectStorage |
|
| 714 | + [$storage1, $storage2], |
|
| 715 | + // DOMDocument |
|
| 716 | + [ |
|
| 717 | + Xml::load('<root></root>'), |
|
| 718 | + Xml::load('<root/>'), |
|
| 719 | + ], |
|
| 720 | + [ |
|
| 721 | + Xml::load('<root attr="bar"></root>'), |
|
| 722 | + Xml::load('<root attr="bar"/>'), |
|
| 723 | + ], |
|
| 724 | + [ |
|
| 725 | + Xml::load('<root><foo attr="bar"></foo></root>'), |
|
| 726 | + Xml::load('<root><foo attr="bar"/></root>'), |
|
| 727 | + ], |
|
| 728 | + [ |
|
| 729 | + Xml::load("<root>\n <child/>\n</root>"), |
|
| 730 | + Xml::load('<root><child/></root>'), |
|
| 731 | + ], |
|
| 732 | + [ |
|
| 733 | + new \DateTime('2013-03-29 04:13:35', new \DateTimeZone('America/New_York')), |
|
| 734 | + new \DateTime('2013-03-29 04:13:35', new \DateTimeZone('America/New_York')), |
|
| 735 | + ], |
|
| 736 | + [ |
|
| 737 | + new \DateTime('2013-03-29 04:13:35', new \DateTimeZone('America/New_York')), |
|
| 738 | + new \DateTime('2013-03-29 04:13:25', new \DateTimeZone('America/New_York')), |
|
| 739 | + 10 |
|
| 740 | + ], |
|
| 741 | + [ |
|
| 742 | + new \DateTime('2013-03-29 04:13:35', new \DateTimeZone('America/New_York')), |
|
| 743 | + new \DateTime('2013-03-29 04:14:40', new \DateTimeZone('America/New_York')), |
|
| 744 | + 65 |
|
| 745 | + ], |
|
| 746 | + [ |
|
| 747 | + new \DateTime('2013-03-29', new \DateTimeZone('America/New_York')), |
|
| 748 | + new \DateTime('2013-03-29', new \DateTimeZone('America/New_York')), |
|
| 749 | + ], |
|
| 750 | + [ |
|
| 751 | + new \DateTime('2013-03-29 04:13:35', new \DateTimeZone('America/New_York')), |
|
| 752 | + new \DateTime('2013-03-29 03:13:35', new \DateTimeZone('America/Chicago')), |
|
| 753 | + ], |
|
| 754 | + [ |
|
| 755 | + new \DateTime('2013-03-29 04:13:35', new \DateTimeZone('America/New_York')), |
|
| 756 | + new \DateTime('2013-03-29 03:13:49', new \DateTimeZone('America/Chicago')), |
|
| 757 | + 15 |
|
| 758 | + ], |
|
| 759 | + [ |
|
| 760 | + new \DateTime('2013-03-30', new \DateTimeZone('America/New_York')), |
|
| 761 | + new \DateTime('2013-03-29 23:00:00', new \DateTimeZone('America/Chicago')), |
|
| 762 | + ], |
|
| 763 | + [ |
|
| 764 | + new \DateTime('2013-03-30', new \DateTimeZone('America/New_York')), |
|
| 765 | + new \DateTime('2013-03-29 23:01:30', new \DateTimeZone('America/Chicago')), |
|
| 766 | + 100 |
|
| 767 | + ], |
|
| 768 | + [ |
|
| 769 | + new \DateTime('@1364616000'), |
|
| 770 | + new \DateTime('2013-03-29 23:00:00', new \DateTimeZone('America/Chicago')), |
|
| 771 | + ], |
|
| 772 | + [ |
|
| 773 | + new \DateTime('2013-03-29T05:13:35-0500'), |
|
| 774 | + new \DateTime('2013-03-29T04:13:35-0600'), |
|
| 775 | + ], |
|
| 776 | + // Exception |
|
| 777 | + //array(new Exception('Exception 1'), new Exception('Exception 1')), |
|
| 778 | + // mixed types |
|
| 779 | + [0, '0'], |
|
| 780 | + ['0', 0], |
|
| 781 | + [2.3, '2.3'], |
|
| 782 | + ['2.3', 2.3], |
|
| 783 | + [(string) (1 / 3), 1 - 2 / 3], |
|
| 784 | + [1 / 3, (string) (1 - 2 / 3)], |
|
| 785 | + ['string representation', new \ClassWithToString], |
|
| 786 | + [new \ClassWithToString, 'string representation'], |
|
| 787 | + ]; |
|
| 788 | + } |
|
| 789 | + |
|
| 790 | + public function equalProvider() |
|
| 791 | + { |
|
| 792 | + // same |= equal |
|
| 793 | + return \array_merge($this->equalValues(), $this->sameValues()); |
|
| 794 | + } |
|
| 795 | + |
|
| 796 | + public function notEqualProvider() |
|
| 797 | + { |
|
| 798 | + return $this->notEqualValues(); |
|
| 799 | + } |
|
| 800 | + |
|
| 801 | + public function sameProvider() |
|
| 802 | + { |
|
| 803 | + return $this->sameValues(); |
|
| 804 | + } |
|
| 805 | + |
|
| 806 | + public function notSameProvider() |
|
| 807 | + { |
|
| 808 | + // not equal |= not same |
|
| 809 | + // equal, ¬same |= not same |
|
| 810 | + return \array_merge($this->notEqualValues(), $this->equalValues()); |
|
| 811 | + } |
|
| 812 | + |
|
| 813 | + /** |
|
| 814 | + * @dataProvider equalProvider |
|
| 815 | + */ |
|
| 816 | + public function testAssertEqualsSucceeds($a, $b, $delta = 0.0, $canonicalize = false, $ignoreCase = false) |
|
| 817 | + { |
|
| 818 | + $this->assertEquals($a, $b, '', $delta, 10, $canonicalize, $ignoreCase); |
|
| 819 | + } |
|
| 820 | + |
|
| 821 | + /** |
|
| 822 | + * @dataProvider notEqualProvider |
|
| 823 | + */ |
|
| 824 | + public function testAssertEqualsFails($a, $b, $delta = 0.0, $canonicalize = false, $ignoreCase = false) |
|
| 825 | + { |
|
| 826 | + $this->expectException(AssertionFailedError::class); |
|
| 827 | + |
|
| 828 | + $this->assertEquals($a, $b, '', $delta, 10, $canonicalize, $ignoreCase); |
|
| 829 | + } |
|
| 830 | + |
|
| 831 | + /** |
|
| 832 | + * @dataProvider notEqualProvider |
|
| 833 | + */ |
|
| 834 | + public function testAssertNotEqualsSucceeds($a, $b, $delta = 0.0, $canonicalize = false, $ignoreCase = false) |
|
| 835 | + { |
|
| 836 | + $this->assertNotEquals($a, $b, '', $delta, 10, $canonicalize, $ignoreCase); |
|
| 837 | + } |
|
| 838 | + |
|
| 839 | + /** |
|
| 840 | + * @dataProvider equalProvider |
|
| 841 | + */ |
|
| 842 | + public function testAssertNotEqualsFails($a, $b, $delta = 0.0, $canonicalize = false, $ignoreCase = false) |
|
| 843 | + { |
|
| 844 | + $this->expectException(AssertionFailedError::class); |
|
| 845 | + |
|
| 846 | + $this->assertNotEquals($a, $b, '', $delta, 10, $canonicalize, $ignoreCase); |
|
| 847 | + } |
|
| 848 | + |
|
| 849 | + /** |
|
| 850 | + * @dataProvider sameProvider |
|
| 851 | + */ |
|
| 852 | + public function testAssertSameSucceeds($a, $b) |
|
| 853 | + { |
|
| 854 | + $this->assertSame($a, $b); |
|
| 855 | + } |
|
| 856 | + |
|
| 857 | + /** |
|
| 858 | + * @dataProvider notSameProvider |
|
| 859 | + */ |
|
| 860 | + public function testAssertSameFails($a, $b) |
|
| 861 | + { |
|
| 862 | + $this->expectException(AssertionFailedError::class); |
|
| 863 | + |
|
| 864 | + $this->assertSame($a, $b); |
|
| 865 | + } |
|
| 866 | + |
|
| 867 | + /** |
|
| 868 | + * @dataProvider notSameProvider |
|
| 869 | + */ |
|
| 870 | + public function testAssertNotSameSucceeds($a, $b) |
|
| 871 | + { |
|
| 872 | + $this->assertNotSame($a, $b); |
|
| 873 | + } |
|
| 874 | + |
|
| 875 | + /** |
|
| 876 | + * @dataProvider sameProvider |
|
| 877 | + */ |
|
| 878 | + public function testAssertNotSameFails($a, $b) |
|
| 879 | + { |
|
| 880 | + $this->expectException(AssertionFailedError::class); |
|
| 881 | + |
|
| 882 | + $this->assertNotSame($a, $b); |
|
| 883 | + } |
|
| 884 | + |
|
| 885 | + public function testAssertXmlFileEqualsXmlFile() |
|
| 886 | + { |
|
| 887 | + $this->assertXmlFileEqualsXmlFile( |
|
| 888 | + $this->filesDirectory . 'foo.xml', |
|
| 889 | + $this->filesDirectory . 'foo.xml' |
|
| 890 | + ); |
|
| 891 | + |
|
| 892 | + $this->expectException(AssertionFailedError::class); |
|
| 893 | + |
|
| 894 | + $this->assertXmlFileEqualsXmlFile( |
|
| 895 | + $this->filesDirectory . 'foo.xml', |
|
| 896 | + $this->filesDirectory . 'bar.xml' |
|
| 897 | + ); |
|
| 898 | + } |
|
| 899 | + |
|
| 900 | + public function testAssertXmlFileNotEqualsXmlFile() |
|
| 901 | + { |
|
| 902 | + $this->assertXmlFileNotEqualsXmlFile( |
|
| 903 | + $this->filesDirectory . 'foo.xml', |
|
| 904 | + $this->filesDirectory . 'bar.xml' |
|
| 905 | + ); |
|
| 906 | + |
|
| 907 | + $this->expectException(AssertionFailedError::class); |
|
| 908 | + |
|
| 909 | + $this->assertXmlFileNotEqualsXmlFile( |
|
| 910 | + $this->filesDirectory . 'foo.xml', |
|
| 911 | + $this->filesDirectory . 'foo.xml' |
|
| 912 | + ); |
|
| 913 | + } |
|
| 914 | + |
|
| 915 | + public function testAssertXmlStringEqualsXmlFile() |
|
| 916 | + { |
|
| 917 | + $this->assertXmlStringEqualsXmlFile( |
|
| 918 | + $this->filesDirectory . 'foo.xml', |
|
| 919 | + \file_get_contents($this->filesDirectory . 'foo.xml') |
|
| 920 | + ); |
|
| 921 | + |
|
| 922 | + $this->expectException(AssertionFailedError::class); |
|
| 923 | + |
|
| 924 | + $this->assertXmlStringEqualsXmlFile( |
|
| 925 | + $this->filesDirectory . 'foo.xml', |
|
| 926 | + \file_get_contents($this->filesDirectory . 'bar.xml') |
|
| 927 | + ); |
|
| 928 | + } |
|
| 929 | + |
|
| 930 | + public function testXmlStringNotEqualsXmlFile() |
|
| 931 | + { |
|
| 932 | + $this->assertXmlStringNotEqualsXmlFile( |
|
| 933 | + $this->filesDirectory . 'foo.xml', |
|
| 934 | + \file_get_contents($this->filesDirectory . 'bar.xml') |
|
| 935 | + ); |
|
| 936 | + |
|
| 937 | + $this->expectException(AssertionFailedError::class); |
|
| 938 | + |
|
| 939 | + $this->assertXmlStringNotEqualsXmlFile( |
|
| 940 | + $this->filesDirectory . 'foo.xml', |
|
| 941 | + \file_get_contents($this->filesDirectory . 'foo.xml') |
|
| 942 | + ); |
|
| 943 | + } |
|
| 944 | + |
|
| 945 | + public function testAssertXmlStringEqualsXmlString() |
|
| 946 | + { |
|
| 947 | + $this->assertXmlStringEqualsXmlString('<root/>', '<root/>'); |
|
| 948 | + |
|
| 949 | + $this->expectException(AssertionFailedError::class); |
|
| 950 | + |
|
| 951 | + $this->assertXmlStringEqualsXmlString('<foo/>', '<bar/>'); |
|
| 952 | + } |
|
| 953 | + |
|
| 954 | + /** |
|
| 955 | + * @ticket 1860 |
|
| 956 | + */ |
|
| 957 | + public function testAssertXmlStringEqualsXmlString2() |
|
| 958 | + { |
|
| 959 | + $this->expectException(Exception::class); |
|
| 960 | + |
|
| 961 | + $this->assertXmlStringEqualsXmlString('<a></b>', '<c></d>'); |
|
| 962 | + } |
|
| 963 | + |
|
| 964 | + /** |
|
| 965 | + * @ticket 1860 |
|
| 966 | + */ |
|
| 967 | + public function testAssertXmlStringEqualsXmlString3() |
|
| 968 | + { |
|
| 969 | + $expected = <<<XML |
|
| 970 | 970 | <?xml version="1.0"?> |
| 971 | 971 | <root> |
| 972 | 972 | <node /> |
| 973 | 973 | </root> |
| 974 | 974 | XML; |
| 975 | 975 | |
| 976 | - $actual = <<<XML |
|
| 976 | + $actual = <<<XML |
|
| 977 | 977 | <?xml version="1.0"?> |
| 978 | 978 | <root> |
| 979 | 979 | <node /> |
| 980 | 980 | </root> |
| 981 | 981 | XML; |
| 982 | 982 | |
| 983 | - $this->assertXmlStringEqualsXmlString($expected, $actual); |
|
| 984 | - } |
|
| 985 | - |
|
| 986 | - public function testAssertXmlStringNotEqualsXmlString() |
|
| 987 | - { |
|
| 988 | - $this->assertXmlStringNotEqualsXmlString('<foo/>', '<bar/>'); |
|
| 989 | - |
|
| 990 | - $this->expectException(AssertionFailedError::class); |
|
| 991 | - |
|
| 992 | - $this->assertXmlStringNotEqualsXmlString('<root/>', '<root/>'); |
|
| 993 | - } |
|
| 994 | - |
|
| 995 | - public function testXMLStructureIsSame() |
|
| 996 | - { |
|
| 997 | - $expected = new \DOMDocument; |
|
| 998 | - $expected->load($this->filesDirectory . 'structureExpected.xml'); |
|
| 999 | - |
|
| 1000 | - $actual = new \DOMDocument; |
|
| 1001 | - $actual->load($this->filesDirectory . 'structureExpected.xml'); |
|
| 1002 | - |
|
| 1003 | - $this->assertEqualXMLStructure( |
|
| 1004 | - $expected->firstChild, |
|
| 1005 | - $actual->firstChild, |
|
| 1006 | - true |
|
| 1007 | - ); |
|
| 1008 | - } |
|
| 1009 | - |
|
| 1010 | - public function testXMLStructureWrongNumberOfAttributes() |
|
| 1011 | - { |
|
| 1012 | - $expected = new \DOMDocument; |
|
| 1013 | - $expected->load($this->filesDirectory . 'structureExpected.xml'); |
|
| 1014 | - |
|
| 1015 | - $actual = new \DOMDocument; |
|
| 1016 | - $actual->load($this->filesDirectory . 'structureWrongNumberOfAttributes.xml'); |
|
| 1017 | - |
|
| 1018 | - $this->expectException(ExpectationFailedException::class); |
|
| 983 | + $this->assertXmlStringEqualsXmlString($expected, $actual); |
|
| 984 | + } |
|
| 985 | + |
|
| 986 | + public function testAssertXmlStringNotEqualsXmlString() |
|
| 987 | + { |
|
| 988 | + $this->assertXmlStringNotEqualsXmlString('<foo/>', '<bar/>'); |
|
| 989 | + |
|
| 990 | + $this->expectException(AssertionFailedError::class); |
|
| 991 | + |
|
| 992 | + $this->assertXmlStringNotEqualsXmlString('<root/>', '<root/>'); |
|
| 993 | + } |
|
| 994 | + |
|
| 995 | + public function testXMLStructureIsSame() |
|
| 996 | + { |
|
| 997 | + $expected = new \DOMDocument; |
|
| 998 | + $expected->load($this->filesDirectory . 'structureExpected.xml'); |
|
| 999 | + |
|
| 1000 | + $actual = new \DOMDocument; |
|
| 1001 | + $actual->load($this->filesDirectory . 'structureExpected.xml'); |
|
| 1002 | + |
|
| 1003 | + $this->assertEqualXMLStructure( |
|
| 1004 | + $expected->firstChild, |
|
| 1005 | + $actual->firstChild, |
|
| 1006 | + true |
|
| 1007 | + ); |
|
| 1008 | + } |
|
| 1009 | + |
|
| 1010 | + public function testXMLStructureWrongNumberOfAttributes() |
|
| 1011 | + { |
|
| 1012 | + $expected = new \DOMDocument; |
|
| 1013 | + $expected->load($this->filesDirectory . 'structureExpected.xml'); |
|
| 1014 | + |
|
| 1015 | + $actual = new \DOMDocument; |
|
| 1016 | + $actual->load($this->filesDirectory . 'structureWrongNumberOfAttributes.xml'); |
|
| 1017 | + |
|
| 1018 | + $this->expectException(ExpectationFailedException::class); |
|
| 1019 | 1019 | |
| 1020 | - $this->assertEqualXMLStructure( |
|
| 1021 | - $expected->firstChild, |
|
| 1022 | - $actual->firstChild, |
|
| 1023 | - true |
|
| 1024 | - ); |
|
| 1025 | - } |
|
| 1020 | + $this->assertEqualXMLStructure( |
|
| 1021 | + $expected->firstChild, |
|
| 1022 | + $actual->firstChild, |
|
| 1023 | + true |
|
| 1024 | + ); |
|
| 1025 | + } |
|
| 1026 | 1026 | |
| 1027 | - public function testXMLStructureWrongNumberOfNodes() |
|
| 1028 | - { |
|
| 1029 | - $expected = new \DOMDocument; |
|
| 1030 | - $expected->load($this->filesDirectory . 'structureExpected.xml'); |
|
| 1027 | + public function testXMLStructureWrongNumberOfNodes() |
|
| 1028 | + { |
|
| 1029 | + $expected = new \DOMDocument; |
|
| 1030 | + $expected->load($this->filesDirectory . 'structureExpected.xml'); |
|
| 1031 | 1031 | |
| 1032 | - $actual = new \DOMDocument; |
|
| 1033 | - $actual->load($this->filesDirectory . 'structureWrongNumberOfNodes.xml'); |
|
| 1032 | + $actual = new \DOMDocument; |
|
| 1033 | + $actual->load($this->filesDirectory . 'structureWrongNumberOfNodes.xml'); |
|
| 1034 | 1034 | |
| 1035 | - $this->expectException(ExpectationFailedException::class); |
|
| 1035 | + $this->expectException(ExpectationFailedException::class); |
|
| 1036 | 1036 | |
| 1037 | - $this->assertEqualXMLStructure( |
|
| 1038 | - $expected->firstChild, |
|
| 1039 | - $actual->firstChild, |
|
| 1040 | - true |
|
| 1041 | - ); |
|
| 1042 | - } |
|
| 1037 | + $this->assertEqualXMLStructure( |
|
| 1038 | + $expected->firstChild, |
|
| 1039 | + $actual->firstChild, |
|
| 1040 | + true |
|
| 1041 | + ); |
|
| 1042 | + } |
|
| 1043 | 1043 | |
| 1044 | - public function testXMLStructureIsSameButDataIsNot() |
|
| 1045 | - { |
|
| 1046 | - $expected = new \DOMDocument; |
|
| 1047 | - $expected->load($this->filesDirectory . 'structureExpected.xml'); |
|
| 1044 | + public function testXMLStructureIsSameButDataIsNot() |
|
| 1045 | + { |
|
| 1046 | + $expected = new \DOMDocument; |
|
| 1047 | + $expected->load($this->filesDirectory . 'structureExpected.xml'); |
|
| 1048 | 1048 | |
| 1049 | - $actual = new \DOMDocument; |
|
| 1050 | - $actual->load($this->filesDirectory . 'structureIsSameButDataIsNot.xml'); |
|
| 1049 | + $actual = new \DOMDocument; |
|
| 1050 | + $actual->load($this->filesDirectory . 'structureIsSameButDataIsNot.xml'); |
|
| 1051 | 1051 | |
| 1052 | - $this->assertEqualXMLStructure( |
|
| 1053 | - $expected->firstChild, |
|
| 1054 | - $actual->firstChild, |
|
| 1055 | - true |
|
| 1056 | - ); |
|
| 1057 | - } |
|
| 1052 | + $this->assertEqualXMLStructure( |
|
| 1053 | + $expected->firstChild, |
|
| 1054 | + $actual->firstChild, |
|
| 1055 | + true |
|
| 1056 | + ); |
|
| 1057 | + } |
|
| 1058 | 1058 | |
| 1059 | - public function testXMLStructureAttributesAreSameButValuesAreNot() |
|
| 1060 | - { |
|
| 1061 | - $expected = new \DOMDocument; |
|
| 1062 | - $expected->load($this->filesDirectory . 'structureExpected.xml'); |
|
| 1059 | + public function testXMLStructureAttributesAreSameButValuesAreNot() |
|
| 1060 | + { |
|
| 1061 | + $expected = new \DOMDocument; |
|
| 1062 | + $expected->load($this->filesDirectory . 'structureExpected.xml'); |
|
| 1063 | 1063 | |
| 1064 | - $actual = new \DOMDocument; |
|
| 1065 | - $actual->load($this->filesDirectory . 'structureAttributesAreSameButValuesAreNot.xml'); |
|
| 1064 | + $actual = new \DOMDocument; |
|
| 1065 | + $actual->load($this->filesDirectory . 'structureAttributesAreSameButValuesAreNot.xml'); |
|
| 1066 | 1066 | |
| 1067 | - $this->assertEqualXMLStructure( |
|
| 1068 | - $expected->firstChild, |
|
| 1069 | - $actual->firstChild, |
|
| 1070 | - true |
|
| 1071 | - ); |
|
| 1072 | - } |
|
| 1067 | + $this->assertEqualXMLStructure( |
|
| 1068 | + $expected->firstChild, |
|
| 1069 | + $actual->firstChild, |
|
| 1070 | + true |
|
| 1071 | + ); |
|
| 1072 | + } |
|
| 1073 | 1073 | |
| 1074 | - public function testXMLStructureIgnoreTextNodes() |
|
| 1075 | - { |
|
| 1076 | - $expected = new \DOMDocument; |
|
| 1077 | - $expected->load($this->filesDirectory . 'structureExpected.xml'); |
|
| 1074 | + public function testXMLStructureIgnoreTextNodes() |
|
| 1075 | + { |
|
| 1076 | + $expected = new \DOMDocument; |
|
| 1077 | + $expected->load($this->filesDirectory . 'structureExpected.xml'); |
|
| 1078 | 1078 | |
| 1079 | - $actual = new \DOMDocument; |
|
| 1080 | - $actual->load($this->filesDirectory . 'structureIgnoreTextNodes.xml'); |
|
| 1079 | + $actual = new \DOMDocument; |
|
| 1080 | + $actual->load($this->filesDirectory . 'structureIgnoreTextNodes.xml'); |
|
| 1081 | 1081 | |
| 1082 | - $this->assertEqualXMLStructure( |
|
| 1083 | - $expected->firstChild, |
|
| 1084 | - $actual->firstChild, |
|
| 1085 | - true |
|
| 1086 | - ); |
|
| 1087 | - } |
|
| 1082 | + $this->assertEqualXMLStructure( |
|
| 1083 | + $expected->firstChild, |
|
| 1084 | + $actual->firstChild, |
|
| 1085 | + true |
|
| 1086 | + ); |
|
| 1087 | + } |
|
| 1088 | 1088 | |
| 1089 | - public function testAssertStringEqualsNumeric() |
|
| 1090 | - { |
|
| 1091 | - $this->assertEquals('0', 0); |
|
| 1089 | + public function testAssertStringEqualsNumeric() |
|
| 1090 | + { |
|
| 1091 | + $this->assertEquals('0', 0); |
|
| 1092 | 1092 | |
| 1093 | - $this->expectException(AssertionFailedError::class); |
|
| 1093 | + $this->expectException(AssertionFailedError::class); |
|
| 1094 | 1094 | |
| 1095 | - $this->assertEquals('0', 1); |
|
| 1096 | - } |
|
| 1095 | + $this->assertEquals('0', 1); |
|
| 1096 | + } |
|
| 1097 | 1097 | |
| 1098 | - public function testAssertStringEqualsNumeric2() |
|
| 1099 | - { |
|
| 1100 | - $this->assertNotEquals('A', 0); |
|
| 1101 | - } |
|
| 1098 | + public function testAssertStringEqualsNumeric2() |
|
| 1099 | + { |
|
| 1100 | + $this->assertNotEquals('A', 0); |
|
| 1101 | + } |
|
| 1102 | 1102 | |
| 1103 | - public function testAssertIsReadableThrowsException() |
|
| 1104 | - { |
|
| 1105 | - $this->expectException(Exception::class); |
|
| 1103 | + public function testAssertIsReadableThrowsException() |
|
| 1104 | + { |
|
| 1105 | + $this->expectException(Exception::class); |
|
| 1106 | 1106 | |
| 1107 | - $this->assertIsReadable(null); |
|
| 1108 | - } |
|
| 1107 | + $this->assertIsReadable(null); |
|
| 1108 | + } |
|
| 1109 | 1109 | |
| 1110 | - public function testAssertIsReadable() |
|
| 1111 | - { |
|
| 1112 | - $this->assertIsReadable(__FILE__); |
|
| 1110 | + public function testAssertIsReadable() |
|
| 1111 | + { |
|
| 1112 | + $this->assertIsReadable(__FILE__); |
|
| 1113 | 1113 | |
| 1114 | - $this->expectException(AssertionFailedError::class); |
|
| 1114 | + $this->expectException(AssertionFailedError::class); |
|
| 1115 | 1115 | |
| 1116 | - $this->assertIsReadable(__DIR__ . DIRECTORY_SEPARATOR . 'NotExisting'); |
|
| 1117 | - } |
|
| 1116 | + $this->assertIsReadable(__DIR__ . DIRECTORY_SEPARATOR . 'NotExisting'); |
|
| 1117 | + } |
|
| 1118 | 1118 | |
| 1119 | - public function testAssertNotIsReadableThrowsException() |
|
| 1120 | - { |
|
| 1121 | - $this->expectException(Exception::class); |
|
| 1119 | + public function testAssertNotIsReadableThrowsException() |
|
| 1120 | + { |
|
| 1121 | + $this->expectException(Exception::class); |
|
| 1122 | 1122 | |
| 1123 | - $this->assertNotIsReadable(null); |
|
| 1124 | - } |
|
| 1123 | + $this->assertNotIsReadable(null); |
|
| 1124 | + } |
|
| 1125 | 1125 | |
| 1126 | - public function testAssertNotIsReadable() |
|
| 1127 | - { |
|
| 1128 | - $this->expectException(AssertionFailedError::class); |
|
| 1126 | + public function testAssertNotIsReadable() |
|
| 1127 | + { |
|
| 1128 | + $this->expectException(AssertionFailedError::class); |
|
| 1129 | 1129 | |
| 1130 | - $this->assertNotIsReadable(__FILE__); |
|
| 1131 | - } |
|
| 1130 | + $this->assertNotIsReadable(__FILE__); |
|
| 1131 | + } |
|
| 1132 | 1132 | |
| 1133 | - public function testAssertIsWritableThrowsException() |
|
| 1134 | - { |
|
| 1135 | - $this->expectException(Exception::class); |
|
| 1133 | + public function testAssertIsWritableThrowsException() |
|
| 1134 | + { |
|
| 1135 | + $this->expectException(Exception::class); |
|
| 1136 | 1136 | |
| 1137 | - $this->assertIsWritable(null); |
|
| 1138 | - } |
|
| 1137 | + $this->assertIsWritable(null); |
|
| 1138 | + } |
|
| 1139 | 1139 | |
| 1140 | - public function testAssertIsWritable() |
|
| 1141 | - { |
|
| 1142 | - $this->assertIsWritable(__FILE__); |
|
| 1140 | + public function testAssertIsWritable() |
|
| 1141 | + { |
|
| 1142 | + $this->assertIsWritable(__FILE__); |
|
| 1143 | 1143 | |
| 1144 | - $this->expectException(AssertionFailedError::class); |
|
| 1144 | + $this->expectException(AssertionFailedError::class); |
|
| 1145 | 1145 | |
| 1146 | - $this->assertIsWritable(__DIR__ . DIRECTORY_SEPARATOR . 'NotExisting'); |
|
| 1147 | - } |
|
| 1146 | + $this->assertIsWritable(__DIR__ . DIRECTORY_SEPARATOR . 'NotExisting'); |
|
| 1147 | + } |
|
| 1148 | 1148 | |
| 1149 | - public function testAssertNotIsWritableThrowsException() |
|
| 1150 | - { |
|
| 1151 | - $this->expectException(Exception::class); |
|
| 1149 | + public function testAssertNotIsWritableThrowsException() |
|
| 1150 | + { |
|
| 1151 | + $this->expectException(Exception::class); |
|
| 1152 | 1152 | |
| 1153 | - $this->assertNotIsWritable(null); |
|
| 1154 | - } |
|
| 1153 | + $this->assertNotIsWritable(null); |
|
| 1154 | + } |
|
| 1155 | 1155 | |
| 1156 | - public function testAssertNotIsWritable() |
|
| 1157 | - { |
|
| 1158 | - $this->expectException(AssertionFailedError::class); |
|
| 1156 | + public function testAssertNotIsWritable() |
|
| 1157 | + { |
|
| 1158 | + $this->expectException(AssertionFailedError::class); |
|
| 1159 | 1159 | |
| 1160 | - $this->assertNotIsWritable(__FILE__); |
|
| 1161 | - } |
|
| 1160 | + $this->assertNotIsWritable(__FILE__); |
|
| 1161 | + } |
|
| 1162 | 1162 | |
| 1163 | - public function testAssertDirectoryExistsThrowsException() |
|
| 1164 | - { |
|
| 1165 | - $this->expectException(Exception::class); |
|
| 1163 | + public function testAssertDirectoryExistsThrowsException() |
|
| 1164 | + { |
|
| 1165 | + $this->expectException(Exception::class); |
|
| 1166 | 1166 | |
| 1167 | - $this->assertDirectoryExists(null); |
|
| 1168 | - } |
|
| 1167 | + $this->assertDirectoryExists(null); |
|
| 1168 | + } |
|
| 1169 | 1169 | |
| 1170 | - public function testAssertDirectoryExists() |
|
| 1171 | - { |
|
| 1172 | - $this->assertDirectoryExists(__DIR__); |
|
| 1170 | + public function testAssertDirectoryExists() |
|
| 1171 | + { |
|
| 1172 | + $this->assertDirectoryExists(__DIR__); |
|
| 1173 | 1173 | |
| 1174 | - $this->expectException(AssertionFailedError::class); |
|
| 1174 | + $this->expectException(AssertionFailedError::class); |
|
| 1175 | 1175 | |
| 1176 | - $this->assertDirectoryExists(__DIR__ . DIRECTORY_SEPARATOR . 'NotExisting'); |
|
| 1177 | - } |
|
| 1176 | + $this->assertDirectoryExists(__DIR__ . DIRECTORY_SEPARATOR . 'NotExisting'); |
|
| 1177 | + } |
|
| 1178 | 1178 | |
| 1179 | - public function testAssertDirectoryNotExistsThrowsException() |
|
| 1180 | - { |
|
| 1181 | - $this->expectException(Exception::class); |
|
| 1179 | + public function testAssertDirectoryNotExistsThrowsException() |
|
| 1180 | + { |
|
| 1181 | + $this->expectException(Exception::class); |
|
| 1182 | 1182 | |
| 1183 | - $this->assertDirectoryNotExists(null); |
|
| 1184 | - } |
|
| 1183 | + $this->assertDirectoryNotExists(null); |
|
| 1184 | + } |
|
| 1185 | 1185 | |
| 1186 | - public function testAssertDirectoryNotExists() |
|
| 1187 | - { |
|
| 1188 | - $this->assertDirectoryNotExists(__DIR__ . DIRECTORY_SEPARATOR . 'NotExisting'); |
|
| 1186 | + public function testAssertDirectoryNotExists() |
|
| 1187 | + { |
|
| 1188 | + $this->assertDirectoryNotExists(__DIR__ . DIRECTORY_SEPARATOR . 'NotExisting'); |
|
| 1189 | 1189 | |
| 1190 | - $this->expectException(AssertionFailedError::class); |
|
| 1190 | + $this->expectException(AssertionFailedError::class); |
|
| 1191 | 1191 | |
| 1192 | - $this->assertDirectoryNotExists(__DIR__); |
|
| 1193 | - } |
|
| 1192 | + $this->assertDirectoryNotExists(__DIR__); |
|
| 1193 | + } |
|
| 1194 | 1194 | |
| 1195 | - public function testAssertDirectoryIsReadableThrowsException() |
|
| 1196 | - { |
|
| 1197 | - $this->expectException(Exception::class); |
|
| 1195 | + public function testAssertDirectoryIsReadableThrowsException() |
|
| 1196 | + { |
|
| 1197 | + $this->expectException(Exception::class); |
|
| 1198 | 1198 | |
| 1199 | - $this->assertDirectoryIsReadable(null); |
|
| 1200 | - } |
|
| 1199 | + $this->assertDirectoryIsReadable(null); |
|
| 1200 | + } |
|
| 1201 | 1201 | |
| 1202 | - public function testAssertDirectoryIsReadable() |
|
| 1203 | - { |
|
| 1204 | - $this->assertDirectoryIsReadable(__DIR__); |
|
| 1202 | + public function testAssertDirectoryIsReadable() |
|
| 1203 | + { |
|
| 1204 | + $this->assertDirectoryIsReadable(__DIR__); |
|
| 1205 | 1205 | |
| 1206 | - $this->expectException(AssertionFailedError::class); |
|
| 1206 | + $this->expectException(AssertionFailedError::class); |
|
| 1207 | 1207 | |
| 1208 | - $this->assertDirectoryIsReadable(__DIR__ . DIRECTORY_SEPARATOR . 'NotExisting'); |
|
| 1209 | - } |
|
| 1208 | + $this->assertDirectoryIsReadable(__DIR__ . DIRECTORY_SEPARATOR . 'NotExisting'); |
|
| 1209 | + } |
|
| 1210 | 1210 | |
| 1211 | - public function testAssertDirectoryNotIsReadableThrowsException() |
|
| 1212 | - { |
|
| 1213 | - $this->expectException(Exception::class); |
|
| 1211 | + public function testAssertDirectoryNotIsReadableThrowsException() |
|
| 1212 | + { |
|
| 1213 | + $this->expectException(Exception::class); |
|
| 1214 | 1214 | |
| 1215 | - $this->assertDirectoryNotIsReadable(null); |
|
| 1216 | - } |
|
| 1215 | + $this->assertDirectoryNotIsReadable(null); |
|
| 1216 | + } |
|
| 1217 | 1217 | |
| 1218 | - public function testAssertDirectoryIsWritableThrowsException() |
|
| 1219 | - { |
|
| 1220 | - $this->expectException(Exception::class); |
|
| 1218 | + public function testAssertDirectoryIsWritableThrowsException() |
|
| 1219 | + { |
|
| 1220 | + $this->expectException(Exception::class); |
|
| 1221 | 1221 | |
| 1222 | - $this->assertDirectoryIsWritable(null); |
|
| 1223 | - } |
|
| 1222 | + $this->assertDirectoryIsWritable(null); |
|
| 1223 | + } |
|
| 1224 | 1224 | |
| 1225 | - public function testAssertDirectoryIsWritable() |
|
| 1226 | - { |
|
| 1227 | - $this->assertDirectoryIsWritable(__DIR__); |
|
| 1225 | + public function testAssertDirectoryIsWritable() |
|
| 1226 | + { |
|
| 1227 | + $this->assertDirectoryIsWritable(__DIR__); |
|
| 1228 | 1228 | |
| 1229 | - $this->expectException(AssertionFailedError::class); |
|
| 1229 | + $this->expectException(AssertionFailedError::class); |
|
| 1230 | 1230 | |
| 1231 | - $this->assertDirectoryIsWritable(__DIR__ . DIRECTORY_SEPARATOR . 'NotExisting'); |
|
| 1232 | - } |
|
| 1231 | + $this->assertDirectoryIsWritable(__DIR__ . DIRECTORY_SEPARATOR . 'NotExisting'); |
|
| 1232 | + } |
|
| 1233 | 1233 | |
| 1234 | - public function testAssertDirectoryNotIsWritableThrowsException() |
|
| 1235 | - { |
|
| 1236 | - $this->expectException(Exception::class); |
|
| 1234 | + public function testAssertDirectoryNotIsWritableThrowsException() |
|
| 1235 | + { |
|
| 1236 | + $this->expectException(Exception::class); |
|
| 1237 | 1237 | |
| 1238 | - $this->assertDirectoryNotIsWritable(null); |
|
| 1239 | - } |
|
| 1238 | + $this->assertDirectoryNotIsWritable(null); |
|
| 1239 | + } |
|
| 1240 | 1240 | |
| 1241 | - public function testAssertFileExistsThrowsException() |
|
| 1242 | - { |
|
| 1243 | - $this->expectException(Exception::class); |
|
| 1241 | + public function testAssertFileExistsThrowsException() |
|
| 1242 | + { |
|
| 1243 | + $this->expectException(Exception::class); |
|
| 1244 | 1244 | |
| 1245 | - $this->assertFileExists(null); |
|
| 1246 | - } |
|
| 1245 | + $this->assertFileExists(null); |
|
| 1246 | + } |
|
| 1247 | 1247 | |
| 1248 | - public function testAssertFileExists() |
|
| 1249 | - { |
|
| 1250 | - $this->assertFileExists(__FILE__); |
|
| 1248 | + public function testAssertFileExists() |
|
| 1249 | + { |
|
| 1250 | + $this->assertFileExists(__FILE__); |
|
| 1251 | 1251 | |
| 1252 | - $this->expectException(AssertionFailedError::class); |
|
| 1252 | + $this->expectException(AssertionFailedError::class); |
|
| 1253 | 1253 | |
| 1254 | - $this->assertFileExists(__DIR__ . DIRECTORY_SEPARATOR . 'NotExisting'); |
|
| 1255 | - } |
|
| 1254 | + $this->assertFileExists(__DIR__ . DIRECTORY_SEPARATOR . 'NotExisting'); |
|
| 1255 | + } |
|
| 1256 | 1256 | |
| 1257 | - public function testAssertFileNotExistsThrowsException() |
|
| 1258 | - { |
|
| 1259 | - $this->expectException(Exception::class); |
|
| 1257 | + public function testAssertFileNotExistsThrowsException() |
|
| 1258 | + { |
|
| 1259 | + $this->expectException(Exception::class); |
|
| 1260 | 1260 | |
| 1261 | - $this->assertFileNotExists(null); |
|
| 1262 | - } |
|
| 1261 | + $this->assertFileNotExists(null); |
|
| 1262 | + } |
|
| 1263 | 1263 | |
| 1264 | - public function testAssertFileNotExists() |
|
| 1265 | - { |
|
| 1266 | - $this->assertFileNotExists(__DIR__ . DIRECTORY_SEPARATOR . 'NotExisting'); |
|
| 1264 | + public function testAssertFileNotExists() |
|
| 1265 | + { |
|
| 1266 | + $this->assertFileNotExists(__DIR__ . DIRECTORY_SEPARATOR . 'NotExisting'); |
|
| 1267 | 1267 | |
| 1268 | - $this->expectException(AssertionFailedError::class); |
|
| 1268 | + $this->expectException(AssertionFailedError::class); |
|
| 1269 | 1269 | |
| 1270 | - $this->assertFileNotExists(__FILE__); |
|
| 1271 | - } |
|
| 1270 | + $this->assertFileNotExists(__FILE__); |
|
| 1271 | + } |
|
| 1272 | 1272 | |
| 1273 | - public function testAssertFileIsReadableThrowsException() |
|
| 1274 | - { |
|
| 1275 | - $this->expectException(Exception::class); |
|
| 1273 | + public function testAssertFileIsReadableThrowsException() |
|
| 1274 | + { |
|
| 1275 | + $this->expectException(Exception::class); |
|
| 1276 | 1276 | |
| 1277 | - $this->assertFileIsReadable(null); |
|
| 1278 | - } |
|
| 1277 | + $this->assertFileIsReadable(null); |
|
| 1278 | + } |
|
| 1279 | 1279 | |
| 1280 | - public function testAssertFileIsReadable() |
|
| 1281 | - { |
|
| 1282 | - $this->assertFileIsReadable(__FILE__); |
|
| 1280 | + public function testAssertFileIsReadable() |
|
| 1281 | + { |
|
| 1282 | + $this->assertFileIsReadable(__FILE__); |
|
| 1283 | 1283 | |
| 1284 | - $this->expectException(AssertionFailedError::class); |
|
| 1284 | + $this->expectException(AssertionFailedError::class); |
|
| 1285 | 1285 | |
| 1286 | - $this->assertFileIsReadable(__DIR__ . DIRECTORY_SEPARATOR . 'NotExisting'); |
|
| 1287 | - } |
|
| 1286 | + $this->assertFileIsReadable(__DIR__ . DIRECTORY_SEPARATOR . 'NotExisting'); |
|
| 1287 | + } |
|
| 1288 | 1288 | |
| 1289 | - public function testAssertFileNotIsReadableThrowsException() |
|
| 1290 | - { |
|
| 1291 | - $this->expectException(Exception::class); |
|
| 1289 | + public function testAssertFileNotIsReadableThrowsException() |
|
| 1290 | + { |
|
| 1291 | + $this->expectException(Exception::class); |
|
| 1292 | 1292 | |
| 1293 | - $this->assertFileNotIsReadable(null); |
|
| 1294 | - } |
|
| 1293 | + $this->assertFileNotIsReadable(null); |
|
| 1294 | + } |
|
| 1295 | 1295 | |
| 1296 | - public function testAssertFileIsWritableThrowsException() |
|
| 1297 | - { |
|
| 1298 | - $this->expectException(Exception::class); |
|
| 1296 | + public function testAssertFileIsWritableThrowsException() |
|
| 1297 | + { |
|
| 1298 | + $this->expectException(Exception::class); |
|
| 1299 | 1299 | |
| 1300 | - $this->assertFileIsWritable(null); |
|
| 1301 | - } |
|
| 1300 | + $this->assertFileIsWritable(null); |
|
| 1301 | + } |
|
| 1302 | 1302 | |
| 1303 | - public function testAssertFileIsWritable() |
|
| 1304 | - { |
|
| 1305 | - $this->assertFileIsWritable(__FILE__); |
|
| 1303 | + public function testAssertFileIsWritable() |
|
| 1304 | + { |
|
| 1305 | + $this->assertFileIsWritable(__FILE__); |
|
| 1306 | 1306 | |
| 1307 | - $this->expectException(AssertionFailedError::class); |
|
| 1307 | + $this->expectException(AssertionFailedError::class); |
|
| 1308 | 1308 | |
| 1309 | - $this->assertFileIsWritable(__DIR__ . DIRECTORY_SEPARATOR . 'NotExisting'); |
|
| 1310 | - } |
|
| 1309 | + $this->assertFileIsWritable(__DIR__ . DIRECTORY_SEPARATOR . 'NotExisting'); |
|
| 1310 | + } |
|
| 1311 | 1311 | |
| 1312 | - public function testAssertFileNotIsWritableThrowsException() |
|
| 1313 | - { |
|
| 1314 | - $this->expectException(Exception::class); |
|
| 1312 | + public function testAssertFileNotIsWritableThrowsException() |
|
| 1313 | + { |
|
| 1314 | + $this->expectException(Exception::class); |
|
| 1315 | 1315 | |
| 1316 | - $this->assertFileNotIsWritable(null); |
|
| 1317 | - } |
|
| 1316 | + $this->assertFileNotIsWritable(null); |
|
| 1317 | + } |
|
| 1318 | 1318 | |
| 1319 | - public function testAssertObjectHasAttribute() |
|
| 1320 | - { |
|
| 1321 | - $o = new \Author('Terry Pratchett'); |
|
| 1319 | + public function testAssertObjectHasAttribute() |
|
| 1320 | + { |
|
| 1321 | + $o = new \Author('Terry Pratchett'); |
|
| 1322 | 1322 | |
| 1323 | - $this->assertObjectHasAttribute('name', $o); |
|
| 1323 | + $this->assertObjectHasAttribute('name', $o); |
|
| 1324 | 1324 | |
| 1325 | - $this->expectException(AssertionFailedError::class); |
|
| 1325 | + $this->expectException(AssertionFailedError::class); |
|
| 1326 | 1326 | |
| 1327 | - $this->assertObjectHasAttribute('foo', $o); |
|
| 1328 | - } |
|
| 1327 | + $this->assertObjectHasAttribute('foo', $o); |
|
| 1328 | + } |
|
| 1329 | 1329 | |
| 1330 | - public function testAssertObjectNotHasAttribute() |
|
| 1331 | - { |
|
| 1332 | - $o = new \Author('Terry Pratchett'); |
|
| 1330 | + public function testAssertObjectNotHasAttribute() |
|
| 1331 | + { |
|
| 1332 | + $o = new \Author('Terry Pratchett'); |
|
| 1333 | 1333 | |
| 1334 | - $this->assertObjectNotHasAttribute('foo', $o); |
|
| 1334 | + $this->assertObjectNotHasAttribute('foo', $o); |
|
| 1335 | 1335 | |
| 1336 | - $this->expectException(AssertionFailedError::class); |
|
| 1336 | + $this->expectException(AssertionFailedError::class); |
|
| 1337 | 1337 | |
| 1338 | - $this->assertObjectNotHasAttribute('name', $o); |
|
| 1339 | - } |
|
| 1338 | + $this->assertObjectNotHasAttribute('name', $o); |
|
| 1339 | + } |
|
| 1340 | 1340 | |
| 1341 | - public function testAssertFinite() |
|
| 1342 | - { |
|
| 1343 | - $this->assertFinite(1); |
|
| 1341 | + public function testAssertFinite() |
|
| 1342 | + { |
|
| 1343 | + $this->assertFinite(1); |
|
| 1344 | 1344 | |
| 1345 | - $this->expectException(AssertionFailedError::class); |
|
| 1345 | + $this->expectException(AssertionFailedError::class); |
|
| 1346 | 1346 | |
| 1347 | - $this->assertFinite(INF); |
|
| 1348 | - } |
|
| 1347 | + $this->assertFinite(INF); |
|
| 1348 | + } |
|
| 1349 | 1349 | |
| 1350 | - public function testAssertInfinite() |
|
| 1351 | - { |
|
| 1352 | - $this->assertInfinite(INF); |
|
| 1350 | + public function testAssertInfinite() |
|
| 1351 | + { |
|
| 1352 | + $this->assertInfinite(INF); |
|
| 1353 | 1353 | |
| 1354 | - $this->expectException(AssertionFailedError::class); |
|
| 1354 | + $this->expectException(AssertionFailedError::class); |
|
| 1355 | 1355 | |
| 1356 | - $this->assertInfinite(1); |
|
| 1357 | - } |
|
| 1356 | + $this->assertInfinite(1); |
|
| 1357 | + } |
|
| 1358 | 1358 | |
| 1359 | - public function testAssertNan() |
|
| 1360 | - { |
|
| 1361 | - $this->assertNan(NAN); |
|
| 1359 | + public function testAssertNan() |
|
| 1360 | + { |
|
| 1361 | + $this->assertNan(NAN); |
|
| 1362 | 1362 | |
| 1363 | - $this->expectException(AssertionFailedError::class); |
|
| 1363 | + $this->expectException(AssertionFailedError::class); |
|
| 1364 | 1364 | |
| 1365 | - $this->assertNan(1); |
|
| 1366 | - } |
|
| 1365 | + $this->assertNan(1); |
|
| 1366 | + } |
|
| 1367 | 1367 | |
| 1368 | - public function testAssertNull() |
|
| 1369 | - { |
|
| 1370 | - $this->assertNull(null); |
|
| 1368 | + public function testAssertNull() |
|
| 1369 | + { |
|
| 1370 | + $this->assertNull(null); |
|
| 1371 | 1371 | |
| 1372 | - $this->expectException(AssertionFailedError::class); |
|
| 1372 | + $this->expectException(AssertionFailedError::class); |
|
| 1373 | 1373 | |
| 1374 | - $this->assertNull(new \stdClass); |
|
| 1375 | - } |
|
| 1374 | + $this->assertNull(new \stdClass); |
|
| 1375 | + } |
|
| 1376 | 1376 | |
| 1377 | - public function testAssertNotNull() |
|
| 1378 | - { |
|
| 1379 | - $this->assertNotNull(new \stdClass); |
|
| 1377 | + public function testAssertNotNull() |
|
| 1378 | + { |
|
| 1379 | + $this->assertNotNull(new \stdClass); |
|
| 1380 | 1380 | |
| 1381 | - $this->expectException(AssertionFailedError::class); |
|
| 1381 | + $this->expectException(AssertionFailedError::class); |
|
| 1382 | 1382 | |
| 1383 | - $this->assertNotNull(null); |
|
| 1384 | - } |
|
| 1383 | + $this->assertNotNull(null); |
|
| 1384 | + } |
|
| 1385 | 1385 | |
| 1386 | - public function testAssertTrue() |
|
| 1387 | - { |
|
| 1388 | - $this->assertTrue(true); |
|
| 1386 | + public function testAssertTrue() |
|
| 1387 | + { |
|
| 1388 | + $this->assertTrue(true); |
|
| 1389 | 1389 | |
| 1390 | - $this->expectException(AssertionFailedError::class); |
|
| 1390 | + $this->expectException(AssertionFailedError::class); |
|
| 1391 | 1391 | |
| 1392 | - $this->assertTrue(false); |
|
| 1393 | - } |
|
| 1392 | + $this->assertTrue(false); |
|
| 1393 | + } |
|
| 1394 | 1394 | |
| 1395 | - public function testAssertNotTrue() |
|
| 1396 | - { |
|
| 1397 | - $this->assertNotTrue(false); |
|
| 1398 | - $this->assertNotTrue(1); |
|
| 1399 | - $this->assertNotTrue('true'); |
|
| 1395 | + public function testAssertNotTrue() |
|
| 1396 | + { |
|
| 1397 | + $this->assertNotTrue(false); |
|
| 1398 | + $this->assertNotTrue(1); |
|
| 1399 | + $this->assertNotTrue('true'); |
|
| 1400 | 1400 | |
| 1401 | - $this->expectException(AssertionFailedError::class); |
|
| 1401 | + $this->expectException(AssertionFailedError::class); |
|
| 1402 | 1402 | |
| 1403 | - $this->assertNotTrue(true); |
|
| 1404 | - } |
|
| 1403 | + $this->assertNotTrue(true); |
|
| 1404 | + } |
|
| 1405 | 1405 | |
| 1406 | - public function testAssertFalse() |
|
| 1407 | - { |
|
| 1408 | - $this->assertFalse(false); |
|
| 1406 | + public function testAssertFalse() |
|
| 1407 | + { |
|
| 1408 | + $this->assertFalse(false); |
|
| 1409 | 1409 | |
| 1410 | - $this->expectException(AssertionFailedError::class); |
|
| 1410 | + $this->expectException(AssertionFailedError::class); |
|
| 1411 | 1411 | |
| 1412 | - $this->assertFalse(true); |
|
| 1413 | - } |
|
| 1412 | + $this->assertFalse(true); |
|
| 1413 | + } |
|
| 1414 | 1414 | |
| 1415 | - public function testAssertNotFalse() |
|
| 1416 | - { |
|
| 1417 | - $this->assertNotFalse(true); |
|
| 1418 | - $this->assertNotFalse(0); |
|
| 1419 | - $this->assertNotFalse(''); |
|
| 1415 | + public function testAssertNotFalse() |
|
| 1416 | + { |
|
| 1417 | + $this->assertNotFalse(true); |
|
| 1418 | + $this->assertNotFalse(0); |
|
| 1419 | + $this->assertNotFalse(''); |
|
| 1420 | 1420 | |
| 1421 | - $this->expectException(AssertionFailedError::class); |
|
| 1421 | + $this->expectException(AssertionFailedError::class); |
|
| 1422 | 1422 | |
| 1423 | - $this->assertNotFalse(false); |
|
| 1424 | - } |
|
| 1423 | + $this->assertNotFalse(false); |
|
| 1424 | + } |
|
| 1425 | 1425 | |
| 1426 | - public function testAssertRegExpThrowsException() |
|
| 1427 | - { |
|
| 1428 | - $this->expectException(Exception::class); |
|
| 1426 | + public function testAssertRegExpThrowsException() |
|
| 1427 | + { |
|
| 1428 | + $this->expectException(Exception::class); |
|
| 1429 | 1429 | |
| 1430 | - $this->assertRegExp(null, null); |
|
| 1431 | - } |
|
| 1430 | + $this->assertRegExp(null, null); |
|
| 1431 | + } |
|
| 1432 | 1432 | |
| 1433 | - public function testAssertRegExpThrowsException2() |
|
| 1434 | - { |
|
| 1435 | - $this->expectException(Exception::class); |
|
| 1433 | + public function testAssertRegExpThrowsException2() |
|
| 1434 | + { |
|
| 1435 | + $this->expectException(Exception::class); |
|
| 1436 | 1436 | |
| 1437 | - $this->assertRegExp('', null); |
|
| 1438 | - } |
|
| 1437 | + $this->assertRegExp('', null); |
|
| 1438 | + } |
|
| 1439 | 1439 | |
| 1440 | - public function testAssertNotRegExpThrowsException() |
|
| 1441 | - { |
|
| 1442 | - $this->expectException(Exception::class); |
|
| 1440 | + public function testAssertNotRegExpThrowsException() |
|
| 1441 | + { |
|
| 1442 | + $this->expectException(Exception::class); |
|
| 1443 | 1443 | |
| 1444 | - $this->assertNotRegExp(null, null); |
|
| 1445 | - } |
|
| 1444 | + $this->assertNotRegExp(null, null); |
|
| 1445 | + } |
|
| 1446 | 1446 | |
| 1447 | - public function testAssertNotRegExpThrowsException2() |
|
| 1448 | - { |
|
| 1449 | - $this->expectException(Exception::class); |
|
| 1447 | + public function testAssertNotRegExpThrowsException2() |
|
| 1448 | + { |
|
| 1449 | + $this->expectException(Exception::class); |
|
| 1450 | 1450 | |
| 1451 | - $this->assertNotRegExp('', null); |
|
| 1452 | - } |
|
| 1451 | + $this->assertNotRegExp('', null); |
|
| 1452 | + } |
|
| 1453 | 1453 | |
| 1454 | - public function testAssertRegExp() |
|
| 1455 | - { |
|
| 1456 | - $this->assertRegExp('/foo/', 'foobar'); |
|
| 1454 | + public function testAssertRegExp() |
|
| 1455 | + { |
|
| 1456 | + $this->assertRegExp('/foo/', 'foobar'); |
|
| 1457 | 1457 | |
| 1458 | - $this->expectException(AssertionFailedError::class); |
|
| 1458 | + $this->expectException(AssertionFailedError::class); |
|
| 1459 | 1459 | |
| 1460 | - $this->assertRegExp('/foo/', 'bar'); |
|
| 1461 | - } |
|
| 1460 | + $this->assertRegExp('/foo/', 'bar'); |
|
| 1461 | + } |
|
| 1462 | 1462 | |
| 1463 | - public function testAssertNotRegExp() |
|
| 1464 | - { |
|
| 1465 | - $this->assertNotRegExp('/foo/', 'bar'); |
|
| 1463 | + public function testAssertNotRegExp() |
|
| 1464 | + { |
|
| 1465 | + $this->assertNotRegExp('/foo/', 'bar'); |
|
| 1466 | 1466 | |
| 1467 | - $this->expectException(AssertionFailedError::class); |
|
| 1467 | + $this->expectException(AssertionFailedError::class); |
|
| 1468 | 1468 | |
| 1469 | - $this->assertNotRegExp('/foo/', 'foobar'); |
|
| 1470 | - } |
|
| 1469 | + $this->assertNotRegExp('/foo/', 'foobar'); |
|
| 1470 | + } |
|
| 1471 | 1471 | |
| 1472 | - public function testAssertSame() |
|
| 1473 | - { |
|
| 1474 | - $o = new \stdClass; |
|
| 1472 | + public function testAssertSame() |
|
| 1473 | + { |
|
| 1474 | + $o = new \stdClass; |
|
| 1475 | 1475 | |
| 1476 | - $this->assertSame($o, $o); |
|
| 1476 | + $this->assertSame($o, $o); |
|
| 1477 | 1477 | |
| 1478 | - $this->expectException(AssertionFailedError::class); |
|
| 1478 | + $this->expectException(AssertionFailedError::class); |
|
| 1479 | 1479 | |
| 1480 | - $this->assertSame(new \stdClass, new \stdClass); |
|
| 1481 | - } |
|
| 1480 | + $this->assertSame(new \stdClass, new \stdClass); |
|
| 1481 | + } |
|
| 1482 | 1482 | |
| 1483 | - public function testAssertSame2() |
|
| 1484 | - { |
|
| 1485 | - $this->assertSame(true, true); |
|
| 1486 | - $this->assertSame(false, false); |
|
| 1483 | + public function testAssertSame2() |
|
| 1484 | + { |
|
| 1485 | + $this->assertSame(true, true); |
|
| 1486 | + $this->assertSame(false, false); |
|
| 1487 | 1487 | |
| 1488 | - $this->expectException(AssertionFailedError::class); |
|
| 1488 | + $this->expectException(AssertionFailedError::class); |
|
| 1489 | 1489 | |
| 1490 | - $this->assertSame(true, false); |
|
| 1491 | - } |
|
| 1490 | + $this->assertSame(true, false); |
|
| 1491 | + } |
|
| 1492 | 1492 | |
| 1493 | - public function testAssertNotSame() |
|
| 1494 | - { |
|
| 1495 | - $this->assertNotSame( |
|
| 1496 | - new \stdClass, |
|
| 1497 | - null |
|
| 1498 | - ); |
|
| 1493 | + public function testAssertNotSame() |
|
| 1494 | + { |
|
| 1495 | + $this->assertNotSame( |
|
| 1496 | + new \stdClass, |
|
| 1497 | + null |
|
| 1498 | + ); |
|
| 1499 | 1499 | |
| 1500 | - $this->assertNotSame( |
|
| 1501 | - null, |
|
| 1502 | - new \stdClass |
|
| 1503 | - ); |
|
| 1500 | + $this->assertNotSame( |
|
| 1501 | + null, |
|
| 1502 | + new \stdClass |
|
| 1503 | + ); |
|
| 1504 | 1504 | |
| 1505 | - $this->assertNotSame( |
|
| 1506 | - new \stdClass, |
|
| 1507 | - new \stdClass |
|
| 1508 | - ); |
|
| 1505 | + $this->assertNotSame( |
|
| 1506 | + new \stdClass, |
|
| 1507 | + new \stdClass |
|
| 1508 | + ); |
|
| 1509 | 1509 | |
| 1510 | - $o = new \stdClass; |
|
| 1510 | + $o = new \stdClass; |
|
| 1511 | 1511 | |
| 1512 | - $this->expectException(AssertionFailedError::class); |
|
| 1512 | + $this->expectException(AssertionFailedError::class); |
|
| 1513 | 1513 | |
| 1514 | - $this->assertNotSame($o, $o); |
|
| 1515 | - } |
|
| 1514 | + $this->assertNotSame($o, $o); |
|
| 1515 | + } |
|
| 1516 | 1516 | |
| 1517 | - public function testAssertNotSame2() |
|
| 1518 | - { |
|
| 1519 | - $this->assertNotSame(true, false); |
|
| 1520 | - $this->assertNotSame(false, true); |
|
| 1517 | + public function testAssertNotSame2() |
|
| 1518 | + { |
|
| 1519 | + $this->assertNotSame(true, false); |
|
| 1520 | + $this->assertNotSame(false, true); |
|
| 1521 | 1521 | |
| 1522 | - $this->expectException(AssertionFailedError::class); |
|
| 1522 | + $this->expectException(AssertionFailedError::class); |
|
| 1523 | 1523 | |
| 1524 | - $this->assertNotSame(true, true); |
|
| 1525 | - } |
|
| 1524 | + $this->assertNotSame(true, true); |
|
| 1525 | + } |
|
| 1526 | 1526 | |
| 1527 | - public function testAssertNotSameFailsNull() |
|
| 1528 | - { |
|
| 1529 | - $this->expectException(AssertionFailedError::class); |
|
| 1527 | + public function testAssertNotSameFailsNull() |
|
| 1528 | + { |
|
| 1529 | + $this->expectException(AssertionFailedError::class); |
|
| 1530 | 1530 | |
| 1531 | - $this->assertNotSame(null, null); |
|
| 1532 | - } |
|
| 1531 | + $this->assertNotSame(null, null); |
|
| 1532 | + } |
|
| 1533 | 1533 | |
| 1534 | - public function testGreaterThan() |
|
| 1535 | - { |
|
| 1536 | - $this->assertGreaterThan(1, 2); |
|
| 1534 | + public function testGreaterThan() |
|
| 1535 | + { |
|
| 1536 | + $this->assertGreaterThan(1, 2); |
|
| 1537 | 1537 | |
| 1538 | - $this->expectException(AssertionFailedError::class); |
|
| 1538 | + $this->expectException(AssertionFailedError::class); |
|
| 1539 | 1539 | |
| 1540 | - $this->assertGreaterThan(2, 1); |
|
| 1541 | - } |
|
| 1540 | + $this->assertGreaterThan(2, 1); |
|
| 1541 | + } |
|
| 1542 | 1542 | |
| 1543 | - public function testAttributeGreaterThan() |
|
| 1544 | - { |
|
| 1545 | - $this->assertAttributeGreaterThan( |
|
| 1546 | - 1, |
|
| 1547 | - 'bar', |
|
| 1548 | - new \ClassWithNonPublicAttributes |
|
| 1549 | - ); |
|
| 1543 | + public function testAttributeGreaterThan() |
|
| 1544 | + { |
|
| 1545 | + $this->assertAttributeGreaterThan( |
|
| 1546 | + 1, |
|
| 1547 | + 'bar', |
|
| 1548 | + new \ClassWithNonPublicAttributes |
|
| 1549 | + ); |
|
| 1550 | 1550 | |
| 1551 | - $this->expectException(AssertionFailedError::class); |
|
| 1551 | + $this->expectException(AssertionFailedError::class); |
|
| 1552 | 1552 | |
| 1553 | - $this->assertAttributeGreaterThan( |
|
| 1554 | - 1, |
|
| 1555 | - 'foo', |
|
| 1556 | - new \ClassWithNonPublicAttributes |
|
| 1557 | - ); |
|
| 1558 | - } |
|
| 1559 | - |
|
| 1560 | - public function testGreaterThanOrEqual() |
|
| 1561 | - { |
|
| 1562 | - $this->assertGreaterThanOrEqual(1, 2); |
|
| 1563 | - |
|
| 1564 | - $this->expectException(AssertionFailedError::class); |
|
| 1565 | - |
|
| 1566 | - $this->assertGreaterThanOrEqual(2, 1); |
|
| 1567 | - } |
|
| 1568 | - |
|
| 1569 | - public function testAttributeGreaterThanOrEqual() |
|
| 1570 | - { |
|
| 1571 | - $this->assertAttributeGreaterThanOrEqual( |
|
| 1572 | - 1, |
|
| 1573 | - 'bar', |
|
| 1574 | - new \ClassWithNonPublicAttributes |
|
| 1575 | - ); |
|
| 1576 | - |
|
| 1577 | - $this->expectException(AssertionFailedError::class); |
|
| 1578 | - |
|
| 1579 | - $this->assertAttributeGreaterThanOrEqual( |
|
| 1580 | - 2, |
|
| 1581 | - 'foo', |
|
| 1582 | - new \ClassWithNonPublicAttributes |
|
| 1583 | - ); |
|
| 1584 | - } |
|
| 1585 | - |
|
| 1586 | - public function testLessThan() |
|
| 1587 | - { |
|
| 1588 | - $this->assertLessThan(2, 1); |
|
| 1589 | - |
|
| 1590 | - try { |
|
| 1591 | - $this->assertLessThan(1, 2); |
|
| 1592 | - } catch (AssertionFailedError $e) { |
|
| 1593 | - return; |
|
| 1594 | - } |
|
| 1595 | - |
|
| 1596 | - $this->fail(); |
|
| 1597 | - } |
|
| 1598 | - |
|
| 1599 | - public function testAttributeLessThan() |
|
| 1600 | - { |
|
| 1601 | - $this->assertAttributeLessThan( |
|
| 1602 | - 2, |
|
| 1603 | - 'foo', |
|
| 1604 | - new \ClassWithNonPublicAttributes |
|
| 1605 | - ); |
|
| 1606 | - |
|
| 1607 | - $this->expectException(AssertionFailedError::class); |
|
| 1608 | - |
|
| 1609 | - $this->assertAttributeLessThan( |
|
| 1610 | - 1, |
|
| 1611 | - 'bar', |
|
| 1612 | - new \ClassWithNonPublicAttributes |
|
| 1613 | - ); |
|
| 1614 | - } |
|
| 1615 | - |
|
| 1616 | - public function testLessThanOrEqual() |
|
| 1617 | - { |
|
| 1618 | - $this->assertLessThanOrEqual(2, 1); |
|
| 1619 | - |
|
| 1620 | - $this->expectException(AssertionFailedError::class); |
|
| 1621 | - |
|
| 1622 | - $this->assertLessThanOrEqual(1, 2); |
|
| 1623 | - } |
|
| 1624 | - |
|
| 1625 | - public function testAttributeLessThanOrEqual() |
|
| 1626 | - { |
|
| 1627 | - $this->assertAttributeLessThanOrEqual( |
|
| 1628 | - 2, |
|
| 1629 | - 'foo', |
|
| 1630 | - new \ClassWithNonPublicAttributes |
|
| 1631 | - ); |
|
| 1632 | - |
|
| 1633 | - $this->expectException(AssertionFailedError::class); |
|
| 1634 | - |
|
| 1635 | - $this->assertAttributeLessThanOrEqual( |
|
| 1636 | - 1, |
|
| 1637 | - 'bar', |
|
| 1638 | - new \ClassWithNonPublicAttributes |
|
| 1639 | - ); |
|
| 1640 | - } |
|
| 1641 | - |
|
| 1642 | - public function testReadAttribute() |
|
| 1643 | - { |
|
| 1644 | - $obj = new \ClassWithNonPublicAttributes; |
|
| 1645 | - |
|
| 1646 | - $this->assertEquals('foo', $this->readAttribute($obj, 'publicAttribute')); |
|
| 1647 | - $this->assertEquals('bar', $this->readAttribute($obj, 'protectedAttribute')); |
|
| 1648 | - $this->assertEquals('baz', $this->readAttribute($obj, 'privateAttribute')); |
|
| 1649 | - $this->assertEquals('bar', $this->readAttribute($obj, 'protectedParentAttribute')); |
|
| 1650 | - //$this->assertEquals('bar', $this->readAttribute($obj, 'privateParentAttribute')); |
|
| 1651 | - } |
|
| 1652 | - |
|
| 1653 | - public function testReadAttribute2() |
|
| 1654 | - { |
|
| 1655 | - $this->assertEquals('foo', $this->readAttribute(\ClassWithNonPublicAttributes::class, 'publicStaticAttribute')); |
|
| 1656 | - $this->assertEquals('bar', $this->readAttribute(\ClassWithNonPublicAttributes::class, 'protectedStaticAttribute')); |
|
| 1657 | - $this->assertEquals('baz', $this->readAttribute(\ClassWithNonPublicAttributes::class, 'privateStaticAttribute')); |
|
| 1658 | - $this->assertEquals('foo', $this->readAttribute(\ClassWithNonPublicAttributes::class, 'protectedStaticParentAttribute')); |
|
| 1659 | - $this->assertEquals('foo', $this->readAttribute(\ClassWithNonPublicAttributes::class, 'privateStaticParentAttribute')); |
|
| 1660 | - } |
|
| 1661 | - |
|
| 1662 | - public function testReadAttribute3() |
|
| 1663 | - { |
|
| 1664 | - $this->expectException(Exception::class); |
|
| 1665 | - |
|
| 1666 | - $this->readAttribute('StdClass', null); |
|
| 1667 | - } |
|
| 1668 | - |
|
| 1669 | - public function testReadAttribute4() |
|
| 1670 | - { |
|
| 1671 | - $this->expectException(Exception::class); |
|
| 1672 | - |
|
| 1673 | - $this->readAttribute('NotExistingClass', 'foo'); |
|
| 1674 | - } |
|
| 1553 | + $this->assertAttributeGreaterThan( |
|
| 1554 | + 1, |
|
| 1555 | + 'foo', |
|
| 1556 | + new \ClassWithNonPublicAttributes |
|
| 1557 | + ); |
|
| 1558 | + } |
|
| 1559 | + |
|
| 1560 | + public function testGreaterThanOrEqual() |
|
| 1561 | + { |
|
| 1562 | + $this->assertGreaterThanOrEqual(1, 2); |
|
| 1563 | + |
|
| 1564 | + $this->expectException(AssertionFailedError::class); |
|
| 1565 | + |
|
| 1566 | + $this->assertGreaterThanOrEqual(2, 1); |
|
| 1567 | + } |
|
| 1568 | + |
|
| 1569 | + public function testAttributeGreaterThanOrEqual() |
|
| 1570 | + { |
|
| 1571 | + $this->assertAttributeGreaterThanOrEqual( |
|
| 1572 | + 1, |
|
| 1573 | + 'bar', |
|
| 1574 | + new \ClassWithNonPublicAttributes |
|
| 1575 | + ); |
|
| 1576 | + |
|
| 1577 | + $this->expectException(AssertionFailedError::class); |
|
| 1578 | + |
|
| 1579 | + $this->assertAttributeGreaterThanOrEqual( |
|
| 1580 | + 2, |
|
| 1581 | + 'foo', |
|
| 1582 | + new \ClassWithNonPublicAttributes |
|
| 1583 | + ); |
|
| 1584 | + } |
|
| 1585 | + |
|
| 1586 | + public function testLessThan() |
|
| 1587 | + { |
|
| 1588 | + $this->assertLessThan(2, 1); |
|
| 1589 | + |
|
| 1590 | + try { |
|
| 1591 | + $this->assertLessThan(1, 2); |
|
| 1592 | + } catch (AssertionFailedError $e) { |
|
| 1593 | + return; |
|
| 1594 | + } |
|
| 1595 | + |
|
| 1596 | + $this->fail(); |
|
| 1597 | + } |
|
| 1598 | + |
|
| 1599 | + public function testAttributeLessThan() |
|
| 1600 | + { |
|
| 1601 | + $this->assertAttributeLessThan( |
|
| 1602 | + 2, |
|
| 1603 | + 'foo', |
|
| 1604 | + new \ClassWithNonPublicAttributes |
|
| 1605 | + ); |
|
| 1606 | + |
|
| 1607 | + $this->expectException(AssertionFailedError::class); |
|
| 1608 | + |
|
| 1609 | + $this->assertAttributeLessThan( |
|
| 1610 | + 1, |
|
| 1611 | + 'bar', |
|
| 1612 | + new \ClassWithNonPublicAttributes |
|
| 1613 | + ); |
|
| 1614 | + } |
|
| 1615 | + |
|
| 1616 | + public function testLessThanOrEqual() |
|
| 1617 | + { |
|
| 1618 | + $this->assertLessThanOrEqual(2, 1); |
|
| 1619 | + |
|
| 1620 | + $this->expectException(AssertionFailedError::class); |
|
| 1621 | + |
|
| 1622 | + $this->assertLessThanOrEqual(1, 2); |
|
| 1623 | + } |
|
| 1624 | + |
|
| 1625 | + public function testAttributeLessThanOrEqual() |
|
| 1626 | + { |
|
| 1627 | + $this->assertAttributeLessThanOrEqual( |
|
| 1628 | + 2, |
|
| 1629 | + 'foo', |
|
| 1630 | + new \ClassWithNonPublicAttributes |
|
| 1631 | + ); |
|
| 1632 | + |
|
| 1633 | + $this->expectException(AssertionFailedError::class); |
|
| 1634 | + |
|
| 1635 | + $this->assertAttributeLessThanOrEqual( |
|
| 1636 | + 1, |
|
| 1637 | + 'bar', |
|
| 1638 | + new \ClassWithNonPublicAttributes |
|
| 1639 | + ); |
|
| 1640 | + } |
|
| 1641 | + |
|
| 1642 | + public function testReadAttribute() |
|
| 1643 | + { |
|
| 1644 | + $obj = new \ClassWithNonPublicAttributes; |
|
| 1645 | + |
|
| 1646 | + $this->assertEquals('foo', $this->readAttribute($obj, 'publicAttribute')); |
|
| 1647 | + $this->assertEquals('bar', $this->readAttribute($obj, 'protectedAttribute')); |
|
| 1648 | + $this->assertEquals('baz', $this->readAttribute($obj, 'privateAttribute')); |
|
| 1649 | + $this->assertEquals('bar', $this->readAttribute($obj, 'protectedParentAttribute')); |
|
| 1650 | + //$this->assertEquals('bar', $this->readAttribute($obj, 'privateParentAttribute')); |
|
| 1651 | + } |
|
| 1652 | + |
|
| 1653 | + public function testReadAttribute2() |
|
| 1654 | + { |
|
| 1655 | + $this->assertEquals('foo', $this->readAttribute(\ClassWithNonPublicAttributes::class, 'publicStaticAttribute')); |
|
| 1656 | + $this->assertEquals('bar', $this->readAttribute(\ClassWithNonPublicAttributes::class, 'protectedStaticAttribute')); |
|
| 1657 | + $this->assertEquals('baz', $this->readAttribute(\ClassWithNonPublicAttributes::class, 'privateStaticAttribute')); |
|
| 1658 | + $this->assertEquals('foo', $this->readAttribute(\ClassWithNonPublicAttributes::class, 'protectedStaticParentAttribute')); |
|
| 1659 | + $this->assertEquals('foo', $this->readAttribute(\ClassWithNonPublicAttributes::class, 'privateStaticParentAttribute')); |
|
| 1660 | + } |
|
| 1661 | + |
|
| 1662 | + public function testReadAttribute3() |
|
| 1663 | + { |
|
| 1664 | + $this->expectException(Exception::class); |
|
| 1665 | + |
|
| 1666 | + $this->readAttribute('StdClass', null); |
|
| 1667 | + } |
|
| 1668 | + |
|
| 1669 | + public function testReadAttribute4() |
|
| 1670 | + { |
|
| 1671 | + $this->expectException(Exception::class); |
|
| 1672 | + |
|
| 1673 | + $this->readAttribute('NotExistingClass', 'foo'); |
|
| 1674 | + } |
|
| 1675 | 1675 | |
| 1676 | - public function testReadAttribute5() |
|
| 1677 | - { |
|
| 1678 | - $this->expectException(Exception::class); |
|
| 1676 | + public function testReadAttribute5() |
|
| 1677 | + { |
|
| 1678 | + $this->expectException(Exception::class); |
|
| 1679 | 1679 | |
| 1680 | - $this->readAttribute(null, 'foo'); |
|
| 1681 | - } |
|
| 1680 | + $this->readAttribute(null, 'foo'); |
|
| 1681 | + } |
|
| 1682 | 1682 | |
| 1683 | - public function testReadAttributeIfAttributeNameIsNotValid() |
|
| 1684 | - { |
|
| 1685 | - $this->expectException(Exception::class); |
|
| 1683 | + public function testReadAttributeIfAttributeNameIsNotValid() |
|
| 1684 | + { |
|
| 1685 | + $this->expectException(Exception::class); |
|
| 1686 | 1686 | |
| 1687 | - $this->readAttribute(\stdClass::class, '2'); |
|
| 1688 | - } |
|
| 1687 | + $this->readAttribute(\stdClass::class, '2'); |
|
| 1688 | + } |
|
| 1689 | 1689 | |
| 1690 | - public function testGetStaticAttributeRaisesExceptionForInvalidFirstArgument() |
|
| 1691 | - { |
|
| 1692 | - $this->expectException(Exception::class); |
|
| 1690 | + public function testGetStaticAttributeRaisesExceptionForInvalidFirstArgument() |
|
| 1691 | + { |
|
| 1692 | + $this->expectException(Exception::class); |
|
| 1693 | 1693 | |
| 1694 | - $this->getStaticAttribute(null, 'foo'); |
|
| 1695 | - } |
|
| 1694 | + $this->getStaticAttribute(null, 'foo'); |
|
| 1695 | + } |
|
| 1696 | 1696 | |
| 1697 | - public function testGetStaticAttributeRaisesExceptionForInvalidFirstArgument2() |
|
| 1698 | - { |
|
| 1699 | - $this->expectException(Exception::class); |
|
| 1697 | + public function testGetStaticAttributeRaisesExceptionForInvalidFirstArgument2() |
|
| 1698 | + { |
|
| 1699 | + $this->expectException(Exception::class); |
|
| 1700 | 1700 | |
| 1701 | - $this->getStaticAttribute('NotExistingClass', 'foo'); |
|
| 1702 | - } |
|
| 1701 | + $this->getStaticAttribute('NotExistingClass', 'foo'); |
|
| 1702 | + } |
|
| 1703 | 1703 | |
| 1704 | - public function testGetStaticAttributeRaisesExceptionForInvalidSecondArgument() |
|
| 1705 | - { |
|
| 1706 | - $this->expectException(Exception::class); |
|
| 1704 | + public function testGetStaticAttributeRaisesExceptionForInvalidSecondArgument() |
|
| 1705 | + { |
|
| 1706 | + $this->expectException(Exception::class); |
|
| 1707 | 1707 | |
| 1708 | - $this->getStaticAttribute(\stdClass::class, null); |
|
| 1709 | - } |
|
| 1708 | + $this->getStaticAttribute(\stdClass::class, null); |
|
| 1709 | + } |
|
| 1710 | 1710 | |
| 1711 | - public function testGetStaticAttributeRaisesExceptionForInvalidSecondArgument2() |
|
| 1712 | - { |
|
| 1713 | - $this->expectException(Exception::class); |
|
| 1711 | + public function testGetStaticAttributeRaisesExceptionForInvalidSecondArgument2() |
|
| 1712 | + { |
|
| 1713 | + $this->expectException(Exception::class); |
|
| 1714 | 1714 | |
| 1715 | - $this->getStaticAttribute(\stdClass::class, '0'); |
|
| 1716 | - } |
|
| 1715 | + $this->getStaticAttribute(\stdClass::class, '0'); |
|
| 1716 | + } |
|
| 1717 | 1717 | |
| 1718 | - public function testGetStaticAttributeRaisesExceptionForInvalidSecondArgument3() |
|
| 1719 | - { |
|
| 1720 | - $this->expectException(Exception::class); |
|
| 1718 | + public function testGetStaticAttributeRaisesExceptionForInvalidSecondArgument3() |
|
| 1719 | + { |
|
| 1720 | + $this->expectException(Exception::class); |
|
| 1721 | 1721 | |
| 1722 | - $this->getStaticAttribute(\stdClass::class, 'foo'); |
|
| 1723 | - } |
|
| 1722 | + $this->getStaticAttribute(\stdClass::class, 'foo'); |
|
| 1723 | + } |
|
| 1724 | 1724 | |
| 1725 | - public function testGetObjectAttributeRaisesExceptionForInvalidFirstArgument() |
|
| 1726 | - { |
|
| 1727 | - $this->expectException(Exception::class); |
|
| 1725 | + public function testGetObjectAttributeRaisesExceptionForInvalidFirstArgument() |
|
| 1726 | + { |
|
| 1727 | + $this->expectException(Exception::class); |
|
| 1728 | 1728 | |
| 1729 | - $this->getObjectAttribute(null, 'foo'); |
|
| 1730 | - } |
|
| 1729 | + $this->getObjectAttribute(null, 'foo'); |
|
| 1730 | + } |
|
| 1731 | 1731 | |
| 1732 | - public function testGetObjectAttributeRaisesExceptionForInvalidSecondArgument() |
|
| 1733 | - { |
|
| 1734 | - $this->expectException(Exception::class); |
|
| 1732 | + public function testGetObjectAttributeRaisesExceptionForInvalidSecondArgument() |
|
| 1733 | + { |
|
| 1734 | + $this->expectException(Exception::class); |
|
| 1735 | 1735 | |
| 1736 | - $this->getObjectAttribute(new \stdClass, null); |
|
| 1737 | - } |
|
| 1736 | + $this->getObjectAttribute(new \stdClass, null); |
|
| 1737 | + } |
|
| 1738 | 1738 | |
| 1739 | - public function testGetObjectAttributeRaisesExceptionForInvalidSecondArgument2() |
|
| 1740 | - { |
|
| 1741 | - $this->expectException(Exception::class); |
|
| 1739 | + public function testGetObjectAttributeRaisesExceptionForInvalidSecondArgument2() |
|
| 1740 | + { |
|
| 1741 | + $this->expectException(Exception::class); |
|
| 1742 | 1742 | |
| 1743 | - $this->getObjectAttribute(new \stdClass, '0'); |
|
| 1744 | - } |
|
| 1743 | + $this->getObjectAttribute(new \stdClass, '0'); |
|
| 1744 | + } |
|
| 1745 | 1745 | |
| 1746 | - public function testGetObjectAttributeRaisesExceptionForInvalidSecondArgument3() |
|
| 1747 | - { |
|
| 1748 | - $this->expectException(Exception::class); |
|
| 1746 | + public function testGetObjectAttributeRaisesExceptionForInvalidSecondArgument3() |
|
| 1747 | + { |
|
| 1748 | + $this->expectException(Exception::class); |
|
| 1749 | 1749 | |
| 1750 | - $this->getObjectAttribute(new \stdClass, 'foo'); |
|
| 1751 | - } |
|
| 1750 | + $this->getObjectAttribute(new \stdClass, 'foo'); |
|
| 1751 | + } |
|
| 1752 | 1752 | |
| 1753 | - public function testGetObjectAttributeWorksForInheritedAttributes() |
|
| 1754 | - { |
|
| 1755 | - $this->assertEquals( |
|
| 1756 | - 'bar', |
|
| 1757 | - $this->getObjectAttribute(new \ClassWithNonPublicAttributes, 'privateParentAttribute') |
|
| 1758 | - ); |
|
| 1759 | - } |
|
| 1753 | + public function testGetObjectAttributeWorksForInheritedAttributes() |
|
| 1754 | + { |
|
| 1755 | + $this->assertEquals( |
|
| 1756 | + 'bar', |
|
| 1757 | + $this->getObjectAttribute(new \ClassWithNonPublicAttributes, 'privateParentAttribute') |
|
| 1758 | + ); |
|
| 1759 | + } |
|
| 1760 | 1760 | |
| 1761 | - public function testAssertPublicAttributeContains() |
|
| 1762 | - { |
|
| 1763 | - $obj = new \ClassWithNonPublicAttributes; |
|
| 1761 | + public function testAssertPublicAttributeContains() |
|
| 1762 | + { |
|
| 1763 | + $obj = new \ClassWithNonPublicAttributes; |
|
| 1764 | 1764 | |
| 1765 | - $this->assertAttributeContains('foo', 'publicArray', $obj); |
|
| 1765 | + $this->assertAttributeContains('foo', 'publicArray', $obj); |
|
| 1766 | 1766 | |
| 1767 | - $this->expectException(AssertionFailedError::class); |
|
| 1767 | + $this->expectException(AssertionFailedError::class); |
|
| 1768 | 1768 | |
| 1769 | - $this->assertAttributeContains('bar', 'publicArray', $obj); |
|
| 1770 | - } |
|
| 1769 | + $this->assertAttributeContains('bar', 'publicArray', $obj); |
|
| 1770 | + } |
|
| 1771 | 1771 | |
| 1772 | - public function testAssertPublicAttributeContainsOnly() |
|
| 1773 | - { |
|
| 1774 | - $obj = new \ClassWithNonPublicAttributes; |
|
| 1772 | + public function testAssertPublicAttributeContainsOnly() |
|
| 1773 | + { |
|
| 1774 | + $obj = new \ClassWithNonPublicAttributes; |
|
| 1775 | 1775 | |
| 1776 | - $this->assertAttributeContainsOnly('string', 'publicArray', $obj); |
|
| 1776 | + $this->assertAttributeContainsOnly('string', 'publicArray', $obj); |
|
| 1777 | 1777 | |
| 1778 | - $this->expectException(AssertionFailedError::class); |
|
| 1778 | + $this->expectException(AssertionFailedError::class); |
|
| 1779 | 1779 | |
| 1780 | - $this->assertAttributeContainsOnly('integer', 'publicArray', $obj); |
|
| 1781 | - } |
|
| 1780 | + $this->assertAttributeContainsOnly('integer', 'publicArray', $obj); |
|
| 1781 | + } |
|
| 1782 | 1782 | |
| 1783 | - public function testAssertPublicAttributeNotContains() |
|
| 1784 | - { |
|
| 1785 | - $obj = new \ClassWithNonPublicAttributes; |
|
| 1783 | + public function testAssertPublicAttributeNotContains() |
|
| 1784 | + { |
|
| 1785 | + $obj = new \ClassWithNonPublicAttributes; |
|
| 1786 | 1786 | |
| 1787 | - $this->assertAttributeNotContains('bar', 'publicArray', $obj); |
|
| 1787 | + $this->assertAttributeNotContains('bar', 'publicArray', $obj); |
|
| 1788 | 1788 | |
| 1789 | - $this->expectException(AssertionFailedError::class); |
|
| 1789 | + $this->expectException(AssertionFailedError::class); |
|
| 1790 | 1790 | |
| 1791 | - $this->assertAttributeNotContains('foo', 'publicArray', $obj); |
|
| 1792 | - } |
|
| 1791 | + $this->assertAttributeNotContains('foo', 'publicArray', $obj); |
|
| 1792 | + } |
|
| 1793 | 1793 | |
| 1794 | - public function testAssertPublicAttributeNotContainsOnly() |
|
| 1795 | - { |
|
| 1796 | - $obj = new \ClassWithNonPublicAttributes; |
|
| 1794 | + public function testAssertPublicAttributeNotContainsOnly() |
|
| 1795 | + { |
|
| 1796 | + $obj = new \ClassWithNonPublicAttributes; |
|
| 1797 | 1797 | |
| 1798 | - $this->assertAttributeNotContainsOnly('integer', 'publicArray', $obj); |
|
| 1798 | + $this->assertAttributeNotContainsOnly('integer', 'publicArray', $obj); |
|
| 1799 | 1799 | |
| 1800 | - $this->expectException(AssertionFailedError::class); |
|
| 1800 | + $this->expectException(AssertionFailedError::class); |
|
| 1801 | 1801 | |
| 1802 | - $this->assertAttributeNotContainsOnly('string', 'publicArray', $obj); |
|
| 1803 | - } |
|
| 1802 | + $this->assertAttributeNotContainsOnly('string', 'publicArray', $obj); |
|
| 1803 | + } |
|
| 1804 | 1804 | |
| 1805 | - public function testAssertProtectedAttributeContains() |
|
| 1806 | - { |
|
| 1807 | - $obj = new \ClassWithNonPublicAttributes; |
|
| 1805 | + public function testAssertProtectedAttributeContains() |
|
| 1806 | + { |
|
| 1807 | + $obj = new \ClassWithNonPublicAttributes; |
|
| 1808 | 1808 | |
| 1809 | - $this->assertAttributeContains('bar', 'protectedArray', $obj); |
|
| 1809 | + $this->assertAttributeContains('bar', 'protectedArray', $obj); |
|
| 1810 | 1810 | |
| 1811 | - $this->expectException(AssertionFailedError::class); |
|
| 1811 | + $this->expectException(AssertionFailedError::class); |
|
| 1812 | 1812 | |
| 1813 | - $this->assertAttributeContains('foo', 'protectedArray', $obj); |
|
| 1814 | - } |
|
| 1813 | + $this->assertAttributeContains('foo', 'protectedArray', $obj); |
|
| 1814 | + } |
|
| 1815 | 1815 | |
| 1816 | - public function testAssertProtectedAttributeNotContains() |
|
| 1817 | - { |
|
| 1818 | - $obj = new \ClassWithNonPublicAttributes; |
|
| 1816 | + public function testAssertProtectedAttributeNotContains() |
|
| 1817 | + { |
|
| 1818 | + $obj = new \ClassWithNonPublicAttributes; |
|
| 1819 | 1819 | |
| 1820 | - $this->assertAttributeNotContains('foo', 'protectedArray', $obj); |
|
| 1820 | + $this->assertAttributeNotContains('foo', 'protectedArray', $obj); |
|
| 1821 | 1821 | |
| 1822 | - $this->expectException(AssertionFailedError::class); |
|
| 1822 | + $this->expectException(AssertionFailedError::class); |
|
| 1823 | 1823 | |
| 1824 | - $this->assertAttributeNotContains('bar', 'protectedArray', $obj); |
|
| 1825 | - } |
|
| 1824 | + $this->assertAttributeNotContains('bar', 'protectedArray', $obj); |
|
| 1825 | + } |
|
| 1826 | 1826 | |
| 1827 | - public function testAssertPrivateAttributeContains() |
|
| 1828 | - { |
|
| 1829 | - $obj = new \ClassWithNonPublicAttributes; |
|
| 1827 | + public function testAssertPrivateAttributeContains() |
|
| 1828 | + { |
|
| 1829 | + $obj = new \ClassWithNonPublicAttributes; |
|
| 1830 | 1830 | |
| 1831 | - $this->assertAttributeContains('baz', 'privateArray', $obj); |
|
| 1831 | + $this->assertAttributeContains('baz', 'privateArray', $obj); |
|
| 1832 | 1832 | |
| 1833 | - $this->expectException(AssertionFailedError::class); |
|
| 1833 | + $this->expectException(AssertionFailedError::class); |
|
| 1834 | 1834 | |
| 1835 | - $this->assertAttributeContains('foo', 'privateArray', $obj); |
|
| 1836 | - } |
|
| 1835 | + $this->assertAttributeContains('foo', 'privateArray', $obj); |
|
| 1836 | + } |
|
| 1837 | 1837 | |
| 1838 | - public function testAssertPrivateAttributeNotContains() |
|
| 1839 | - { |
|
| 1840 | - $obj = new \ClassWithNonPublicAttributes; |
|
| 1838 | + public function testAssertPrivateAttributeNotContains() |
|
| 1839 | + { |
|
| 1840 | + $obj = new \ClassWithNonPublicAttributes; |
|
| 1841 | 1841 | |
| 1842 | - $this->assertAttributeNotContains('foo', 'privateArray', $obj); |
|
| 1842 | + $this->assertAttributeNotContains('foo', 'privateArray', $obj); |
|
| 1843 | 1843 | |
| 1844 | - $this->expectException(AssertionFailedError::class); |
|
| 1844 | + $this->expectException(AssertionFailedError::class); |
|
| 1845 | 1845 | |
| 1846 | - $this->assertAttributeNotContains('baz', 'privateArray', $obj); |
|
| 1847 | - } |
|
| 1846 | + $this->assertAttributeNotContains('baz', 'privateArray', $obj); |
|
| 1847 | + } |
|
| 1848 | 1848 | |
| 1849 | - public function testAssertAttributeContainsNonObject() |
|
| 1850 | - { |
|
| 1851 | - $obj = new \ClassWithNonPublicAttributes; |
|
| 1849 | + public function testAssertAttributeContainsNonObject() |
|
| 1850 | + { |
|
| 1851 | + $obj = new \ClassWithNonPublicAttributes; |
|
| 1852 | 1852 | |
| 1853 | - $this->assertAttributeContains(true, 'privateArray', $obj); |
|
| 1853 | + $this->assertAttributeContains(true, 'privateArray', $obj); |
|
| 1854 | 1854 | |
| 1855 | - $this->expectException(AssertionFailedError::class); |
|
| 1855 | + $this->expectException(AssertionFailedError::class); |
|
| 1856 | 1856 | |
| 1857 | - $this->assertAttributeContains(true, 'privateArray', $obj, '', false, true, true); |
|
| 1858 | - } |
|
| 1857 | + $this->assertAttributeContains(true, 'privateArray', $obj, '', false, true, true); |
|
| 1858 | + } |
|
| 1859 | 1859 | |
| 1860 | - public function testAssertAttributeNotContainsNonObject() |
|
| 1861 | - { |
|
| 1862 | - $obj = new \ClassWithNonPublicAttributes; |
|
| 1860 | + public function testAssertAttributeNotContainsNonObject() |
|
| 1861 | + { |
|
| 1862 | + $obj = new \ClassWithNonPublicAttributes; |
|
| 1863 | 1863 | |
| 1864 | - $this->assertAttributeNotContains(true, 'privateArray', $obj, '', false, true, true); |
|
| 1864 | + $this->assertAttributeNotContains(true, 'privateArray', $obj, '', false, true, true); |
|
| 1865 | 1865 | |
| 1866 | - $this->expectException(AssertionFailedError::class); |
|
| 1866 | + $this->expectException(AssertionFailedError::class); |
|
| 1867 | 1867 | |
| 1868 | - $this->assertAttributeNotContains(true, 'privateArray', $obj); |
|
| 1869 | - } |
|
| 1868 | + $this->assertAttributeNotContains(true, 'privateArray', $obj); |
|
| 1869 | + } |
|
| 1870 | 1870 | |
| 1871 | - public function testAssertPublicAttributeEquals() |
|
| 1872 | - { |
|
| 1873 | - $obj = new \ClassWithNonPublicAttributes; |
|
| 1871 | + public function testAssertPublicAttributeEquals() |
|
| 1872 | + { |
|
| 1873 | + $obj = new \ClassWithNonPublicAttributes; |
|
| 1874 | 1874 | |
| 1875 | - $this->assertAttributeEquals('foo', 'publicAttribute', $obj); |
|
| 1875 | + $this->assertAttributeEquals('foo', 'publicAttribute', $obj); |
|
| 1876 | 1876 | |
| 1877 | - $this->expectException(AssertionFailedError::class); |
|
| 1877 | + $this->expectException(AssertionFailedError::class); |
|
| 1878 | 1878 | |
| 1879 | - $this->assertAttributeEquals('bar', 'publicAttribute', $obj); |
|
| 1880 | - } |
|
| 1879 | + $this->assertAttributeEquals('bar', 'publicAttribute', $obj); |
|
| 1880 | + } |
|
| 1881 | 1881 | |
| 1882 | - public function testAssertPublicAttributeNotEquals() |
|
| 1883 | - { |
|
| 1884 | - $obj = new \ClassWithNonPublicAttributes; |
|
| 1882 | + public function testAssertPublicAttributeNotEquals() |
|
| 1883 | + { |
|
| 1884 | + $obj = new \ClassWithNonPublicAttributes; |
|
| 1885 | 1885 | |
| 1886 | - $this->assertAttributeNotEquals('bar', 'publicAttribute', $obj); |
|
| 1886 | + $this->assertAttributeNotEquals('bar', 'publicAttribute', $obj); |
|
| 1887 | 1887 | |
| 1888 | - $this->expectException(AssertionFailedError::class); |
|
| 1888 | + $this->expectException(AssertionFailedError::class); |
|
| 1889 | 1889 | |
| 1890 | - $this->assertAttributeNotEquals('foo', 'publicAttribute', $obj); |
|
| 1891 | - } |
|
| 1890 | + $this->assertAttributeNotEquals('foo', 'publicAttribute', $obj); |
|
| 1891 | + } |
|
| 1892 | 1892 | |
| 1893 | - public function testAssertPublicAttributeSame() |
|
| 1894 | - { |
|
| 1895 | - $obj = new \ClassWithNonPublicAttributes; |
|
| 1893 | + public function testAssertPublicAttributeSame() |
|
| 1894 | + { |
|
| 1895 | + $obj = new \ClassWithNonPublicAttributes; |
|
| 1896 | 1896 | |
| 1897 | - $this->assertAttributeSame('foo', 'publicAttribute', $obj); |
|
| 1897 | + $this->assertAttributeSame('foo', 'publicAttribute', $obj); |
|
| 1898 | 1898 | |
| 1899 | - $this->expectException(AssertionFailedError::class); |
|
| 1899 | + $this->expectException(AssertionFailedError::class); |
|
| 1900 | 1900 | |
| 1901 | - $this->assertAttributeSame('bar', 'publicAttribute', $obj); |
|
| 1902 | - } |
|
| 1901 | + $this->assertAttributeSame('bar', 'publicAttribute', $obj); |
|
| 1902 | + } |
|
| 1903 | 1903 | |
| 1904 | - public function testAssertPublicAttributeNotSame() |
|
| 1905 | - { |
|
| 1906 | - $obj = new \ClassWithNonPublicAttributes; |
|
| 1904 | + public function testAssertPublicAttributeNotSame() |
|
| 1905 | + { |
|
| 1906 | + $obj = new \ClassWithNonPublicAttributes; |
|
| 1907 | 1907 | |
| 1908 | - $this->assertAttributeNotSame('bar', 'publicAttribute', $obj); |
|
| 1908 | + $this->assertAttributeNotSame('bar', 'publicAttribute', $obj); |
|
| 1909 | 1909 | |
| 1910 | - $this->expectException(AssertionFailedError::class); |
|
| 1910 | + $this->expectException(AssertionFailedError::class); |
|
| 1911 | 1911 | |
| 1912 | - $this->assertAttributeNotSame('foo', 'publicAttribute', $obj); |
|
| 1913 | - } |
|
| 1912 | + $this->assertAttributeNotSame('foo', 'publicAttribute', $obj); |
|
| 1913 | + } |
|
| 1914 | 1914 | |
| 1915 | - public function testAssertProtectedAttributeEquals() |
|
| 1916 | - { |
|
| 1917 | - $obj = new \ClassWithNonPublicAttributes; |
|
| 1915 | + public function testAssertProtectedAttributeEquals() |
|
| 1916 | + { |
|
| 1917 | + $obj = new \ClassWithNonPublicAttributes; |
|
| 1918 | 1918 | |
| 1919 | - $this->assertAttributeEquals('bar', 'protectedAttribute', $obj); |
|
| 1919 | + $this->assertAttributeEquals('bar', 'protectedAttribute', $obj); |
|
| 1920 | 1920 | |
| 1921 | - $this->expectException(AssertionFailedError::class); |
|
| 1921 | + $this->expectException(AssertionFailedError::class); |
|
| 1922 | 1922 | |
| 1923 | - $this->assertAttributeEquals('foo', 'protectedAttribute', $obj); |
|
| 1924 | - } |
|
| 1923 | + $this->assertAttributeEquals('foo', 'protectedAttribute', $obj); |
|
| 1924 | + } |
|
| 1925 | 1925 | |
| 1926 | - public function testAssertProtectedAttributeNotEquals() |
|
| 1927 | - { |
|
| 1928 | - $obj = new \ClassWithNonPublicAttributes; |
|
| 1926 | + public function testAssertProtectedAttributeNotEquals() |
|
| 1927 | + { |
|
| 1928 | + $obj = new \ClassWithNonPublicAttributes; |
|
| 1929 | 1929 | |
| 1930 | - $this->assertAttributeNotEquals('foo', 'protectedAttribute', $obj); |
|
| 1930 | + $this->assertAttributeNotEquals('foo', 'protectedAttribute', $obj); |
|
| 1931 | 1931 | |
| 1932 | - $this->expectException(AssertionFailedError::class); |
|
| 1932 | + $this->expectException(AssertionFailedError::class); |
|
| 1933 | 1933 | |
| 1934 | - $this->assertAttributeNotEquals('bar', 'protectedAttribute', $obj); |
|
| 1935 | - } |
|
| 1934 | + $this->assertAttributeNotEquals('bar', 'protectedAttribute', $obj); |
|
| 1935 | + } |
|
| 1936 | 1936 | |
| 1937 | - public function testAssertPrivateAttributeEquals() |
|
| 1938 | - { |
|
| 1939 | - $obj = new \ClassWithNonPublicAttributes; |
|
| 1937 | + public function testAssertPrivateAttributeEquals() |
|
| 1938 | + { |
|
| 1939 | + $obj = new \ClassWithNonPublicAttributes; |
|
| 1940 | 1940 | |
| 1941 | - $this->assertAttributeEquals('baz', 'privateAttribute', $obj); |
|
| 1941 | + $this->assertAttributeEquals('baz', 'privateAttribute', $obj); |
|
| 1942 | 1942 | |
| 1943 | - $this->expectException(AssertionFailedError::class); |
|
| 1943 | + $this->expectException(AssertionFailedError::class); |
|
| 1944 | 1944 | |
| 1945 | - $this->assertAttributeEquals('foo', 'privateAttribute', $obj); |
|
| 1946 | - } |
|
| 1945 | + $this->assertAttributeEquals('foo', 'privateAttribute', $obj); |
|
| 1946 | + } |
|
| 1947 | 1947 | |
| 1948 | - public function testAssertPrivateAttributeNotEquals() |
|
| 1949 | - { |
|
| 1950 | - $obj = new \ClassWithNonPublicAttributes; |
|
| 1948 | + public function testAssertPrivateAttributeNotEquals() |
|
| 1949 | + { |
|
| 1950 | + $obj = new \ClassWithNonPublicAttributes; |
|
| 1951 | 1951 | |
| 1952 | - $this->assertAttributeNotEquals('foo', 'privateAttribute', $obj); |
|
| 1952 | + $this->assertAttributeNotEquals('foo', 'privateAttribute', $obj); |
|
| 1953 | 1953 | |
| 1954 | - $this->expectException(AssertionFailedError::class); |
|
| 1954 | + $this->expectException(AssertionFailedError::class); |
|
| 1955 | 1955 | |
| 1956 | - $this->assertAttributeNotEquals('baz', 'privateAttribute', $obj); |
|
| 1957 | - } |
|
| 1956 | + $this->assertAttributeNotEquals('baz', 'privateAttribute', $obj); |
|
| 1957 | + } |
|
| 1958 | 1958 | |
| 1959 | - public function testAssertPublicStaticAttributeEquals() |
|
| 1960 | - { |
|
| 1961 | - $this->assertAttributeEquals('foo', 'publicStaticAttribute', \ClassWithNonPublicAttributes::class); |
|
| 1959 | + public function testAssertPublicStaticAttributeEquals() |
|
| 1960 | + { |
|
| 1961 | + $this->assertAttributeEquals('foo', 'publicStaticAttribute', \ClassWithNonPublicAttributes::class); |
|
| 1962 | 1962 | |
| 1963 | - $this->expectException(AssertionFailedError::class); |
|
| 1963 | + $this->expectException(AssertionFailedError::class); |
|
| 1964 | 1964 | |
| 1965 | - $this->assertAttributeEquals('bar', 'publicStaticAttribute', \ClassWithNonPublicAttributes::class); |
|
| 1966 | - } |
|
| 1965 | + $this->assertAttributeEquals('bar', 'publicStaticAttribute', \ClassWithNonPublicAttributes::class); |
|
| 1966 | + } |
|
| 1967 | 1967 | |
| 1968 | - public function testAssertPublicStaticAttributeNotEquals() |
|
| 1969 | - { |
|
| 1970 | - $this->assertAttributeNotEquals('bar', 'publicStaticAttribute', \ClassWithNonPublicAttributes::class); |
|
| 1968 | + public function testAssertPublicStaticAttributeNotEquals() |
|
| 1969 | + { |
|
| 1970 | + $this->assertAttributeNotEquals('bar', 'publicStaticAttribute', \ClassWithNonPublicAttributes::class); |
|
| 1971 | 1971 | |
| 1972 | - $this->expectException(AssertionFailedError::class); |
|
| 1972 | + $this->expectException(AssertionFailedError::class); |
|
| 1973 | 1973 | |
| 1974 | - $this->assertAttributeNotEquals('foo', 'publicStaticAttribute', \ClassWithNonPublicAttributes::class); |
|
| 1975 | - } |
|
| 1974 | + $this->assertAttributeNotEquals('foo', 'publicStaticAttribute', \ClassWithNonPublicAttributes::class); |
|
| 1975 | + } |
|
| 1976 | 1976 | |
| 1977 | - public function testAssertProtectedStaticAttributeEquals() |
|
| 1978 | - { |
|
| 1979 | - $this->assertAttributeEquals('bar', 'protectedStaticAttribute', \ClassWithNonPublicAttributes::class); |
|
| 1977 | + public function testAssertProtectedStaticAttributeEquals() |
|
| 1978 | + { |
|
| 1979 | + $this->assertAttributeEquals('bar', 'protectedStaticAttribute', \ClassWithNonPublicAttributes::class); |
|
| 1980 | 1980 | |
| 1981 | - $this->expectException(AssertionFailedError::class); |
|
| 1981 | + $this->expectException(AssertionFailedError::class); |
|
| 1982 | 1982 | |
| 1983 | - $this->assertAttributeEquals('foo', 'protectedStaticAttribute', \ClassWithNonPublicAttributes::class); |
|
| 1984 | - } |
|
| 1983 | + $this->assertAttributeEquals('foo', 'protectedStaticAttribute', \ClassWithNonPublicAttributes::class); |
|
| 1984 | + } |
|
| 1985 | 1985 | |
| 1986 | - public function testAssertProtectedStaticAttributeNotEquals() |
|
| 1987 | - { |
|
| 1988 | - $this->assertAttributeNotEquals('foo', 'protectedStaticAttribute', \ClassWithNonPublicAttributes::class); |
|
| 1986 | + public function testAssertProtectedStaticAttributeNotEquals() |
|
| 1987 | + { |
|
| 1988 | + $this->assertAttributeNotEquals('foo', 'protectedStaticAttribute', \ClassWithNonPublicAttributes::class); |
|
| 1989 | 1989 | |
| 1990 | - $this->expectException(AssertionFailedError::class); |
|
| 1990 | + $this->expectException(AssertionFailedError::class); |
|
| 1991 | 1991 | |
| 1992 | - $this->assertAttributeNotEquals('bar', 'protectedStaticAttribute', \ClassWithNonPublicAttributes::class); |
|
| 1993 | - } |
|
| 1992 | + $this->assertAttributeNotEquals('bar', 'protectedStaticAttribute', \ClassWithNonPublicAttributes::class); |
|
| 1993 | + } |
|
| 1994 | 1994 | |
| 1995 | - public function testAssertPrivateStaticAttributeEquals() |
|
| 1996 | - { |
|
| 1997 | - $this->assertAttributeEquals('baz', 'privateStaticAttribute', \ClassWithNonPublicAttributes::class); |
|
| 1995 | + public function testAssertPrivateStaticAttributeEquals() |
|
| 1996 | + { |
|
| 1997 | + $this->assertAttributeEquals('baz', 'privateStaticAttribute', \ClassWithNonPublicAttributes::class); |
|
| 1998 | 1998 | |
| 1999 | - $this->expectException(AssertionFailedError::class); |
|
| 1999 | + $this->expectException(AssertionFailedError::class); |
|
| 2000 | 2000 | |
| 2001 | - $this->assertAttributeEquals('foo', 'privateStaticAttribute', \ClassWithNonPublicAttributes::class); |
|
| 2002 | - } |
|
| 2001 | + $this->assertAttributeEquals('foo', 'privateStaticAttribute', \ClassWithNonPublicAttributes::class); |
|
| 2002 | + } |
|
| 2003 | 2003 | |
| 2004 | - public function testAssertPrivateStaticAttributeNotEquals() |
|
| 2005 | - { |
|
| 2006 | - $this->assertAttributeNotEquals('foo', 'privateStaticAttribute', \ClassWithNonPublicAttributes::class); |
|
| 2004 | + public function testAssertPrivateStaticAttributeNotEquals() |
|
| 2005 | + { |
|
| 2006 | + $this->assertAttributeNotEquals('foo', 'privateStaticAttribute', \ClassWithNonPublicAttributes::class); |
|
| 2007 | 2007 | |
| 2008 | - $this->expectException(AssertionFailedError::class); |
|
| 2008 | + $this->expectException(AssertionFailedError::class); |
|
| 2009 | 2009 | |
| 2010 | - $this->assertAttributeNotEquals('baz', 'privateStaticAttribute', \ClassWithNonPublicAttributes::class); |
|
| 2011 | - } |
|
| 2010 | + $this->assertAttributeNotEquals('baz', 'privateStaticAttribute', \ClassWithNonPublicAttributes::class); |
|
| 2011 | + } |
|
| 2012 | 2012 | |
| 2013 | - public function testAssertClassHasAttributeThrowsException() |
|
| 2014 | - { |
|
| 2015 | - $this->expectException(Exception::class); |
|
| 2013 | + public function testAssertClassHasAttributeThrowsException() |
|
| 2014 | + { |
|
| 2015 | + $this->expectException(Exception::class); |
|
| 2016 | 2016 | |
| 2017 | - $this->assertClassHasAttribute(null, null); |
|
| 2018 | - } |
|
| 2017 | + $this->assertClassHasAttribute(null, null); |
|
| 2018 | + } |
|
| 2019 | 2019 | |
| 2020 | - public function testAssertClassHasAttributeThrowsException2() |
|
| 2021 | - { |
|
| 2022 | - $this->expectException(Exception::class); |
|
| 2020 | + public function testAssertClassHasAttributeThrowsException2() |
|
| 2021 | + { |
|
| 2022 | + $this->expectException(Exception::class); |
|
| 2023 | 2023 | |
| 2024 | - $this->assertClassHasAttribute('foo', null); |
|
| 2025 | - } |
|
| 2024 | + $this->assertClassHasAttribute('foo', null); |
|
| 2025 | + } |
|
| 2026 | 2026 | |
| 2027 | - public function testAssertClassHasAttributeThrowsExceptionIfAttributeNameIsNotValid() |
|
| 2028 | - { |
|
| 2029 | - $this->expectException(Exception::class); |
|
| 2027 | + public function testAssertClassHasAttributeThrowsExceptionIfAttributeNameIsNotValid() |
|
| 2028 | + { |
|
| 2029 | + $this->expectException(Exception::class); |
|
| 2030 | 2030 | |
| 2031 | - $this->assertClassHasAttribute('1', \ClassWithNonPublicAttributes::class); |
|
| 2032 | - } |
|
| 2031 | + $this->assertClassHasAttribute('1', \ClassWithNonPublicAttributes::class); |
|
| 2032 | + } |
|
| 2033 | 2033 | |
| 2034 | - public function testAssertClassNotHasAttributeThrowsException() |
|
| 2035 | - { |
|
| 2036 | - $this->expectException(Exception::class); |
|
| 2034 | + public function testAssertClassNotHasAttributeThrowsException() |
|
| 2035 | + { |
|
| 2036 | + $this->expectException(Exception::class); |
|
| 2037 | 2037 | |
| 2038 | - $this->assertClassNotHasAttribute(null, null); |
|
| 2039 | - } |
|
| 2038 | + $this->assertClassNotHasAttribute(null, null); |
|
| 2039 | + } |
|
| 2040 | 2040 | |
| 2041 | - public function testAssertClassNotHasAttributeThrowsException2() |
|
| 2042 | - { |
|
| 2043 | - $this->expectException(Exception::class); |
|
| 2041 | + public function testAssertClassNotHasAttributeThrowsException2() |
|
| 2042 | + { |
|
| 2043 | + $this->expectException(Exception::class); |
|
| 2044 | 2044 | |
| 2045 | - $this->assertClassNotHasAttribute('foo', null); |
|
| 2046 | - } |
|
| 2045 | + $this->assertClassNotHasAttribute('foo', null); |
|
| 2046 | + } |
|
| 2047 | 2047 | |
| 2048 | - public function testAssertClassNotHasAttributeThrowsExceptionIfAttributeNameIsNotValid() |
|
| 2049 | - { |
|
| 2050 | - $this->expectException(Exception::class); |
|
| 2048 | + public function testAssertClassNotHasAttributeThrowsExceptionIfAttributeNameIsNotValid() |
|
| 2049 | + { |
|
| 2050 | + $this->expectException(Exception::class); |
|
| 2051 | 2051 | |
| 2052 | - $this->assertClassNotHasAttribute('1', \ClassWithNonPublicAttributes::class); |
|
| 2053 | - } |
|
| 2052 | + $this->assertClassNotHasAttribute('1', \ClassWithNonPublicAttributes::class); |
|
| 2053 | + } |
|
| 2054 | 2054 | |
| 2055 | - public function testAssertClassHasStaticAttributeThrowsException() |
|
| 2056 | - { |
|
| 2057 | - $this->expectException(Exception::class); |
|
| 2055 | + public function testAssertClassHasStaticAttributeThrowsException() |
|
| 2056 | + { |
|
| 2057 | + $this->expectException(Exception::class); |
|
| 2058 | 2058 | |
| 2059 | - $this->assertClassHasStaticAttribute(null, null); |
|
| 2060 | - } |
|
| 2059 | + $this->assertClassHasStaticAttribute(null, null); |
|
| 2060 | + } |
|
| 2061 | 2061 | |
| 2062 | - public function testAssertClassHasStaticAttributeThrowsException2() |
|
| 2063 | - { |
|
| 2064 | - $this->expectException(Exception::class); |
|
| 2062 | + public function testAssertClassHasStaticAttributeThrowsException2() |
|
| 2063 | + { |
|
| 2064 | + $this->expectException(Exception::class); |
|
| 2065 | 2065 | |
| 2066 | - $this->assertClassHasStaticAttribute('foo', null); |
|
| 2067 | - } |
|
| 2066 | + $this->assertClassHasStaticAttribute('foo', null); |
|
| 2067 | + } |
|
| 2068 | 2068 | |
| 2069 | - public function testAssertClassHasStaticAttributeThrowsExceptionIfAttributeNameIsNotValid() |
|
| 2070 | - { |
|
| 2071 | - $this->expectException(Exception::class); |
|
| 2069 | + public function testAssertClassHasStaticAttributeThrowsExceptionIfAttributeNameIsNotValid() |
|
| 2070 | + { |
|
| 2071 | + $this->expectException(Exception::class); |
|
| 2072 | 2072 | |
| 2073 | - $this->assertClassHasStaticAttribute('1', \ClassWithNonPublicAttributes::class); |
|
| 2074 | - } |
|
| 2073 | + $this->assertClassHasStaticAttribute('1', \ClassWithNonPublicAttributes::class); |
|
| 2074 | + } |
|
| 2075 | 2075 | |
| 2076 | - public function testAssertClassNotHasStaticAttributeThrowsException() |
|
| 2077 | - { |
|
| 2078 | - $this->expectException(Exception::class); |
|
| 2076 | + public function testAssertClassNotHasStaticAttributeThrowsException() |
|
| 2077 | + { |
|
| 2078 | + $this->expectException(Exception::class); |
|
| 2079 | 2079 | |
| 2080 | - $this->assertClassNotHasStaticAttribute(null, null); |
|
| 2081 | - } |
|
| 2080 | + $this->assertClassNotHasStaticAttribute(null, null); |
|
| 2081 | + } |
|
| 2082 | 2082 | |
| 2083 | - public function testAssertClassNotHasStaticAttributeThrowsException2() |
|
| 2084 | - { |
|
| 2085 | - $this->expectException(Exception::class); |
|
| 2083 | + public function testAssertClassNotHasStaticAttributeThrowsException2() |
|
| 2084 | + { |
|
| 2085 | + $this->expectException(Exception::class); |
|
| 2086 | 2086 | |
| 2087 | - $this->assertClassNotHasStaticAttribute('foo', null); |
|
| 2088 | - } |
|
| 2087 | + $this->assertClassNotHasStaticAttribute('foo', null); |
|
| 2088 | + } |
|
| 2089 | 2089 | |
| 2090 | - public function testAssertClassNotHasStaticAttributeThrowsExceptionIfAttributeNameIsNotValid() |
|
| 2091 | - { |
|
| 2092 | - $this->expectException(Exception::class); |
|
| 2090 | + public function testAssertClassNotHasStaticAttributeThrowsExceptionIfAttributeNameIsNotValid() |
|
| 2091 | + { |
|
| 2092 | + $this->expectException(Exception::class); |
|
| 2093 | 2093 | |
| 2094 | - $this->assertClassNotHasStaticAttribute('1', \ClassWithNonPublicAttributes::class); |
|
| 2095 | - } |
|
| 2094 | + $this->assertClassNotHasStaticAttribute('1', \ClassWithNonPublicAttributes::class); |
|
| 2095 | + } |
|
| 2096 | 2096 | |
| 2097 | - public function testAssertObjectHasAttributeThrowsException() |
|
| 2098 | - { |
|
| 2099 | - $this->expectException(Exception::class); |
|
| 2097 | + public function testAssertObjectHasAttributeThrowsException() |
|
| 2098 | + { |
|
| 2099 | + $this->expectException(Exception::class); |
|
| 2100 | 2100 | |
| 2101 | - $this->assertObjectHasAttribute(null, null); |
|
| 2102 | - } |
|
| 2101 | + $this->assertObjectHasAttribute(null, null); |
|
| 2102 | + } |
|
| 2103 | 2103 | |
| 2104 | - public function testAssertObjectHasAttributeThrowsException2() |
|
| 2105 | - { |
|
| 2106 | - $this->expectException(Exception::class); |
|
| 2104 | + public function testAssertObjectHasAttributeThrowsException2() |
|
| 2105 | + { |
|
| 2106 | + $this->expectException(Exception::class); |
|
| 2107 | 2107 | |
| 2108 | - $this->assertObjectHasAttribute('foo', null); |
|
| 2109 | - } |
|
| 2108 | + $this->assertObjectHasAttribute('foo', null); |
|
| 2109 | + } |
|
| 2110 | 2110 | |
| 2111 | - public function testAssertObjectHasAttributeThrowsExceptionIfAttributeNameIsNotValid() |
|
| 2112 | - { |
|
| 2113 | - $this->expectException(Exception::class); |
|
| 2111 | + public function testAssertObjectHasAttributeThrowsExceptionIfAttributeNameIsNotValid() |
|
| 2112 | + { |
|
| 2113 | + $this->expectException(Exception::class); |
|
| 2114 | 2114 | |
| 2115 | - $this->assertObjectHasAttribute('1', \ClassWithNonPublicAttributes::class); |
|
| 2116 | - } |
|
| 2115 | + $this->assertObjectHasAttribute('1', \ClassWithNonPublicAttributes::class); |
|
| 2116 | + } |
|
| 2117 | 2117 | |
| 2118 | - public function testAssertObjectNotHasAttributeThrowsException() |
|
| 2119 | - { |
|
| 2120 | - $this->expectException(Exception::class); |
|
| 2118 | + public function testAssertObjectNotHasAttributeThrowsException() |
|
| 2119 | + { |
|
| 2120 | + $this->expectException(Exception::class); |
|
| 2121 | 2121 | |
| 2122 | - $this->assertObjectNotHasAttribute(null, null); |
|
| 2123 | - } |
|
| 2122 | + $this->assertObjectNotHasAttribute(null, null); |
|
| 2123 | + } |
|
| 2124 | 2124 | |
| 2125 | - public function testAssertObjectNotHasAttributeThrowsException2() |
|
| 2126 | - { |
|
| 2127 | - $this->expectException(Exception::class); |
|
| 2125 | + public function testAssertObjectNotHasAttributeThrowsException2() |
|
| 2126 | + { |
|
| 2127 | + $this->expectException(Exception::class); |
|
| 2128 | 2128 | |
| 2129 | - $this->assertObjectNotHasAttribute('foo', null); |
|
| 2130 | - } |
|
| 2129 | + $this->assertObjectNotHasAttribute('foo', null); |
|
| 2130 | + } |
|
| 2131 | 2131 | |
| 2132 | - public function testAssertObjectNotHasAttributeThrowsExceptionIfAttributeNameIsNotValid() |
|
| 2133 | - { |
|
| 2134 | - $this->expectException(Exception::class); |
|
| 2132 | + public function testAssertObjectNotHasAttributeThrowsExceptionIfAttributeNameIsNotValid() |
|
| 2133 | + { |
|
| 2134 | + $this->expectException(Exception::class); |
|
| 2135 | 2135 | |
| 2136 | - $this->assertObjectNotHasAttribute('1', \ClassWithNonPublicAttributes::class); |
|
| 2137 | - } |
|
| 2136 | + $this->assertObjectNotHasAttribute('1', \ClassWithNonPublicAttributes::class); |
|
| 2137 | + } |
|
| 2138 | 2138 | |
| 2139 | - public function testClassHasPublicAttribute() |
|
| 2140 | - { |
|
| 2141 | - $this->assertClassHasAttribute('publicAttribute', \ClassWithNonPublicAttributes::class); |
|
| 2139 | + public function testClassHasPublicAttribute() |
|
| 2140 | + { |
|
| 2141 | + $this->assertClassHasAttribute('publicAttribute', \ClassWithNonPublicAttributes::class); |
|
| 2142 | 2142 | |
| 2143 | - $this->expectException(AssertionFailedError::class); |
|
| 2143 | + $this->expectException(AssertionFailedError::class); |
|
| 2144 | 2144 | |
| 2145 | - $this->assertClassHasAttribute('attribute', \ClassWithNonPublicAttributes::class); |
|
| 2146 | - } |
|
| 2145 | + $this->assertClassHasAttribute('attribute', \ClassWithNonPublicAttributes::class); |
|
| 2146 | + } |
|
| 2147 | 2147 | |
| 2148 | - public function testClassNotHasPublicAttribute() |
|
| 2149 | - { |
|
| 2150 | - $this->assertClassNotHasAttribute('attribute', \ClassWithNonPublicAttributes::class); |
|
| 2148 | + public function testClassNotHasPublicAttribute() |
|
| 2149 | + { |
|
| 2150 | + $this->assertClassNotHasAttribute('attribute', \ClassWithNonPublicAttributes::class); |
|
| 2151 | 2151 | |
| 2152 | - $this->expectException(AssertionFailedError::class); |
|
| 2152 | + $this->expectException(AssertionFailedError::class); |
|
| 2153 | 2153 | |
| 2154 | - $this->assertClassNotHasAttribute('publicAttribute', \ClassWithNonPublicAttributes::class); |
|
| 2155 | - } |
|
| 2154 | + $this->assertClassNotHasAttribute('publicAttribute', \ClassWithNonPublicAttributes::class); |
|
| 2155 | + } |
|
| 2156 | 2156 | |
| 2157 | - public function testClassHasPublicStaticAttribute() |
|
| 2158 | - { |
|
| 2159 | - $this->assertClassHasStaticAttribute('publicStaticAttribute', \ClassWithNonPublicAttributes::class); |
|
| 2157 | + public function testClassHasPublicStaticAttribute() |
|
| 2158 | + { |
|
| 2159 | + $this->assertClassHasStaticAttribute('publicStaticAttribute', \ClassWithNonPublicAttributes::class); |
|
| 2160 | 2160 | |
| 2161 | - $this->expectException(AssertionFailedError::class); |
|
| 2161 | + $this->expectException(AssertionFailedError::class); |
|
| 2162 | 2162 | |
| 2163 | - $this->assertClassHasStaticAttribute('attribute', \ClassWithNonPublicAttributes::class); |
|
| 2164 | - } |
|
| 2163 | + $this->assertClassHasStaticAttribute('attribute', \ClassWithNonPublicAttributes::class); |
|
| 2164 | + } |
|
| 2165 | 2165 | |
| 2166 | - public function testClassNotHasPublicStaticAttribute() |
|
| 2167 | - { |
|
| 2168 | - $this->assertClassNotHasStaticAttribute('attribute', \ClassWithNonPublicAttributes::class); |
|
| 2166 | + public function testClassNotHasPublicStaticAttribute() |
|
| 2167 | + { |
|
| 2168 | + $this->assertClassNotHasStaticAttribute('attribute', \ClassWithNonPublicAttributes::class); |
|
| 2169 | 2169 | |
| 2170 | - $this->expectException(AssertionFailedError::class); |
|
| 2170 | + $this->expectException(AssertionFailedError::class); |
|
| 2171 | 2171 | |
| 2172 | - $this->assertClassNotHasStaticAttribute('publicStaticAttribute', \ClassWithNonPublicAttributes::class); |
|
| 2173 | - } |
|
| 2172 | + $this->assertClassNotHasStaticAttribute('publicStaticAttribute', \ClassWithNonPublicAttributes::class); |
|
| 2173 | + } |
|
| 2174 | 2174 | |
| 2175 | - public function testObjectHasPublicAttribute() |
|
| 2176 | - { |
|
| 2177 | - $obj = new \ClassWithNonPublicAttributes; |
|
| 2175 | + public function testObjectHasPublicAttribute() |
|
| 2176 | + { |
|
| 2177 | + $obj = new \ClassWithNonPublicAttributes; |
|
| 2178 | 2178 | |
| 2179 | - $this->assertObjectHasAttribute('publicAttribute', $obj); |
|
| 2179 | + $this->assertObjectHasAttribute('publicAttribute', $obj); |
|
| 2180 | 2180 | |
| 2181 | - $this->expectException(AssertionFailedError::class); |
|
| 2181 | + $this->expectException(AssertionFailedError::class); |
|
| 2182 | 2182 | |
| 2183 | - $this->assertObjectHasAttribute('attribute', $obj); |
|
| 2184 | - } |
|
| 2183 | + $this->assertObjectHasAttribute('attribute', $obj); |
|
| 2184 | + } |
|
| 2185 | 2185 | |
| 2186 | - public function testObjectNotHasPublicAttribute() |
|
| 2187 | - { |
|
| 2188 | - $obj = new \ClassWithNonPublicAttributes; |
|
| 2186 | + public function testObjectNotHasPublicAttribute() |
|
| 2187 | + { |
|
| 2188 | + $obj = new \ClassWithNonPublicAttributes; |
|
| 2189 | 2189 | |
| 2190 | - $this->assertObjectNotHasAttribute('attribute', $obj); |
|
| 2190 | + $this->assertObjectNotHasAttribute('attribute', $obj); |
|
| 2191 | 2191 | |
| 2192 | - $this->expectException(AssertionFailedError::class); |
|
| 2192 | + $this->expectException(AssertionFailedError::class); |
|
| 2193 | 2193 | |
| 2194 | - $this->assertObjectNotHasAttribute('publicAttribute', $obj); |
|
| 2195 | - } |
|
| 2194 | + $this->assertObjectNotHasAttribute('publicAttribute', $obj); |
|
| 2195 | + } |
|
| 2196 | 2196 | |
| 2197 | - public function testObjectHasOnTheFlyAttribute() |
|
| 2198 | - { |
|
| 2199 | - $obj = new \stdClass; |
|
| 2200 | - $obj->foo = 'bar'; |
|
| 2197 | + public function testObjectHasOnTheFlyAttribute() |
|
| 2198 | + { |
|
| 2199 | + $obj = new \stdClass; |
|
| 2200 | + $obj->foo = 'bar'; |
|
| 2201 | 2201 | |
| 2202 | - $this->assertObjectHasAttribute('foo', $obj); |
|
| 2202 | + $this->assertObjectHasAttribute('foo', $obj); |
|
| 2203 | 2203 | |
| 2204 | - $this->expectException(AssertionFailedError::class); |
|
| 2204 | + $this->expectException(AssertionFailedError::class); |
|
| 2205 | 2205 | |
| 2206 | - $this->assertObjectHasAttribute('bar', $obj); |
|
| 2207 | - } |
|
| 2206 | + $this->assertObjectHasAttribute('bar', $obj); |
|
| 2207 | + } |
|
| 2208 | 2208 | |
| 2209 | - public function testObjectNotHasOnTheFlyAttribute() |
|
| 2210 | - { |
|
| 2211 | - $obj = new \stdClass; |
|
| 2212 | - $obj->foo = 'bar'; |
|
| 2209 | + public function testObjectNotHasOnTheFlyAttribute() |
|
| 2210 | + { |
|
| 2211 | + $obj = new \stdClass; |
|
| 2212 | + $obj->foo = 'bar'; |
|
| 2213 | 2213 | |
| 2214 | - $this->assertObjectNotHasAttribute('bar', $obj); |
|
| 2214 | + $this->assertObjectNotHasAttribute('bar', $obj); |
|
| 2215 | 2215 | |
| 2216 | - $this->expectException(AssertionFailedError::class); |
|
| 2216 | + $this->expectException(AssertionFailedError::class); |
|
| 2217 | 2217 | |
| 2218 | - $this->assertObjectNotHasAttribute('foo', $obj); |
|
| 2219 | - } |
|
| 2218 | + $this->assertObjectNotHasAttribute('foo', $obj); |
|
| 2219 | + } |
|
| 2220 | 2220 | |
| 2221 | - public function testObjectHasProtectedAttribute() |
|
| 2222 | - { |
|
| 2223 | - $obj = new \ClassWithNonPublicAttributes; |
|
| 2221 | + public function testObjectHasProtectedAttribute() |
|
| 2222 | + { |
|
| 2223 | + $obj = new \ClassWithNonPublicAttributes; |
|
| 2224 | 2224 | |
| 2225 | - $this->assertObjectHasAttribute('protectedAttribute', $obj); |
|
| 2225 | + $this->assertObjectHasAttribute('protectedAttribute', $obj); |
|
| 2226 | 2226 | |
| 2227 | - $this->expectException(AssertionFailedError::class); |
|
| 2227 | + $this->expectException(AssertionFailedError::class); |
|
| 2228 | 2228 | |
| 2229 | - $this->assertObjectHasAttribute('attribute', $obj); |
|
| 2230 | - } |
|
| 2229 | + $this->assertObjectHasAttribute('attribute', $obj); |
|
| 2230 | + } |
|
| 2231 | 2231 | |
| 2232 | - public function testObjectNotHasProtectedAttribute() |
|
| 2233 | - { |
|
| 2234 | - $obj = new \ClassWithNonPublicAttributes; |
|
| 2232 | + public function testObjectNotHasProtectedAttribute() |
|
| 2233 | + { |
|
| 2234 | + $obj = new \ClassWithNonPublicAttributes; |
|
| 2235 | 2235 | |
| 2236 | - $this->assertObjectNotHasAttribute('attribute', $obj); |
|
| 2236 | + $this->assertObjectNotHasAttribute('attribute', $obj); |
|
| 2237 | 2237 | |
| 2238 | - $this->expectException(AssertionFailedError::class); |
|
| 2238 | + $this->expectException(AssertionFailedError::class); |
|
| 2239 | 2239 | |
| 2240 | - $this->assertObjectNotHasAttribute('protectedAttribute', $obj); |
|
| 2241 | - } |
|
| 2240 | + $this->assertObjectNotHasAttribute('protectedAttribute', $obj); |
|
| 2241 | + } |
|
| 2242 | 2242 | |
| 2243 | - public function testObjectHasPrivateAttribute() |
|
| 2244 | - { |
|
| 2245 | - $obj = new \ClassWithNonPublicAttributes; |
|
| 2243 | + public function testObjectHasPrivateAttribute() |
|
| 2244 | + { |
|
| 2245 | + $obj = new \ClassWithNonPublicAttributes; |
|
| 2246 | 2246 | |
| 2247 | - $this->assertObjectHasAttribute('privateAttribute', $obj); |
|
| 2247 | + $this->assertObjectHasAttribute('privateAttribute', $obj); |
|
| 2248 | 2248 | |
| 2249 | - $this->expectException(AssertionFailedError::class); |
|
| 2249 | + $this->expectException(AssertionFailedError::class); |
|
| 2250 | 2250 | |
| 2251 | - $this->assertObjectHasAttribute('attribute', $obj); |
|
| 2252 | - } |
|
| 2251 | + $this->assertObjectHasAttribute('attribute', $obj); |
|
| 2252 | + } |
|
| 2253 | 2253 | |
| 2254 | - public function testObjectNotHasPrivateAttribute() |
|
| 2255 | - { |
|
| 2256 | - $obj = new \ClassWithNonPublicAttributes; |
|
| 2257 | - |
|
| 2258 | - $this->assertObjectNotHasAttribute('attribute', $obj); |
|
| 2259 | - |
|
| 2260 | - $this->expectException(AssertionFailedError::class); |
|
| 2261 | - |
|
| 2262 | - $this->assertObjectNotHasAttribute('privateAttribute', $obj); |
|
| 2263 | - } |
|
| 2264 | - |
|
| 2265 | - public function testAssertThatAttributeEquals() |
|
| 2266 | - { |
|
| 2267 | - $this->assertThat( |
|
| 2268 | - new \ClassWithNonPublicAttributes, |
|
| 2269 | - $this->attribute( |
|
| 2270 | - $this->equalTo('foo'), |
|
| 2271 | - 'publicAttribute' |
|
| 2272 | - ) |
|
| 2273 | - ); |
|
| 2274 | - } |
|
| 2275 | - |
|
| 2276 | - public function testAssertThatAttributeEquals2() |
|
| 2277 | - { |
|
| 2278 | - $this->expectException(AssertionFailedError::class); |
|
| 2279 | - |
|
| 2280 | - $this->assertThat( |
|
| 2281 | - new \ClassWithNonPublicAttributes, |
|
| 2282 | - $this->attribute( |
|
| 2283 | - $this->equalTo('bar'), |
|
| 2284 | - 'publicAttribute' |
|
| 2285 | - ) |
|
| 2286 | - ); |
|
| 2287 | - } |
|
| 2288 | - |
|
| 2289 | - public function testAssertThatAttributeEqualTo() |
|
| 2290 | - { |
|
| 2291 | - $this->assertThat( |
|
| 2292 | - new \ClassWithNonPublicAttributes, |
|
| 2293 | - $this->attributeEqualTo('publicAttribute', 'foo') |
|
| 2294 | - ); |
|
| 2295 | - } |
|
| 2296 | - |
|
| 2297 | - /** |
|
| 2298 | - * @doesNotPerformAssertions |
|
| 2299 | - */ |
|
| 2300 | - public function testAssertThatAnything() |
|
| 2301 | - { |
|
| 2302 | - $this->assertThat('anything', $this->anything()); |
|
| 2303 | - } |
|
| 2304 | - |
|
| 2305 | - public function testAssertThatIsTrue() |
|
| 2306 | - { |
|
| 2307 | - $this->assertThat(true, $this->isTrue()); |
|
| 2308 | - } |
|
| 2309 | - |
|
| 2310 | - public function testAssertThatIsFalse() |
|
| 2311 | - { |
|
| 2312 | - $this->assertThat(false, $this->isFalse()); |
|
| 2313 | - } |
|
| 2314 | - |
|
| 2315 | - public function testAssertThatIsJson() |
|
| 2316 | - { |
|
| 2317 | - $this->assertThat('{}', $this->isJson()); |
|
| 2318 | - } |
|
| 2319 | - |
|
| 2320 | - /** |
|
| 2321 | - * @doesNotPerformAssertions |
|
| 2322 | - */ |
|
| 2323 | - public function testAssertThatAnythingAndAnything() |
|
| 2324 | - { |
|
| 2325 | - $this->assertThat( |
|
| 2326 | - 'anything', |
|
| 2327 | - $this->logicalAnd( |
|
| 2328 | - $this->anything(), |
|
| 2329 | - $this->anything() |
|
| 2330 | - ) |
|
| 2331 | - ); |
|
| 2332 | - } |
|
| 2333 | - |
|
| 2334 | - /** |
|
| 2335 | - * @doesNotPerformAssertions |
|
| 2336 | - */ |
|
| 2337 | - public function testAssertThatAnythingOrAnything() |
|
| 2338 | - { |
|
| 2339 | - $this->assertThat( |
|
| 2340 | - 'anything', |
|
| 2341 | - $this->logicalOr( |
|
| 2342 | - $this->anything(), |
|
| 2343 | - $this->anything() |
|
| 2344 | - ) |
|
| 2345 | - ); |
|
| 2346 | - } |
|
| 2347 | - |
|
| 2348 | - /** |
|
| 2349 | - * @doesNotPerformAssertions |
|
| 2350 | - */ |
|
| 2351 | - public function testAssertThatAnythingXorNotAnything() |
|
| 2352 | - { |
|
| 2353 | - $this->assertThat( |
|
| 2354 | - 'anything', |
|
| 2355 | - $this->logicalXor( |
|
| 2356 | - $this->anything(), |
|
| 2357 | - $this->logicalNot($this->anything()) |
|
| 2358 | - ) |
|
| 2359 | - ); |
|
| 2360 | - } |
|
| 2361 | - |
|
| 2362 | - public function testAssertThatContains() |
|
| 2363 | - { |
|
| 2364 | - $this->assertThat(['foo'], $this->contains('foo')); |
|
| 2365 | - } |
|
| 2366 | - |
|
| 2367 | - public function testAssertThatStringContains() |
|
| 2368 | - { |
|
| 2369 | - $this->assertThat('barfoobar', $this->stringContains('foo')); |
|
| 2370 | - } |
|
| 2371 | - |
|
| 2372 | - public function testAssertThatContainsOnly() |
|
| 2373 | - { |
|
| 2374 | - $this->assertThat(['foo'], $this->containsOnly('string')); |
|
| 2375 | - } |
|
| 2376 | - |
|
| 2377 | - public function testAssertThatContainsOnlyInstancesOf() |
|
| 2378 | - { |
|
| 2379 | - $this->assertThat([new \Book], $this->containsOnlyInstancesOf(\Book::class)); |
|
| 2380 | - } |
|
| 2381 | - |
|
| 2382 | - public function testAssertThatArrayHasKey() |
|
| 2383 | - { |
|
| 2384 | - $this->assertThat(['foo' => 'bar'], $this->arrayHasKey('foo')); |
|
| 2385 | - } |
|
| 2386 | - |
|
| 2387 | - public function testAssertThatClassHasAttribute() |
|
| 2388 | - { |
|
| 2389 | - $this->assertThat( |
|
| 2390 | - new \ClassWithNonPublicAttributes, |
|
| 2391 | - $this->classHasAttribute('publicAttribute') |
|
| 2392 | - ); |
|
| 2393 | - } |
|
| 2394 | - |
|
| 2395 | - public function testAssertThatClassHasStaticAttribute() |
|
| 2396 | - { |
|
| 2397 | - $this->assertThat( |
|
| 2398 | - new \ClassWithNonPublicAttributes, |
|
| 2399 | - $this->classHasStaticAttribute('publicStaticAttribute') |
|
| 2400 | - ); |
|
| 2401 | - } |
|
| 2402 | - |
|
| 2403 | - public function testAssertThatObjectHasAttribute() |
|
| 2404 | - { |
|
| 2405 | - $this->assertThat( |
|
| 2406 | - new \ClassWithNonPublicAttributes, |
|
| 2407 | - $this->objectHasAttribute('publicAttribute') |
|
| 2408 | - ); |
|
| 2409 | - } |
|
| 2410 | - |
|
| 2411 | - public function testAssertThatEqualTo() |
|
| 2412 | - { |
|
| 2413 | - $this->assertThat('foo', $this->equalTo('foo')); |
|
| 2414 | - } |
|
| 2415 | - |
|
| 2416 | - public function testAssertThatIdenticalTo() |
|
| 2417 | - { |
|
| 2418 | - $value = new \stdClass; |
|
| 2419 | - $constraint = $this->identicalTo($value); |
|
| 2420 | - |
|
| 2421 | - $this->assertThat($value, $constraint); |
|
| 2422 | - } |
|
| 2423 | - |
|
| 2424 | - public function testAssertThatIsInstanceOf() |
|
| 2425 | - { |
|
| 2426 | - $this->assertThat(new \stdClass, $this->isInstanceOf('StdClass')); |
|
| 2427 | - } |
|
| 2428 | - |
|
| 2429 | - public function testAssertThatIsType() |
|
| 2430 | - { |
|
| 2431 | - $this->assertThat('string', $this->isType('string')); |
|
| 2432 | - } |
|
| 2433 | - |
|
| 2434 | - public function testAssertThatIsEmpty() |
|
| 2435 | - { |
|
| 2436 | - $this->assertThat([], $this->isEmpty()); |
|
| 2437 | - } |
|
| 2438 | - |
|
| 2439 | - public function testAssertThatFileExists() |
|
| 2440 | - { |
|
| 2441 | - $this->assertThat(__FILE__, $this->fileExists()); |
|
| 2442 | - } |
|
| 2443 | - |
|
| 2444 | - public function testAssertThatGreaterThan() |
|
| 2445 | - { |
|
| 2446 | - $this->assertThat(2, $this->greaterThan(1)); |
|
| 2447 | - } |
|
| 2448 | - |
|
| 2449 | - public function testAssertThatGreaterThanOrEqual() |
|
| 2450 | - { |
|
| 2451 | - $this->assertThat(2, $this->greaterThanOrEqual(1)); |
|
| 2452 | - } |
|
| 2453 | - |
|
| 2454 | - public function testAssertThatLessThan() |
|
| 2455 | - { |
|
| 2456 | - $this->assertThat(1, $this->lessThan(2)); |
|
| 2457 | - } |
|
| 2458 | - |
|
| 2459 | - public function testAssertThatLessThanOrEqual() |
|
| 2460 | - { |
|
| 2461 | - $this->assertThat(1, $this->lessThanOrEqual(2)); |
|
| 2462 | - } |
|
| 2463 | - |
|
| 2464 | - public function testAssertThatMatchesRegularExpression() |
|
| 2465 | - { |
|
| 2466 | - $this->assertThat('foobar', $this->matchesRegularExpression('/foo/')); |
|
| 2467 | - } |
|
| 2468 | - |
|
| 2469 | - public function testAssertThatCallback() |
|
| 2470 | - { |
|
| 2471 | - $this->assertThat( |
|
| 2472 | - null, |
|
| 2473 | - $this->callback(function ($other) { |
|
| 2474 | - return true; |
|
| 2475 | - }) |
|
| 2476 | - ); |
|
| 2477 | - } |
|
| 2478 | - |
|
| 2479 | - public function testAssertThatCountOf() |
|
| 2480 | - { |
|
| 2481 | - $this->assertThat([1], $this->countOf(1)); |
|
| 2482 | - } |
|
| 2483 | - |
|
| 2484 | - public function testAssertFileEquals() |
|
| 2485 | - { |
|
| 2486 | - $this->assertFileEquals( |
|
| 2487 | - $this->filesDirectory . 'foo.xml', |
|
| 2488 | - $this->filesDirectory . 'foo.xml' |
|
| 2489 | - ); |
|
| 2490 | - |
|
| 2491 | - $this->expectException(AssertionFailedError::class); |
|
| 2492 | - |
|
| 2493 | - $this->assertFileEquals( |
|
| 2494 | - $this->filesDirectory . 'foo.xml', |
|
| 2495 | - $this->filesDirectory . 'bar.xml' |
|
| 2496 | - ); |
|
| 2497 | - } |
|
| 2498 | - |
|
| 2499 | - public function testAssertFileNotEquals() |
|
| 2500 | - { |
|
| 2501 | - $this->assertFileNotEquals( |
|
| 2502 | - $this->filesDirectory . 'foo.xml', |
|
| 2503 | - $this->filesDirectory . 'bar.xml' |
|
| 2504 | - ); |
|
| 2505 | - |
|
| 2506 | - $this->expectException(AssertionFailedError::class); |
|
| 2507 | - |
|
| 2508 | - $this->assertFileNotEquals( |
|
| 2509 | - $this->filesDirectory . 'foo.xml', |
|
| 2510 | - $this->filesDirectory . 'foo.xml' |
|
| 2511 | - ); |
|
| 2512 | - } |
|
| 2513 | - |
|
| 2514 | - public function testAssertStringEqualsFile() |
|
| 2515 | - { |
|
| 2516 | - $this->assertStringEqualsFile( |
|
| 2517 | - $this->filesDirectory . 'foo.xml', |
|
| 2518 | - \file_get_contents($this->filesDirectory . 'foo.xml') |
|
| 2519 | - ); |
|
| 2520 | - |
|
| 2521 | - $this->expectException(AssertionFailedError::class); |
|
| 2522 | - |
|
| 2523 | - $this->assertStringEqualsFile( |
|
| 2524 | - $this->filesDirectory . 'foo.xml', |
|
| 2525 | - \file_get_contents($this->filesDirectory . 'bar.xml') |
|
| 2526 | - ); |
|
| 2527 | - } |
|
| 2528 | - |
|
| 2529 | - public function testAssertStringNotEqualsFile() |
|
| 2530 | - { |
|
| 2531 | - $this->assertStringNotEqualsFile( |
|
| 2532 | - $this->filesDirectory . 'foo.xml', |
|
| 2533 | - \file_get_contents($this->filesDirectory . 'bar.xml') |
|
| 2534 | - ); |
|
| 2535 | - |
|
| 2536 | - $this->expectException(AssertionFailedError::class); |
|
| 2537 | - |
|
| 2538 | - $this->assertStringNotEqualsFile( |
|
| 2539 | - $this->filesDirectory . 'foo.xml', |
|
| 2540 | - \file_get_contents($this->filesDirectory . 'foo.xml') |
|
| 2541 | - ); |
|
| 2542 | - } |
|
| 2254 | + public function testObjectNotHasPrivateAttribute() |
|
| 2255 | + { |
|
| 2256 | + $obj = new \ClassWithNonPublicAttributes; |
|
| 2257 | + |
|
| 2258 | + $this->assertObjectNotHasAttribute('attribute', $obj); |
|
| 2259 | + |
|
| 2260 | + $this->expectException(AssertionFailedError::class); |
|
| 2261 | + |
|
| 2262 | + $this->assertObjectNotHasAttribute('privateAttribute', $obj); |
|
| 2263 | + } |
|
| 2264 | + |
|
| 2265 | + public function testAssertThatAttributeEquals() |
|
| 2266 | + { |
|
| 2267 | + $this->assertThat( |
|
| 2268 | + new \ClassWithNonPublicAttributes, |
|
| 2269 | + $this->attribute( |
|
| 2270 | + $this->equalTo('foo'), |
|
| 2271 | + 'publicAttribute' |
|
| 2272 | + ) |
|
| 2273 | + ); |
|
| 2274 | + } |
|
| 2275 | + |
|
| 2276 | + public function testAssertThatAttributeEquals2() |
|
| 2277 | + { |
|
| 2278 | + $this->expectException(AssertionFailedError::class); |
|
| 2279 | + |
|
| 2280 | + $this->assertThat( |
|
| 2281 | + new \ClassWithNonPublicAttributes, |
|
| 2282 | + $this->attribute( |
|
| 2283 | + $this->equalTo('bar'), |
|
| 2284 | + 'publicAttribute' |
|
| 2285 | + ) |
|
| 2286 | + ); |
|
| 2287 | + } |
|
| 2288 | + |
|
| 2289 | + public function testAssertThatAttributeEqualTo() |
|
| 2290 | + { |
|
| 2291 | + $this->assertThat( |
|
| 2292 | + new \ClassWithNonPublicAttributes, |
|
| 2293 | + $this->attributeEqualTo('publicAttribute', 'foo') |
|
| 2294 | + ); |
|
| 2295 | + } |
|
| 2296 | + |
|
| 2297 | + /** |
|
| 2298 | + * @doesNotPerformAssertions |
|
| 2299 | + */ |
|
| 2300 | + public function testAssertThatAnything() |
|
| 2301 | + { |
|
| 2302 | + $this->assertThat('anything', $this->anything()); |
|
| 2303 | + } |
|
| 2304 | + |
|
| 2305 | + public function testAssertThatIsTrue() |
|
| 2306 | + { |
|
| 2307 | + $this->assertThat(true, $this->isTrue()); |
|
| 2308 | + } |
|
| 2309 | + |
|
| 2310 | + public function testAssertThatIsFalse() |
|
| 2311 | + { |
|
| 2312 | + $this->assertThat(false, $this->isFalse()); |
|
| 2313 | + } |
|
| 2314 | + |
|
| 2315 | + public function testAssertThatIsJson() |
|
| 2316 | + { |
|
| 2317 | + $this->assertThat('{}', $this->isJson()); |
|
| 2318 | + } |
|
| 2319 | + |
|
| 2320 | + /** |
|
| 2321 | + * @doesNotPerformAssertions |
|
| 2322 | + */ |
|
| 2323 | + public function testAssertThatAnythingAndAnything() |
|
| 2324 | + { |
|
| 2325 | + $this->assertThat( |
|
| 2326 | + 'anything', |
|
| 2327 | + $this->logicalAnd( |
|
| 2328 | + $this->anything(), |
|
| 2329 | + $this->anything() |
|
| 2330 | + ) |
|
| 2331 | + ); |
|
| 2332 | + } |
|
| 2333 | + |
|
| 2334 | + /** |
|
| 2335 | + * @doesNotPerformAssertions |
|
| 2336 | + */ |
|
| 2337 | + public function testAssertThatAnythingOrAnything() |
|
| 2338 | + { |
|
| 2339 | + $this->assertThat( |
|
| 2340 | + 'anything', |
|
| 2341 | + $this->logicalOr( |
|
| 2342 | + $this->anything(), |
|
| 2343 | + $this->anything() |
|
| 2344 | + ) |
|
| 2345 | + ); |
|
| 2346 | + } |
|
| 2347 | + |
|
| 2348 | + /** |
|
| 2349 | + * @doesNotPerformAssertions |
|
| 2350 | + */ |
|
| 2351 | + public function testAssertThatAnythingXorNotAnything() |
|
| 2352 | + { |
|
| 2353 | + $this->assertThat( |
|
| 2354 | + 'anything', |
|
| 2355 | + $this->logicalXor( |
|
| 2356 | + $this->anything(), |
|
| 2357 | + $this->logicalNot($this->anything()) |
|
| 2358 | + ) |
|
| 2359 | + ); |
|
| 2360 | + } |
|
| 2361 | + |
|
| 2362 | + public function testAssertThatContains() |
|
| 2363 | + { |
|
| 2364 | + $this->assertThat(['foo'], $this->contains('foo')); |
|
| 2365 | + } |
|
| 2366 | + |
|
| 2367 | + public function testAssertThatStringContains() |
|
| 2368 | + { |
|
| 2369 | + $this->assertThat('barfoobar', $this->stringContains('foo')); |
|
| 2370 | + } |
|
| 2371 | + |
|
| 2372 | + public function testAssertThatContainsOnly() |
|
| 2373 | + { |
|
| 2374 | + $this->assertThat(['foo'], $this->containsOnly('string')); |
|
| 2375 | + } |
|
| 2376 | + |
|
| 2377 | + public function testAssertThatContainsOnlyInstancesOf() |
|
| 2378 | + { |
|
| 2379 | + $this->assertThat([new \Book], $this->containsOnlyInstancesOf(\Book::class)); |
|
| 2380 | + } |
|
| 2381 | + |
|
| 2382 | + public function testAssertThatArrayHasKey() |
|
| 2383 | + { |
|
| 2384 | + $this->assertThat(['foo' => 'bar'], $this->arrayHasKey('foo')); |
|
| 2385 | + } |
|
| 2386 | + |
|
| 2387 | + public function testAssertThatClassHasAttribute() |
|
| 2388 | + { |
|
| 2389 | + $this->assertThat( |
|
| 2390 | + new \ClassWithNonPublicAttributes, |
|
| 2391 | + $this->classHasAttribute('publicAttribute') |
|
| 2392 | + ); |
|
| 2393 | + } |
|
| 2394 | + |
|
| 2395 | + public function testAssertThatClassHasStaticAttribute() |
|
| 2396 | + { |
|
| 2397 | + $this->assertThat( |
|
| 2398 | + new \ClassWithNonPublicAttributes, |
|
| 2399 | + $this->classHasStaticAttribute('publicStaticAttribute') |
|
| 2400 | + ); |
|
| 2401 | + } |
|
| 2402 | + |
|
| 2403 | + public function testAssertThatObjectHasAttribute() |
|
| 2404 | + { |
|
| 2405 | + $this->assertThat( |
|
| 2406 | + new \ClassWithNonPublicAttributes, |
|
| 2407 | + $this->objectHasAttribute('publicAttribute') |
|
| 2408 | + ); |
|
| 2409 | + } |
|
| 2410 | + |
|
| 2411 | + public function testAssertThatEqualTo() |
|
| 2412 | + { |
|
| 2413 | + $this->assertThat('foo', $this->equalTo('foo')); |
|
| 2414 | + } |
|
| 2415 | + |
|
| 2416 | + public function testAssertThatIdenticalTo() |
|
| 2417 | + { |
|
| 2418 | + $value = new \stdClass; |
|
| 2419 | + $constraint = $this->identicalTo($value); |
|
| 2420 | + |
|
| 2421 | + $this->assertThat($value, $constraint); |
|
| 2422 | + } |
|
| 2423 | + |
|
| 2424 | + public function testAssertThatIsInstanceOf() |
|
| 2425 | + { |
|
| 2426 | + $this->assertThat(new \stdClass, $this->isInstanceOf('StdClass')); |
|
| 2427 | + } |
|
| 2428 | + |
|
| 2429 | + public function testAssertThatIsType() |
|
| 2430 | + { |
|
| 2431 | + $this->assertThat('string', $this->isType('string')); |
|
| 2432 | + } |
|
| 2433 | + |
|
| 2434 | + public function testAssertThatIsEmpty() |
|
| 2435 | + { |
|
| 2436 | + $this->assertThat([], $this->isEmpty()); |
|
| 2437 | + } |
|
| 2438 | + |
|
| 2439 | + public function testAssertThatFileExists() |
|
| 2440 | + { |
|
| 2441 | + $this->assertThat(__FILE__, $this->fileExists()); |
|
| 2442 | + } |
|
| 2443 | + |
|
| 2444 | + public function testAssertThatGreaterThan() |
|
| 2445 | + { |
|
| 2446 | + $this->assertThat(2, $this->greaterThan(1)); |
|
| 2447 | + } |
|
| 2448 | + |
|
| 2449 | + public function testAssertThatGreaterThanOrEqual() |
|
| 2450 | + { |
|
| 2451 | + $this->assertThat(2, $this->greaterThanOrEqual(1)); |
|
| 2452 | + } |
|
| 2453 | + |
|
| 2454 | + public function testAssertThatLessThan() |
|
| 2455 | + { |
|
| 2456 | + $this->assertThat(1, $this->lessThan(2)); |
|
| 2457 | + } |
|
| 2458 | + |
|
| 2459 | + public function testAssertThatLessThanOrEqual() |
|
| 2460 | + { |
|
| 2461 | + $this->assertThat(1, $this->lessThanOrEqual(2)); |
|
| 2462 | + } |
|
| 2463 | + |
|
| 2464 | + public function testAssertThatMatchesRegularExpression() |
|
| 2465 | + { |
|
| 2466 | + $this->assertThat('foobar', $this->matchesRegularExpression('/foo/')); |
|
| 2467 | + } |
|
| 2468 | + |
|
| 2469 | + public function testAssertThatCallback() |
|
| 2470 | + { |
|
| 2471 | + $this->assertThat( |
|
| 2472 | + null, |
|
| 2473 | + $this->callback(function ($other) { |
|
| 2474 | + return true; |
|
| 2475 | + }) |
|
| 2476 | + ); |
|
| 2477 | + } |
|
| 2478 | + |
|
| 2479 | + public function testAssertThatCountOf() |
|
| 2480 | + { |
|
| 2481 | + $this->assertThat([1], $this->countOf(1)); |
|
| 2482 | + } |
|
| 2483 | + |
|
| 2484 | + public function testAssertFileEquals() |
|
| 2485 | + { |
|
| 2486 | + $this->assertFileEquals( |
|
| 2487 | + $this->filesDirectory . 'foo.xml', |
|
| 2488 | + $this->filesDirectory . 'foo.xml' |
|
| 2489 | + ); |
|
| 2490 | + |
|
| 2491 | + $this->expectException(AssertionFailedError::class); |
|
| 2492 | + |
|
| 2493 | + $this->assertFileEquals( |
|
| 2494 | + $this->filesDirectory . 'foo.xml', |
|
| 2495 | + $this->filesDirectory . 'bar.xml' |
|
| 2496 | + ); |
|
| 2497 | + } |
|
| 2498 | + |
|
| 2499 | + public function testAssertFileNotEquals() |
|
| 2500 | + { |
|
| 2501 | + $this->assertFileNotEquals( |
|
| 2502 | + $this->filesDirectory . 'foo.xml', |
|
| 2503 | + $this->filesDirectory . 'bar.xml' |
|
| 2504 | + ); |
|
| 2505 | + |
|
| 2506 | + $this->expectException(AssertionFailedError::class); |
|
| 2507 | + |
|
| 2508 | + $this->assertFileNotEquals( |
|
| 2509 | + $this->filesDirectory . 'foo.xml', |
|
| 2510 | + $this->filesDirectory . 'foo.xml' |
|
| 2511 | + ); |
|
| 2512 | + } |
|
| 2513 | + |
|
| 2514 | + public function testAssertStringEqualsFile() |
|
| 2515 | + { |
|
| 2516 | + $this->assertStringEqualsFile( |
|
| 2517 | + $this->filesDirectory . 'foo.xml', |
|
| 2518 | + \file_get_contents($this->filesDirectory . 'foo.xml') |
|
| 2519 | + ); |
|
| 2520 | + |
|
| 2521 | + $this->expectException(AssertionFailedError::class); |
|
| 2522 | + |
|
| 2523 | + $this->assertStringEqualsFile( |
|
| 2524 | + $this->filesDirectory . 'foo.xml', |
|
| 2525 | + \file_get_contents($this->filesDirectory . 'bar.xml') |
|
| 2526 | + ); |
|
| 2527 | + } |
|
| 2528 | + |
|
| 2529 | + public function testAssertStringNotEqualsFile() |
|
| 2530 | + { |
|
| 2531 | + $this->assertStringNotEqualsFile( |
|
| 2532 | + $this->filesDirectory . 'foo.xml', |
|
| 2533 | + \file_get_contents($this->filesDirectory . 'bar.xml') |
|
| 2534 | + ); |
|
| 2535 | + |
|
| 2536 | + $this->expectException(AssertionFailedError::class); |
|
| 2537 | + |
|
| 2538 | + $this->assertStringNotEqualsFile( |
|
| 2539 | + $this->filesDirectory . 'foo.xml', |
|
| 2540 | + \file_get_contents($this->filesDirectory . 'foo.xml') |
|
| 2541 | + ); |
|
| 2542 | + } |
|
| 2543 | 2543 | |
| 2544 | - public function testAssertStringStartsWithThrowsException() |
|
| 2545 | - { |
|
| 2546 | - $this->expectException(Exception::class); |
|
| 2544 | + public function testAssertStringStartsWithThrowsException() |
|
| 2545 | + { |
|
| 2546 | + $this->expectException(Exception::class); |
|
| 2547 | 2547 | |
| 2548 | - $this->assertStringStartsWith(null, null); |
|
| 2549 | - } |
|
| 2548 | + $this->assertStringStartsWith(null, null); |
|
| 2549 | + } |
|
| 2550 | 2550 | |
| 2551 | - public function testAssertStringStartsWithThrowsException2() |
|
| 2552 | - { |
|
| 2553 | - $this->expectException(Exception::class); |
|
| 2551 | + public function testAssertStringStartsWithThrowsException2() |
|
| 2552 | + { |
|
| 2553 | + $this->expectException(Exception::class); |
|
| 2554 | 2554 | |
| 2555 | - $this->assertStringStartsWith('', null); |
|
| 2556 | - } |
|
| 2555 | + $this->assertStringStartsWith('', null); |
|
| 2556 | + } |
|
| 2557 | 2557 | |
| 2558 | - public function testAssertStringStartsNotWithThrowsException() |
|
| 2559 | - { |
|
| 2560 | - $this->expectException(Exception::class); |
|
| 2558 | + public function testAssertStringStartsNotWithThrowsException() |
|
| 2559 | + { |
|
| 2560 | + $this->expectException(Exception::class); |
|
| 2561 | 2561 | |
| 2562 | - $this->assertStringStartsNotWith(null, null); |
|
| 2563 | - } |
|
| 2562 | + $this->assertStringStartsNotWith(null, null); |
|
| 2563 | + } |
|
| 2564 | 2564 | |
| 2565 | - public function testAssertStringStartsNotWithThrowsException2() |
|
| 2566 | - { |
|
| 2567 | - $this->expectException(Exception::class); |
|
| 2565 | + public function testAssertStringStartsNotWithThrowsException2() |
|
| 2566 | + { |
|
| 2567 | + $this->expectException(Exception::class); |
|
| 2568 | 2568 | |
| 2569 | - $this->assertStringStartsNotWith('', null); |
|
| 2570 | - } |
|
| 2569 | + $this->assertStringStartsNotWith('', null); |
|
| 2570 | + } |
|
| 2571 | 2571 | |
| 2572 | - public function testAssertStringEndsWithThrowsException() |
|
| 2573 | - { |
|
| 2574 | - $this->expectException(Exception::class); |
|
| 2572 | + public function testAssertStringEndsWithThrowsException() |
|
| 2573 | + { |
|
| 2574 | + $this->expectException(Exception::class); |
|
| 2575 | 2575 | |
| 2576 | - $this->assertStringEndsWith(null, null); |
|
| 2577 | - } |
|
| 2576 | + $this->assertStringEndsWith(null, null); |
|
| 2577 | + } |
|
| 2578 | 2578 | |
| 2579 | - public function testAssertStringEndsWithThrowsException2() |
|
| 2580 | - { |
|
| 2581 | - $this->expectException(Exception::class); |
|
| 2579 | + public function testAssertStringEndsWithThrowsException2() |
|
| 2580 | + { |
|
| 2581 | + $this->expectException(Exception::class); |
|
| 2582 | 2582 | |
| 2583 | - $this->assertStringEndsWith('', null); |
|
| 2584 | - } |
|
| 2583 | + $this->assertStringEndsWith('', null); |
|
| 2584 | + } |
|
| 2585 | 2585 | |
| 2586 | - public function testAssertStringEndsNotWithThrowsException() |
|
| 2587 | - { |
|
| 2588 | - $this->expectException(Exception::class); |
|
| 2586 | + public function testAssertStringEndsNotWithThrowsException() |
|
| 2587 | + { |
|
| 2588 | + $this->expectException(Exception::class); |
|
| 2589 | 2589 | |
| 2590 | - $this->assertStringEndsNotWith(null, null); |
|
| 2591 | - } |
|
| 2590 | + $this->assertStringEndsNotWith(null, null); |
|
| 2591 | + } |
|
| 2592 | 2592 | |
| 2593 | - public function testAssertStringEndsNotWithThrowsException2() |
|
| 2594 | - { |
|
| 2595 | - $this->expectException(Exception::class); |
|
| 2593 | + public function testAssertStringEndsNotWithThrowsException2() |
|
| 2594 | + { |
|
| 2595 | + $this->expectException(Exception::class); |
|
| 2596 | 2596 | |
| 2597 | - $this->assertStringEndsNotWith('', null); |
|
| 2598 | - } |
|
| 2597 | + $this->assertStringEndsNotWith('', null); |
|
| 2598 | + } |
|
| 2599 | 2599 | |
| 2600 | - public function testAssertStringStartsWith() |
|
| 2601 | - { |
|
| 2602 | - $this->assertStringStartsWith('prefix', 'prefixfoo'); |
|
| 2600 | + public function testAssertStringStartsWith() |
|
| 2601 | + { |
|
| 2602 | + $this->assertStringStartsWith('prefix', 'prefixfoo'); |
|
| 2603 | 2603 | |
| 2604 | - $this->expectException(AssertionFailedError::class); |
|
| 2604 | + $this->expectException(AssertionFailedError::class); |
|
| 2605 | 2605 | |
| 2606 | - $this->assertStringStartsWith('prefix', 'foo'); |
|
| 2607 | - } |
|
| 2606 | + $this->assertStringStartsWith('prefix', 'foo'); |
|
| 2607 | + } |
|
| 2608 | 2608 | |
| 2609 | - public function testAssertStringStartsNotWith() |
|
| 2610 | - { |
|
| 2611 | - $this->assertStringStartsNotWith('prefix', 'foo'); |
|
| 2609 | + public function testAssertStringStartsNotWith() |
|
| 2610 | + { |
|
| 2611 | + $this->assertStringStartsNotWith('prefix', 'foo'); |
|
| 2612 | 2612 | |
| 2613 | - $this->expectException(AssertionFailedError::class); |
|
| 2613 | + $this->expectException(AssertionFailedError::class); |
|
| 2614 | 2614 | |
| 2615 | - $this->assertStringStartsNotWith('prefix', 'prefixfoo'); |
|
| 2616 | - } |
|
| 2615 | + $this->assertStringStartsNotWith('prefix', 'prefixfoo'); |
|
| 2616 | + } |
|
| 2617 | 2617 | |
| 2618 | - public function testAssertStringEndsWith() |
|
| 2619 | - { |
|
| 2620 | - $this->assertStringEndsWith('suffix', 'foosuffix'); |
|
| 2618 | + public function testAssertStringEndsWith() |
|
| 2619 | + { |
|
| 2620 | + $this->assertStringEndsWith('suffix', 'foosuffix'); |
|
| 2621 | 2621 | |
| 2622 | - $this->expectException(AssertionFailedError::class); |
|
| 2622 | + $this->expectException(AssertionFailedError::class); |
|
| 2623 | 2623 | |
| 2624 | - $this->assertStringEndsWith('suffix', 'foo'); |
|
| 2625 | - } |
|
| 2624 | + $this->assertStringEndsWith('suffix', 'foo'); |
|
| 2625 | + } |
|
| 2626 | 2626 | |
| 2627 | - public function testAssertStringEndsNotWith() |
|
| 2628 | - { |
|
| 2629 | - $this->assertStringEndsNotWith('suffix', 'foo'); |
|
| 2627 | + public function testAssertStringEndsNotWith() |
|
| 2628 | + { |
|
| 2629 | + $this->assertStringEndsNotWith('suffix', 'foo'); |
|
| 2630 | 2630 | |
| 2631 | - $this->expectException(AssertionFailedError::class); |
|
| 2631 | + $this->expectException(AssertionFailedError::class); |
|
| 2632 | 2632 | |
| 2633 | - $this->assertStringEndsNotWith('suffix', 'foosuffix'); |
|
| 2634 | - } |
|
| 2633 | + $this->assertStringEndsNotWith('suffix', 'foosuffix'); |
|
| 2634 | + } |
|
| 2635 | 2635 | |
| 2636 | - public function testAssertStringMatchesFormatRaisesExceptionForInvalidFirstArgument() |
|
| 2637 | - { |
|
| 2638 | - $this->expectException(Exception::class); |
|
| 2636 | + public function testAssertStringMatchesFormatRaisesExceptionForInvalidFirstArgument() |
|
| 2637 | + { |
|
| 2638 | + $this->expectException(Exception::class); |
|
| 2639 | 2639 | |
| 2640 | - $this->assertStringMatchesFormat(null, ''); |
|
| 2641 | - } |
|
| 2640 | + $this->assertStringMatchesFormat(null, ''); |
|
| 2641 | + } |
|
| 2642 | 2642 | |
| 2643 | - public function testAssertStringMatchesFormatRaisesExceptionForInvalidSecondArgument() |
|
| 2644 | - { |
|
| 2645 | - $this->expectException(Exception::class); |
|
| 2643 | + public function testAssertStringMatchesFormatRaisesExceptionForInvalidSecondArgument() |
|
| 2644 | + { |
|
| 2645 | + $this->expectException(Exception::class); |
|
| 2646 | 2646 | |
| 2647 | - $this->assertStringMatchesFormat('', null); |
|
| 2648 | - } |
|
| 2647 | + $this->assertStringMatchesFormat('', null); |
|
| 2648 | + } |
|
| 2649 | 2649 | |
| 2650 | - public function testAssertStringMatchesFormat() |
|
| 2651 | - { |
|
| 2652 | - $this->assertStringMatchesFormat('*%s*', '***'); |
|
| 2653 | - } |
|
| 2650 | + public function testAssertStringMatchesFormat() |
|
| 2651 | + { |
|
| 2652 | + $this->assertStringMatchesFormat('*%s*', '***'); |
|
| 2653 | + } |
|
| 2654 | 2654 | |
| 2655 | - public function testAssertStringMatchesFormatFailure() |
|
| 2656 | - { |
|
| 2657 | - $this->expectException(AssertionFailedError::class); |
|
| 2655 | + public function testAssertStringMatchesFormatFailure() |
|
| 2656 | + { |
|
| 2657 | + $this->expectException(AssertionFailedError::class); |
|
| 2658 | 2658 | |
| 2659 | - $this->assertStringMatchesFormat('*%s*', '**'); |
|
| 2660 | - } |
|
| 2659 | + $this->assertStringMatchesFormat('*%s*', '**'); |
|
| 2660 | + } |
|
| 2661 | 2661 | |
| 2662 | - public function testAssertStringNotMatchesFormatRaisesExceptionForInvalidFirstArgument() |
|
| 2663 | - { |
|
| 2664 | - $this->expectException(Exception::class); |
|
| 2662 | + public function testAssertStringNotMatchesFormatRaisesExceptionForInvalidFirstArgument() |
|
| 2663 | + { |
|
| 2664 | + $this->expectException(Exception::class); |
|
| 2665 | 2665 | |
| 2666 | - $this->assertStringNotMatchesFormat(null, ''); |
|
| 2667 | - } |
|
| 2666 | + $this->assertStringNotMatchesFormat(null, ''); |
|
| 2667 | + } |
|
| 2668 | 2668 | |
| 2669 | - public function testAssertStringNotMatchesFormatRaisesExceptionForInvalidSecondArgument() |
|
| 2670 | - { |
|
| 2671 | - $this->expectException(Exception::class); |
|
| 2669 | + public function testAssertStringNotMatchesFormatRaisesExceptionForInvalidSecondArgument() |
|
| 2670 | + { |
|
| 2671 | + $this->expectException(Exception::class); |
|
| 2672 | 2672 | |
| 2673 | - $this->assertStringNotMatchesFormat('', null); |
|
| 2674 | - } |
|
| 2673 | + $this->assertStringNotMatchesFormat('', null); |
|
| 2674 | + } |
|
| 2675 | 2675 | |
| 2676 | - public function testAssertStringNotMatchesFormat() |
|
| 2677 | - { |
|
| 2678 | - $this->assertStringNotMatchesFormat('*%s*', '**'); |
|
| 2676 | + public function testAssertStringNotMatchesFormat() |
|
| 2677 | + { |
|
| 2678 | + $this->assertStringNotMatchesFormat('*%s*', '**'); |
|
| 2679 | 2679 | |
| 2680 | - $this->expectException(AssertionFailedError::class); |
|
| 2680 | + $this->expectException(AssertionFailedError::class); |
|
| 2681 | 2681 | |
| 2682 | - $this->assertStringMatchesFormat('*%s*', '**'); |
|
| 2683 | - } |
|
| 2682 | + $this->assertStringMatchesFormat('*%s*', '**'); |
|
| 2683 | + } |
|
| 2684 | 2684 | |
| 2685 | - public function testAssertEmpty() |
|
| 2686 | - { |
|
| 2687 | - $this->assertEmpty([]); |
|
| 2685 | + public function testAssertEmpty() |
|
| 2686 | + { |
|
| 2687 | + $this->assertEmpty([]); |
|
| 2688 | 2688 | |
| 2689 | - $this->expectException(AssertionFailedError::class); |
|
| 2689 | + $this->expectException(AssertionFailedError::class); |
|
| 2690 | 2690 | |
| 2691 | - $this->assertEmpty(['foo']); |
|
| 2692 | - } |
|
| 2691 | + $this->assertEmpty(['foo']); |
|
| 2692 | + } |
|
| 2693 | 2693 | |
| 2694 | - public function testAssertNotEmpty() |
|
| 2695 | - { |
|
| 2696 | - $this->assertNotEmpty(['foo']); |
|
| 2694 | + public function testAssertNotEmpty() |
|
| 2695 | + { |
|
| 2696 | + $this->assertNotEmpty(['foo']); |
|
| 2697 | 2697 | |
| 2698 | - $this->expectException(AssertionFailedError::class); |
|
| 2698 | + $this->expectException(AssertionFailedError::class); |
|
| 2699 | 2699 | |
| 2700 | - $this->assertNotEmpty([]); |
|
| 2701 | - } |
|
| 2700 | + $this->assertNotEmpty([]); |
|
| 2701 | + } |
|
| 2702 | 2702 | |
| 2703 | - public function testAssertAttributeEmpty() |
|
| 2704 | - { |
|
| 2705 | - $o = new \stdClass; |
|
| 2706 | - $o->a = []; |
|
| 2703 | + public function testAssertAttributeEmpty() |
|
| 2704 | + { |
|
| 2705 | + $o = new \stdClass; |
|
| 2706 | + $o->a = []; |
|
| 2707 | 2707 | |
| 2708 | - $this->assertAttributeEmpty('a', $o); |
|
| 2708 | + $this->assertAttributeEmpty('a', $o); |
|
| 2709 | 2709 | |
| 2710 | - $o->a = ['b']; |
|
| 2710 | + $o->a = ['b']; |
|
| 2711 | 2711 | |
| 2712 | - $this->expectException(AssertionFailedError::class); |
|
| 2712 | + $this->expectException(AssertionFailedError::class); |
|
| 2713 | 2713 | |
| 2714 | - $this->assertAttributeEmpty('a', $o); |
|
| 2715 | - } |
|
| 2714 | + $this->assertAttributeEmpty('a', $o); |
|
| 2715 | + } |
|
| 2716 | 2716 | |
| 2717 | - public function testAssertAttributeNotEmpty() |
|
| 2718 | - { |
|
| 2719 | - $o = new \stdClass; |
|
| 2720 | - $o->a = ['b']; |
|
| 2717 | + public function testAssertAttributeNotEmpty() |
|
| 2718 | + { |
|
| 2719 | + $o = new \stdClass; |
|
| 2720 | + $o->a = ['b']; |
|
| 2721 | 2721 | |
| 2722 | - $this->assertAttributeNotEmpty('a', $o); |
|
| 2722 | + $this->assertAttributeNotEmpty('a', $o); |
|
| 2723 | 2723 | |
| 2724 | - $o->a = []; |
|
| 2724 | + $o->a = []; |
|
| 2725 | 2725 | |
| 2726 | - $this->expectException(AssertionFailedError::class); |
|
| 2726 | + $this->expectException(AssertionFailedError::class); |
|
| 2727 | 2727 | |
| 2728 | - $this->assertAttributeNotEmpty('a', $o); |
|
| 2729 | - } |
|
| 2728 | + $this->assertAttributeNotEmpty('a', $o); |
|
| 2729 | + } |
|
| 2730 | 2730 | |
| 2731 | - public function testMarkTestIncomplete() |
|
| 2732 | - { |
|
| 2733 | - try { |
|
| 2734 | - $this->markTestIncomplete('incomplete'); |
|
| 2735 | - } catch (IncompleteTestError $e) { |
|
| 2736 | - $this->assertEquals('incomplete', $e->getMessage()); |
|
| 2731 | + public function testMarkTestIncomplete() |
|
| 2732 | + { |
|
| 2733 | + try { |
|
| 2734 | + $this->markTestIncomplete('incomplete'); |
|
| 2735 | + } catch (IncompleteTestError $e) { |
|
| 2736 | + $this->assertEquals('incomplete', $e->getMessage()); |
|
| 2737 | 2737 | |
| 2738 | - return; |
|
| 2739 | - } |
|
| 2738 | + return; |
|
| 2739 | + } |
|
| 2740 | 2740 | |
| 2741 | - $this->fail(); |
|
| 2742 | - } |
|
| 2741 | + $this->fail(); |
|
| 2742 | + } |
|
| 2743 | 2743 | |
| 2744 | - public function testMarkTestSkipped() |
|
| 2745 | - { |
|
| 2746 | - try { |
|
| 2747 | - $this->markTestSkipped('skipped'); |
|
| 2748 | - } catch (SkippedTestError $e) { |
|
| 2749 | - $this->assertEquals('skipped', $e->getMessage()); |
|
| 2744 | + public function testMarkTestSkipped() |
|
| 2745 | + { |
|
| 2746 | + try { |
|
| 2747 | + $this->markTestSkipped('skipped'); |
|
| 2748 | + } catch (SkippedTestError $e) { |
|
| 2749 | + $this->assertEquals('skipped', $e->getMessage()); |
|
| 2750 | 2750 | |
| 2751 | - return; |
|
| 2752 | - } |
|
| 2751 | + return; |
|
| 2752 | + } |
|
| 2753 | 2753 | |
| 2754 | - $this->fail(); |
|
| 2755 | - } |
|
| 2754 | + $this->fail(); |
|
| 2755 | + } |
|
| 2756 | 2756 | |
| 2757 | - public function testAssertCount() |
|
| 2758 | - { |
|
| 2759 | - $this->assertCount(2, [1, 2]); |
|
| 2757 | + public function testAssertCount() |
|
| 2758 | + { |
|
| 2759 | + $this->assertCount(2, [1, 2]); |
|
| 2760 | 2760 | |
| 2761 | - $this->expectException(AssertionFailedError::class); |
|
| 2761 | + $this->expectException(AssertionFailedError::class); |
|
| 2762 | 2762 | |
| 2763 | - $this->assertCount(2, [1, 2, 3]); |
|
| 2764 | - } |
|
| 2763 | + $this->assertCount(2, [1, 2, 3]); |
|
| 2764 | + } |
|
| 2765 | 2765 | |
| 2766 | - public function testAssertCountTraversable() |
|
| 2767 | - { |
|
| 2768 | - $this->assertCount(2, new \ArrayIterator([1, 2])); |
|
| 2766 | + public function testAssertCountTraversable() |
|
| 2767 | + { |
|
| 2768 | + $this->assertCount(2, new \ArrayIterator([1, 2])); |
|
| 2769 | 2769 | |
| 2770 | - $this->expectException(AssertionFailedError::class); |
|
| 2770 | + $this->expectException(AssertionFailedError::class); |
|
| 2771 | 2771 | |
| 2772 | - $this->assertCount(2, new \ArrayIterator([1, 2, 3])); |
|
| 2773 | - } |
|
| 2772 | + $this->assertCount(2, new \ArrayIterator([1, 2, 3])); |
|
| 2773 | + } |
|
| 2774 | 2774 | |
| 2775 | - public function testAssertCountThrowsExceptionIfExpectedCountIsNoInteger() |
|
| 2776 | - { |
|
| 2777 | - try { |
|
| 2778 | - $this->assertCount('a', []); |
|
| 2779 | - } catch (Exception $e) { |
|
| 2780 | - $this->assertEquals('Argument #1 (No Value) of PHPUnit\Framework\Assert::assertCount() must be a integer', $e->getMessage()); |
|
| 2775 | + public function testAssertCountThrowsExceptionIfExpectedCountIsNoInteger() |
|
| 2776 | + { |
|
| 2777 | + try { |
|
| 2778 | + $this->assertCount('a', []); |
|
| 2779 | + } catch (Exception $e) { |
|
| 2780 | + $this->assertEquals('Argument #1 (No Value) of PHPUnit\Framework\Assert::assertCount() must be a integer', $e->getMessage()); |
|
| 2781 | 2781 | |
| 2782 | - return; |
|
| 2783 | - } |
|
| 2782 | + return; |
|
| 2783 | + } |
|
| 2784 | 2784 | |
| 2785 | - $this->fail(); |
|
| 2786 | - } |
|
| 2785 | + $this->fail(); |
|
| 2786 | + } |
|
| 2787 | 2787 | |
| 2788 | - public function testAssertCountThrowsExceptionIfElementIsNotCountable() |
|
| 2789 | - { |
|
| 2790 | - try { |
|
| 2791 | - $this->assertCount(2, ''); |
|
| 2792 | - } catch (Exception $e) { |
|
| 2793 | - $this->assertEquals('Argument #2 (No Value) of PHPUnit\Framework\Assert::assertCount() must be a countable or traversable', $e->getMessage()); |
|
| 2788 | + public function testAssertCountThrowsExceptionIfElementIsNotCountable() |
|
| 2789 | + { |
|
| 2790 | + try { |
|
| 2791 | + $this->assertCount(2, ''); |
|
| 2792 | + } catch (Exception $e) { |
|
| 2793 | + $this->assertEquals('Argument #2 (No Value) of PHPUnit\Framework\Assert::assertCount() must be a countable or traversable', $e->getMessage()); |
|
| 2794 | 2794 | |
| 2795 | - return; |
|
| 2796 | - } |
|
| 2795 | + return; |
|
| 2796 | + } |
|
| 2797 | 2797 | |
| 2798 | - $this->fail(); |
|
| 2799 | - } |
|
| 2798 | + $this->fail(); |
|
| 2799 | + } |
|
| 2800 | 2800 | |
| 2801 | - public function testAssertAttributeCount() |
|
| 2802 | - { |
|
| 2803 | - $o = new \stdClass; |
|
| 2804 | - $o->a = []; |
|
| 2801 | + public function testAssertAttributeCount() |
|
| 2802 | + { |
|
| 2803 | + $o = new \stdClass; |
|
| 2804 | + $o->a = []; |
|
| 2805 | 2805 | |
| 2806 | - $this->assertAttributeCount(0, 'a', $o); |
|
| 2807 | - } |
|
| 2806 | + $this->assertAttributeCount(0, 'a', $o); |
|
| 2807 | + } |
|
| 2808 | 2808 | |
| 2809 | - public function testAssertNotCount() |
|
| 2810 | - { |
|
| 2811 | - $this->assertNotCount(2, [1, 2, 3]); |
|
| 2809 | + public function testAssertNotCount() |
|
| 2810 | + { |
|
| 2811 | + $this->assertNotCount(2, [1, 2, 3]); |
|
| 2812 | 2812 | |
| 2813 | - $this->expectException(AssertionFailedError::class); |
|
| 2813 | + $this->expectException(AssertionFailedError::class); |
|
| 2814 | 2814 | |
| 2815 | - $this->assertNotCount(2, [1, 2]); |
|
| 2816 | - } |
|
| 2815 | + $this->assertNotCount(2, [1, 2]); |
|
| 2816 | + } |
|
| 2817 | 2817 | |
| 2818 | - public function testAssertNotCountThrowsExceptionIfExpectedCountIsNoInteger() |
|
| 2819 | - { |
|
| 2820 | - $this->expectException(Exception::class); |
|
| 2818 | + public function testAssertNotCountThrowsExceptionIfExpectedCountIsNoInteger() |
|
| 2819 | + { |
|
| 2820 | + $this->expectException(Exception::class); |
|
| 2821 | 2821 | |
| 2822 | - $this->assertNotCount('a', []); |
|
| 2823 | - } |
|
| 2822 | + $this->assertNotCount('a', []); |
|
| 2823 | + } |
|
| 2824 | 2824 | |
| 2825 | - public function testAssertNotCountThrowsExceptionIfElementIsNotCountable() |
|
| 2826 | - { |
|
| 2827 | - $this->expectException(Exception::class); |
|
| 2825 | + public function testAssertNotCountThrowsExceptionIfElementIsNotCountable() |
|
| 2826 | + { |
|
| 2827 | + $this->expectException(Exception::class); |
|
| 2828 | 2828 | |
| 2829 | - $this->assertNotCount(2, ''); |
|
| 2830 | - } |
|
| 2829 | + $this->assertNotCount(2, ''); |
|
| 2830 | + } |
|
| 2831 | 2831 | |
| 2832 | - public function testAssertAttributeNotCount() |
|
| 2833 | - { |
|
| 2834 | - $o = new \stdClass; |
|
| 2835 | - $o->a = []; |
|
| 2832 | + public function testAssertAttributeNotCount() |
|
| 2833 | + { |
|
| 2834 | + $o = new \stdClass; |
|
| 2835 | + $o->a = []; |
|
| 2836 | 2836 | |
| 2837 | - $this->assertAttributeNotCount(1, 'a', $o); |
|
| 2838 | - } |
|
| 2837 | + $this->assertAttributeNotCount(1, 'a', $o); |
|
| 2838 | + } |
|
| 2839 | 2839 | |
| 2840 | - public function testAssertSameSize() |
|
| 2841 | - { |
|
| 2842 | - $this->assertSameSize([1, 2], [3, 4]); |
|
| 2840 | + public function testAssertSameSize() |
|
| 2841 | + { |
|
| 2842 | + $this->assertSameSize([1, 2], [3, 4]); |
|
| 2843 | 2843 | |
| 2844 | - $this->expectException(AssertionFailedError::class); |
|
| 2844 | + $this->expectException(AssertionFailedError::class); |
|
| 2845 | 2845 | |
| 2846 | - $this->assertSameSize([1, 2], [1, 2, 3]); |
|
| 2847 | - } |
|
| 2846 | + $this->assertSameSize([1, 2], [1, 2, 3]); |
|
| 2847 | + } |
|
| 2848 | 2848 | |
| 2849 | - public function testAssertSameSizeThrowsExceptionIfExpectedIsNotCountable() |
|
| 2850 | - { |
|
| 2851 | - try { |
|
| 2852 | - $this->assertSameSize('a', []); |
|
| 2853 | - } catch (Exception $e) { |
|
| 2854 | - $this->assertEquals('Argument #1 (No Value) of PHPUnit\Framework\Assert::assertSameSize() must be a countable or traversable', $e->getMessage()); |
|
| 2849 | + public function testAssertSameSizeThrowsExceptionIfExpectedIsNotCountable() |
|
| 2850 | + { |
|
| 2851 | + try { |
|
| 2852 | + $this->assertSameSize('a', []); |
|
| 2853 | + } catch (Exception $e) { |
|
| 2854 | + $this->assertEquals('Argument #1 (No Value) of PHPUnit\Framework\Assert::assertSameSize() must be a countable or traversable', $e->getMessage()); |
|
| 2855 | 2855 | |
| 2856 | - return; |
|
| 2857 | - } |
|
| 2856 | + return; |
|
| 2857 | + } |
|
| 2858 | 2858 | |
| 2859 | - $this->fail(); |
|
| 2860 | - } |
|
| 2859 | + $this->fail(); |
|
| 2860 | + } |
|
| 2861 | 2861 | |
| 2862 | - public function testAssertSameSizeThrowsExceptionIfActualIsNotCountable() |
|
| 2863 | - { |
|
| 2864 | - try { |
|
| 2865 | - $this->assertSameSize([], ''); |
|
| 2866 | - } catch (Exception $e) { |
|
| 2867 | - $this->assertEquals('Argument #2 (No Value) of PHPUnit\Framework\Assert::assertSameSize() must be a countable or traversable', $e->getMessage()); |
|
| 2862 | + public function testAssertSameSizeThrowsExceptionIfActualIsNotCountable() |
|
| 2863 | + { |
|
| 2864 | + try { |
|
| 2865 | + $this->assertSameSize([], ''); |
|
| 2866 | + } catch (Exception $e) { |
|
| 2867 | + $this->assertEquals('Argument #2 (No Value) of PHPUnit\Framework\Assert::assertSameSize() must be a countable or traversable', $e->getMessage()); |
|
| 2868 | 2868 | |
| 2869 | - return; |
|
| 2870 | - } |
|
| 2869 | + return; |
|
| 2870 | + } |
|
| 2871 | 2871 | |
| 2872 | - $this->fail(); |
|
| 2873 | - } |
|
| 2872 | + $this->fail(); |
|
| 2873 | + } |
|
| 2874 | 2874 | |
| 2875 | - public function testAssertNotSameSize() |
|
| 2876 | - { |
|
| 2877 | - $this->assertNotSameSize([1, 2], [1, 2, 3]); |
|
| 2875 | + public function testAssertNotSameSize() |
|
| 2876 | + { |
|
| 2877 | + $this->assertNotSameSize([1, 2], [1, 2, 3]); |
|
| 2878 | 2878 | |
| 2879 | - $this->expectException(AssertionFailedError::class); |
|
| 2879 | + $this->expectException(AssertionFailedError::class); |
|
| 2880 | 2880 | |
| 2881 | - $this->assertNotSameSize([1, 2], [3, 4]); |
|
| 2882 | - } |
|
| 2881 | + $this->assertNotSameSize([1, 2], [3, 4]); |
|
| 2882 | + } |
|
| 2883 | 2883 | |
| 2884 | - public function testAssertNotSameSizeThrowsExceptionIfExpectedIsNotCountable() |
|
| 2885 | - { |
|
| 2886 | - $this->expectException(Exception::class); |
|
| 2884 | + public function testAssertNotSameSizeThrowsExceptionIfExpectedIsNotCountable() |
|
| 2885 | + { |
|
| 2886 | + $this->expectException(Exception::class); |
|
| 2887 | 2887 | |
| 2888 | - $this->assertNotSameSize('a', []); |
|
| 2889 | - } |
|
| 2888 | + $this->assertNotSameSize('a', []); |
|
| 2889 | + } |
|
| 2890 | 2890 | |
| 2891 | - public function testAssertNotSameSizeThrowsExceptionIfActualIsNotCountable() |
|
| 2892 | - { |
|
| 2893 | - $this->expectException(Exception::class); |
|
| 2891 | + public function testAssertNotSameSizeThrowsExceptionIfActualIsNotCountable() |
|
| 2892 | + { |
|
| 2893 | + $this->expectException(Exception::class); |
|
| 2894 | 2894 | |
| 2895 | - $this->assertNotSameSize([], ''); |
|
| 2896 | - } |
|
| 2895 | + $this->assertNotSameSize([], ''); |
|
| 2896 | + } |
|
| 2897 | 2897 | |
| 2898 | - public function testAssertJsonRaisesExceptionForInvalidArgument() |
|
| 2899 | - { |
|
| 2900 | - $this->expectException(Exception::class); |
|
| 2901 | - |
|
| 2902 | - $this->assertJson(null); |
|
| 2903 | - } |
|
| 2898 | + public function testAssertJsonRaisesExceptionForInvalidArgument() |
|
| 2899 | + { |
|
| 2900 | + $this->expectException(Exception::class); |
|
| 2901 | + |
|
| 2902 | + $this->assertJson(null); |
|
| 2903 | + } |
|
| 2904 | 2904 | |
| 2905 | - public function testAssertJson() |
|
| 2906 | - { |
|
| 2907 | - $this->assertJson('{}'); |
|
| 2908 | - } |
|
| 2909 | - |
|
| 2910 | - public function testAssertJsonStringEqualsJsonString() |
|
| 2911 | - { |
|
| 2912 | - $expected = '{"Mascott" : "Tux"}'; |
|
| 2913 | - $actual = '{"Mascott" : "Tux"}'; |
|
| 2914 | - $message = 'Given Json strings do not match'; |
|
| 2915 | - |
|
| 2916 | - $this->assertJsonStringEqualsJsonString($expected, $actual, $message); |
|
| 2917 | - } |
|
| 2918 | - |
|
| 2919 | - /** |
|
| 2920 | - * @dataProvider validInvalidJsonDataprovider |
|
| 2921 | - */ |
|
| 2922 | - public function testAssertJsonStringEqualsJsonStringErrorRaised($expected, $actual) |
|
| 2923 | - { |
|
| 2924 | - $this->expectException(AssertionFailedError::class); |
|
| 2925 | - |
|
| 2926 | - $this->assertJsonStringEqualsJsonString($expected, $actual); |
|
| 2927 | - } |
|
| 2928 | - |
|
| 2929 | - public function testAssertJsonStringNotEqualsJsonString() |
|
| 2930 | - { |
|
| 2931 | - $expected = '{"Mascott" : "Beastie"}'; |
|
| 2932 | - $actual = '{"Mascott" : "Tux"}'; |
|
| 2933 | - $message = 'Given Json strings do match'; |
|
| 2934 | - |
|
| 2935 | - $this->assertJsonStringNotEqualsJsonString($expected, $actual, $message); |
|
| 2936 | - } |
|
| 2937 | - |
|
| 2938 | - /** |
|
| 2939 | - * @dataProvider validInvalidJsonDataprovider |
|
| 2940 | - */ |
|
| 2941 | - public function testAssertJsonStringNotEqualsJsonStringErrorRaised($expected, $actual) |
|
| 2942 | - { |
|
| 2943 | - $this->expectException(AssertionFailedError::class); |
|
| 2944 | - |
|
| 2945 | - $this->assertJsonStringNotEqualsJsonString($expected, $actual); |
|
| 2946 | - } |
|
| 2947 | - |
|
| 2948 | - public function testAssertJsonStringEqualsJsonFile() |
|
| 2949 | - { |
|
| 2950 | - $file = __DIR__ . '/../_files/JsonData/simpleObject.json'; |
|
| 2951 | - $actual = \json_encode(['Mascott' => 'Tux']); |
|
| 2952 | - $message = ''; |
|
| 2953 | - |
|
| 2954 | - $this->assertJsonStringEqualsJsonFile($file, $actual, $message); |
|
| 2955 | - } |
|
| 2956 | - |
|
| 2957 | - public function testAssertJsonStringEqualsJsonFileExpectingExpectationFailedException() |
|
| 2958 | - { |
|
| 2959 | - $file = __DIR__ . '/../_files/JsonData/simpleObject.json'; |
|
| 2960 | - $actual = \json_encode(['Mascott' => 'Beastie']); |
|
| 2961 | - $message = ''; |
|
| 2962 | - |
|
| 2963 | - try { |
|
| 2964 | - $this->assertJsonStringEqualsJsonFile($file, $actual, $message); |
|
| 2965 | - } catch (ExpectationFailedException $e) { |
|
| 2966 | - $this->assertEquals( |
|
| 2967 | - 'Failed asserting that \'{"Mascott":"Beastie"}\' matches JSON string "{"Mascott":"Tux"}".', |
|
| 2968 | - $e->getMessage() |
|
| 2969 | - ); |
|
| 2905 | + public function testAssertJson() |
|
| 2906 | + { |
|
| 2907 | + $this->assertJson('{}'); |
|
| 2908 | + } |
|
| 2909 | + |
|
| 2910 | + public function testAssertJsonStringEqualsJsonString() |
|
| 2911 | + { |
|
| 2912 | + $expected = '{"Mascott" : "Tux"}'; |
|
| 2913 | + $actual = '{"Mascott" : "Tux"}'; |
|
| 2914 | + $message = 'Given Json strings do not match'; |
|
| 2915 | + |
|
| 2916 | + $this->assertJsonStringEqualsJsonString($expected, $actual, $message); |
|
| 2917 | + } |
|
| 2918 | + |
|
| 2919 | + /** |
|
| 2920 | + * @dataProvider validInvalidJsonDataprovider |
|
| 2921 | + */ |
|
| 2922 | + public function testAssertJsonStringEqualsJsonStringErrorRaised($expected, $actual) |
|
| 2923 | + { |
|
| 2924 | + $this->expectException(AssertionFailedError::class); |
|
| 2925 | + |
|
| 2926 | + $this->assertJsonStringEqualsJsonString($expected, $actual); |
|
| 2927 | + } |
|
| 2928 | + |
|
| 2929 | + public function testAssertJsonStringNotEqualsJsonString() |
|
| 2930 | + { |
|
| 2931 | + $expected = '{"Mascott" : "Beastie"}'; |
|
| 2932 | + $actual = '{"Mascott" : "Tux"}'; |
|
| 2933 | + $message = 'Given Json strings do match'; |
|
| 2934 | + |
|
| 2935 | + $this->assertJsonStringNotEqualsJsonString($expected, $actual, $message); |
|
| 2936 | + } |
|
| 2937 | + |
|
| 2938 | + /** |
|
| 2939 | + * @dataProvider validInvalidJsonDataprovider |
|
| 2940 | + */ |
|
| 2941 | + public function testAssertJsonStringNotEqualsJsonStringErrorRaised($expected, $actual) |
|
| 2942 | + { |
|
| 2943 | + $this->expectException(AssertionFailedError::class); |
|
| 2944 | + |
|
| 2945 | + $this->assertJsonStringNotEqualsJsonString($expected, $actual); |
|
| 2946 | + } |
|
| 2947 | + |
|
| 2948 | + public function testAssertJsonStringEqualsJsonFile() |
|
| 2949 | + { |
|
| 2950 | + $file = __DIR__ . '/../_files/JsonData/simpleObject.json'; |
|
| 2951 | + $actual = \json_encode(['Mascott' => 'Tux']); |
|
| 2952 | + $message = ''; |
|
| 2953 | + |
|
| 2954 | + $this->assertJsonStringEqualsJsonFile($file, $actual, $message); |
|
| 2955 | + } |
|
| 2956 | + |
|
| 2957 | + public function testAssertJsonStringEqualsJsonFileExpectingExpectationFailedException() |
|
| 2958 | + { |
|
| 2959 | + $file = __DIR__ . '/../_files/JsonData/simpleObject.json'; |
|
| 2960 | + $actual = \json_encode(['Mascott' => 'Beastie']); |
|
| 2961 | + $message = ''; |
|
| 2962 | + |
|
| 2963 | + try { |
|
| 2964 | + $this->assertJsonStringEqualsJsonFile($file, $actual, $message); |
|
| 2965 | + } catch (ExpectationFailedException $e) { |
|
| 2966 | + $this->assertEquals( |
|
| 2967 | + 'Failed asserting that \'{"Mascott":"Beastie"}\' matches JSON string "{"Mascott":"Tux"}".', |
|
| 2968 | + $e->getMessage() |
|
| 2969 | + ); |
|
| 2970 | 2970 | |
| 2971 | - return; |
|
| 2972 | - } |
|
| 2971 | + return; |
|
| 2972 | + } |
|
| 2973 | 2973 | |
| 2974 | - $this->fail('Expected Exception not thrown.'); |
|
| 2975 | - } |
|
| 2974 | + $this->fail('Expected Exception not thrown.'); |
|
| 2975 | + } |
|
| 2976 | 2976 | |
| 2977 | - public function testAssertJsonStringEqualsJsonFileExpectingException() |
|
| 2978 | - { |
|
| 2979 | - $file = __DIR__ . '/../_files/JsonData/simpleObject.json'; |
|
| 2977 | + public function testAssertJsonStringEqualsJsonFileExpectingException() |
|
| 2978 | + { |
|
| 2979 | + $file = __DIR__ . '/../_files/JsonData/simpleObject.json'; |
|
| 2980 | 2980 | |
| 2981 | - try { |
|
| 2982 | - $this->assertJsonStringEqualsJsonFile($file, null); |
|
| 2983 | - } catch (Exception $e) { |
|
| 2984 | - return; |
|
| 2985 | - } |
|
| 2981 | + try { |
|
| 2982 | + $this->assertJsonStringEqualsJsonFile($file, null); |
|
| 2983 | + } catch (Exception $e) { |
|
| 2984 | + return; |
|
| 2985 | + } |
|
| 2986 | 2986 | |
| 2987 | - $this->fail('Expected Exception not thrown.'); |
|
| 2988 | - } |
|
| 2987 | + $this->fail('Expected Exception not thrown.'); |
|
| 2988 | + } |
|
| 2989 | 2989 | |
| 2990 | - public function testAssertJsonStringNotEqualsJsonFile() |
|
| 2991 | - { |
|
| 2992 | - $file = __DIR__ . '/../_files/JsonData/simpleObject.json'; |
|
| 2993 | - $actual = \json_encode(['Mascott' => 'Beastie']); |
|
| 2994 | - $message = ''; |
|
| 2990 | + public function testAssertJsonStringNotEqualsJsonFile() |
|
| 2991 | + { |
|
| 2992 | + $file = __DIR__ . '/../_files/JsonData/simpleObject.json'; |
|
| 2993 | + $actual = \json_encode(['Mascott' => 'Beastie']); |
|
| 2994 | + $message = ''; |
|
| 2995 | 2995 | |
| 2996 | - $this->assertJsonStringNotEqualsJsonFile($file, $actual, $message); |
|
| 2997 | - } |
|
| 2996 | + $this->assertJsonStringNotEqualsJsonFile($file, $actual, $message); |
|
| 2997 | + } |
|
| 2998 | 2998 | |
| 2999 | - public function testAssertJsonStringNotEqualsJsonFileExpectingException() |
|
| 3000 | - { |
|
| 3001 | - $file = __DIR__ . '/../_files/JsonData/simpleObject.json'; |
|
| 2999 | + public function testAssertJsonStringNotEqualsJsonFileExpectingException() |
|
| 3000 | + { |
|
| 3001 | + $file = __DIR__ . '/../_files/JsonData/simpleObject.json'; |
|
| 3002 | 3002 | |
| 3003 | - try { |
|
| 3004 | - $this->assertJsonStringNotEqualsJsonFile($file, null); |
|
| 3005 | - } catch (Exception $e) { |
|
| 3006 | - return; |
|
| 3007 | - } |
|
| 3003 | + try { |
|
| 3004 | + $this->assertJsonStringNotEqualsJsonFile($file, null); |
|
| 3005 | + } catch (Exception $e) { |
|
| 3006 | + return; |
|
| 3007 | + } |
|
| 3008 | 3008 | |
| 3009 | - $this->fail('Expected exception not found.'); |
|
| 3010 | - } |
|
| 3009 | + $this->fail('Expected exception not found.'); |
|
| 3010 | + } |
|
| 3011 | 3011 | |
| 3012 | - public function testAssertJsonFileNotEqualsJsonFile() |
|
| 3013 | - { |
|
| 3014 | - $fileExpected = __DIR__ . '/../_files/JsonData/simpleObject.json'; |
|
| 3015 | - $fileActual = __DIR__ . '/../_files/JsonData/arrayObject.json'; |
|
| 3016 | - $message = ''; |
|
| 3012 | + public function testAssertJsonFileNotEqualsJsonFile() |
|
| 3013 | + { |
|
| 3014 | + $fileExpected = __DIR__ . '/../_files/JsonData/simpleObject.json'; |
|
| 3015 | + $fileActual = __DIR__ . '/../_files/JsonData/arrayObject.json'; |
|
| 3016 | + $message = ''; |
|
| 3017 | 3017 | |
| 3018 | - $this->assertJsonFileNotEqualsJsonFile($fileExpected, $fileActual, $message); |
|
| 3019 | - } |
|
| 3018 | + $this->assertJsonFileNotEqualsJsonFile($fileExpected, $fileActual, $message); |
|
| 3019 | + } |
|
| 3020 | 3020 | |
| 3021 | - public function testAssertJsonFileEqualsJsonFile() |
|
| 3022 | - { |
|
| 3023 | - $file = __DIR__ . '/../_files/JsonData/simpleObject.json'; |
|
| 3024 | - $message = ''; |
|
| 3021 | + public function testAssertJsonFileEqualsJsonFile() |
|
| 3022 | + { |
|
| 3023 | + $file = __DIR__ . '/../_files/JsonData/simpleObject.json'; |
|
| 3024 | + $message = ''; |
|
| 3025 | 3025 | |
| 3026 | - $this->assertJsonFileEqualsJsonFile($file, $file, $message); |
|
| 3027 | - } |
|
| 3026 | + $this->assertJsonFileEqualsJsonFile($file, $file, $message); |
|
| 3027 | + } |
|
| 3028 | 3028 | |
| 3029 | - public function testAssertInstanceOf() |
|
| 3030 | - { |
|
| 3031 | - $this->assertInstanceOf(\stdClass::class, new \stdClass); |
|
| 3029 | + public function testAssertInstanceOf() |
|
| 3030 | + { |
|
| 3031 | + $this->assertInstanceOf(\stdClass::class, new \stdClass); |
|
| 3032 | 3032 | |
| 3033 | - $this->expectException(AssertionFailedError::class); |
|
| 3033 | + $this->expectException(AssertionFailedError::class); |
|
| 3034 | 3034 | |
| 3035 | - $this->assertInstanceOf(\Exception::class, new \stdClass); |
|
| 3036 | - } |
|
| 3035 | + $this->assertInstanceOf(\Exception::class, new \stdClass); |
|
| 3036 | + } |
|
| 3037 | 3037 | |
| 3038 | - public function testAssertInstanceOfThrowsExceptionForInvalidArgument() |
|
| 3039 | - { |
|
| 3040 | - $this->expectException(Exception::class); |
|
| 3038 | + public function testAssertInstanceOfThrowsExceptionForInvalidArgument() |
|
| 3039 | + { |
|
| 3040 | + $this->expectException(Exception::class); |
|
| 3041 | 3041 | |
| 3042 | - $this->assertInstanceOf(null, new \stdClass); |
|
| 3043 | - } |
|
| 3042 | + $this->assertInstanceOf(null, new \stdClass); |
|
| 3043 | + } |
|
| 3044 | 3044 | |
| 3045 | - public function testAssertAttributeInstanceOf() |
|
| 3046 | - { |
|
| 3047 | - $o = new \stdClass; |
|
| 3048 | - $o->a = new \stdClass; |
|
| 3045 | + public function testAssertAttributeInstanceOf() |
|
| 3046 | + { |
|
| 3047 | + $o = new \stdClass; |
|
| 3048 | + $o->a = new \stdClass; |
|
| 3049 | 3049 | |
| 3050 | - $this->assertAttributeInstanceOf(\stdClass::class, 'a', $o); |
|
| 3051 | - } |
|
| 3050 | + $this->assertAttributeInstanceOf(\stdClass::class, 'a', $o); |
|
| 3051 | + } |
|
| 3052 | 3052 | |
| 3053 | - public function testAssertNotInstanceOf() |
|
| 3054 | - { |
|
| 3055 | - $this->assertNotInstanceOf(\Exception::class, new \stdClass); |
|
| 3053 | + public function testAssertNotInstanceOf() |
|
| 3054 | + { |
|
| 3055 | + $this->assertNotInstanceOf(\Exception::class, new \stdClass); |
|
| 3056 | 3056 | |
| 3057 | - $this->expectException(AssertionFailedError::class); |
|
| 3057 | + $this->expectException(AssertionFailedError::class); |
|
| 3058 | 3058 | |
| 3059 | - $this->assertNotInstanceOf(\stdClass::class, new \stdClass); |
|
| 3060 | - } |
|
| 3059 | + $this->assertNotInstanceOf(\stdClass::class, new \stdClass); |
|
| 3060 | + } |
|
| 3061 | 3061 | |
| 3062 | - public function testAssertNotInstanceOfThrowsExceptionForInvalidArgument() |
|
| 3063 | - { |
|
| 3064 | - $this->expectException(Exception::class); |
|
| 3062 | + public function testAssertNotInstanceOfThrowsExceptionForInvalidArgument() |
|
| 3063 | + { |
|
| 3064 | + $this->expectException(Exception::class); |
|
| 3065 | 3065 | |
| 3066 | - $this->assertNotInstanceOf(null, new \stdClass); |
|
| 3067 | - } |
|
| 3066 | + $this->assertNotInstanceOf(null, new \stdClass); |
|
| 3067 | + } |
|
| 3068 | 3068 | |
| 3069 | - public function testAssertAttributeNotInstanceOf() |
|
| 3070 | - { |
|
| 3071 | - $o = new \stdClass; |
|
| 3072 | - $o->a = new \stdClass; |
|
| 3069 | + public function testAssertAttributeNotInstanceOf() |
|
| 3070 | + { |
|
| 3071 | + $o = new \stdClass; |
|
| 3072 | + $o->a = new \stdClass; |
|
| 3073 | 3073 | |
| 3074 | - $this->assertAttributeNotInstanceOf(\Exception::class, 'a', $o); |
|
| 3075 | - } |
|
| 3074 | + $this->assertAttributeNotInstanceOf(\Exception::class, 'a', $o); |
|
| 3075 | + } |
|
| 3076 | 3076 | |
| 3077 | - public function testAssertInternalType() |
|
| 3078 | - { |
|
| 3079 | - $this->assertInternalType('integer', 1); |
|
| 3077 | + public function testAssertInternalType() |
|
| 3078 | + { |
|
| 3079 | + $this->assertInternalType('integer', 1); |
|
| 3080 | 3080 | |
| 3081 | - $this->expectException(AssertionFailedError::class); |
|
| 3081 | + $this->expectException(AssertionFailedError::class); |
|
| 3082 | 3082 | |
| 3083 | - $this->assertInternalType('string', 1); |
|
| 3084 | - } |
|
| 3083 | + $this->assertInternalType('string', 1); |
|
| 3084 | + } |
|
| 3085 | 3085 | |
| 3086 | - public function testAssertInternalTypeDouble() |
|
| 3087 | - { |
|
| 3088 | - $this->assertInternalType('double', 1.0); |
|
| 3086 | + public function testAssertInternalTypeDouble() |
|
| 3087 | + { |
|
| 3088 | + $this->assertInternalType('double', 1.0); |
|
| 3089 | 3089 | |
| 3090 | - $this->expectException(AssertionFailedError::class); |
|
| 3090 | + $this->expectException(AssertionFailedError::class); |
|
| 3091 | 3091 | |
| 3092 | - $this->assertInternalType('double', 1); |
|
| 3093 | - } |
|
| 3092 | + $this->assertInternalType('double', 1); |
|
| 3093 | + } |
|
| 3094 | 3094 | |
| 3095 | - public function testAssertInternalTypeThrowsExceptionForInvalidArgument() |
|
| 3096 | - { |
|
| 3097 | - $this->expectException(Exception::class); |
|
| 3095 | + public function testAssertInternalTypeThrowsExceptionForInvalidArgument() |
|
| 3096 | + { |
|
| 3097 | + $this->expectException(Exception::class); |
|
| 3098 | 3098 | |
| 3099 | - $this->assertInternalType(null, 1); |
|
| 3100 | - } |
|
| 3099 | + $this->assertInternalType(null, 1); |
|
| 3100 | + } |
|
| 3101 | 3101 | |
| 3102 | - public function testAssertAttributeInternalType() |
|
| 3103 | - { |
|
| 3104 | - $o = new \stdClass; |
|
| 3105 | - $o->a = 1; |
|
| 3102 | + public function testAssertAttributeInternalType() |
|
| 3103 | + { |
|
| 3104 | + $o = new \stdClass; |
|
| 3105 | + $o->a = 1; |
|
| 3106 | 3106 | |
| 3107 | - $this->assertAttributeInternalType('integer', 'a', $o); |
|
| 3108 | - } |
|
| 3107 | + $this->assertAttributeInternalType('integer', 'a', $o); |
|
| 3108 | + } |
|
| 3109 | 3109 | |
| 3110 | - public function testAssertNotInternalType() |
|
| 3111 | - { |
|
| 3112 | - $this->assertNotInternalType('string', 1); |
|
| 3110 | + public function testAssertNotInternalType() |
|
| 3111 | + { |
|
| 3112 | + $this->assertNotInternalType('string', 1); |
|
| 3113 | 3113 | |
| 3114 | - $this->expectException(AssertionFailedError::class); |
|
| 3114 | + $this->expectException(AssertionFailedError::class); |
|
| 3115 | 3115 | |
| 3116 | - $this->assertNotInternalType('integer', 1); |
|
| 3117 | - } |
|
| 3116 | + $this->assertNotInternalType('integer', 1); |
|
| 3117 | + } |
|
| 3118 | 3118 | |
| 3119 | - public function testAssertNotInternalTypeThrowsExceptionForInvalidArgument() |
|
| 3120 | - { |
|
| 3121 | - $this->expectException(Exception::class); |
|
| 3119 | + public function testAssertNotInternalTypeThrowsExceptionForInvalidArgument() |
|
| 3120 | + { |
|
| 3121 | + $this->expectException(Exception::class); |
|
| 3122 | 3122 | |
| 3123 | - $this->assertNotInternalType(null, 1); |
|
| 3124 | - } |
|
| 3123 | + $this->assertNotInternalType(null, 1); |
|
| 3124 | + } |
|
| 3125 | 3125 | |
| 3126 | - public function testAssertAttributeNotInternalType() |
|
| 3127 | - { |
|
| 3128 | - $o = new \stdClass; |
|
| 3129 | - $o->a = 1; |
|
| 3126 | + public function testAssertAttributeNotInternalType() |
|
| 3127 | + { |
|
| 3128 | + $o = new \stdClass; |
|
| 3129 | + $o->a = 1; |
|
| 3130 | 3130 | |
| 3131 | - $this->assertAttributeNotInternalType('string', 'a', $o); |
|
| 3132 | - } |
|
| 3131 | + $this->assertAttributeNotInternalType('string', 'a', $o); |
|
| 3132 | + } |
|
| 3133 | 3133 | |
| 3134 | - public function testAssertStringMatchesFormatFileThrowsExceptionForInvalidArgument() |
|
| 3135 | - { |
|
| 3136 | - $this->expectException(Exception::class); |
|
| 3134 | + public function testAssertStringMatchesFormatFileThrowsExceptionForInvalidArgument() |
|
| 3135 | + { |
|
| 3136 | + $this->expectException(Exception::class); |
|
| 3137 | 3137 | |
| 3138 | - $this->assertStringMatchesFormatFile('not_existing_file', ''); |
|
| 3139 | - } |
|
| 3138 | + $this->assertStringMatchesFormatFile('not_existing_file', ''); |
|
| 3139 | + } |
|
| 3140 | 3140 | |
| 3141 | - public function testAssertStringMatchesFormatFileThrowsExceptionForInvalidArgument2() |
|
| 3142 | - { |
|
| 3143 | - $this->expectException(Exception::class); |
|
| 3141 | + public function testAssertStringMatchesFormatFileThrowsExceptionForInvalidArgument2() |
|
| 3142 | + { |
|
| 3143 | + $this->expectException(Exception::class); |
|
| 3144 | 3144 | |
| 3145 | - $this->assertStringMatchesFormatFile($this->filesDirectory . 'expectedFileFormat.txt', null); |
|
| 3146 | - } |
|
| 3145 | + $this->assertStringMatchesFormatFile($this->filesDirectory . 'expectedFileFormat.txt', null); |
|
| 3146 | + } |
|
| 3147 | 3147 | |
| 3148 | - public function testAssertStringMatchesFormatFile() |
|
| 3149 | - { |
|
| 3150 | - $this->assertStringMatchesFormatFile($this->filesDirectory . 'expectedFileFormat.txt', "FOO\n"); |
|
| 3148 | + public function testAssertStringMatchesFormatFile() |
|
| 3149 | + { |
|
| 3150 | + $this->assertStringMatchesFormatFile($this->filesDirectory . 'expectedFileFormat.txt', "FOO\n"); |
|
| 3151 | 3151 | |
| 3152 | - $this->expectException(AssertionFailedError::class); |
|
| 3152 | + $this->expectException(AssertionFailedError::class); |
|
| 3153 | 3153 | |
| 3154 | - $this->assertStringMatchesFormatFile($this->filesDirectory . 'expectedFileFormat.txt', "BAR\n"); |
|
| 3155 | - } |
|
| 3154 | + $this->assertStringMatchesFormatFile($this->filesDirectory . 'expectedFileFormat.txt', "BAR\n"); |
|
| 3155 | + } |
|
| 3156 | 3156 | |
| 3157 | - public function testAssertStringNotMatchesFormatFileThrowsExceptionForInvalidArgument() |
|
| 3158 | - { |
|
| 3159 | - $this->expectException(Exception::class); |
|
| 3157 | + public function testAssertStringNotMatchesFormatFileThrowsExceptionForInvalidArgument() |
|
| 3158 | + { |
|
| 3159 | + $this->expectException(Exception::class); |
|
| 3160 | 3160 | |
| 3161 | - $this->assertStringNotMatchesFormatFile('not_existing_file', ''); |
|
| 3162 | - } |
|
| 3161 | + $this->assertStringNotMatchesFormatFile('not_existing_file', ''); |
|
| 3162 | + } |
|
| 3163 | 3163 | |
| 3164 | - public function testAssertStringNotMatchesFormatFileThrowsExceptionForInvalidArgument2() |
|
| 3165 | - { |
|
| 3166 | - $this->expectException(Exception::class); |
|
| 3164 | + public function testAssertStringNotMatchesFormatFileThrowsExceptionForInvalidArgument2() |
|
| 3165 | + { |
|
| 3166 | + $this->expectException(Exception::class); |
|
| 3167 | 3167 | |
| 3168 | - $this->assertStringNotMatchesFormatFile($this->filesDirectory . 'expectedFileFormat.txt', null); |
|
| 3169 | - } |
|
| 3168 | + $this->assertStringNotMatchesFormatFile($this->filesDirectory . 'expectedFileFormat.txt', null); |
|
| 3169 | + } |
|
| 3170 | 3170 | |
| 3171 | - public function testAssertStringNotMatchesFormatFile() |
|
| 3172 | - { |
|
| 3173 | - $this->assertStringNotMatchesFormatFile($this->filesDirectory . 'expectedFileFormat.txt', "BAR\n"); |
|
| 3171 | + public function testAssertStringNotMatchesFormatFile() |
|
| 3172 | + { |
|
| 3173 | + $this->assertStringNotMatchesFormatFile($this->filesDirectory . 'expectedFileFormat.txt', "BAR\n"); |
|
| 3174 | 3174 | |
| 3175 | - $this->expectException(AssertionFailedError::class); |
|
| 3175 | + $this->expectException(AssertionFailedError::class); |
|
| 3176 | 3176 | |
| 3177 | - $this->assertStringNotMatchesFormatFile($this->filesDirectory . 'expectedFileFormat.txt', "FOO\n"); |
|
| 3178 | - } |
|
| 3177 | + $this->assertStringNotMatchesFormatFile($this->filesDirectory . 'expectedFileFormat.txt', "FOO\n"); |
|
| 3178 | + } |
|
| 3179 | 3179 | |
| 3180 | - /** |
|
| 3181 | - * @return array<string, string[]> |
|
| 3182 | - */ |
|
| 3183 | - public static function validInvalidJsonDataprovider() |
|
| 3184 | - { |
|
| 3185 | - return [ |
|
| 3186 | - 'error syntax in expected JSON' => ['{"Mascott"::}', '{"Mascott" : "Tux"}'], |
|
| 3187 | - 'error UTF-8 in actual JSON' => ['{"Mascott" : "Tux"}', '{"Mascott" : :}'], |
|
| 3188 | - ]; |
|
| 3189 | - } |
|
| 3180 | + /** |
|
| 3181 | + * @return array<string, string[]> |
|
| 3182 | + */ |
|
| 3183 | + public static function validInvalidJsonDataprovider() |
|
| 3184 | + { |
|
| 3185 | + return [ |
|
| 3186 | + 'error syntax in expected JSON' => ['{"Mascott"::}', '{"Mascott" : "Tux"}'], |
|
| 3187 | + 'error UTF-8 in actual JSON' => ['{"Mascott" : "Tux"}', '{"Mascott" : :}'], |
|
| 3188 | + ]; |
|
| 3189 | + } |
|
| 3190 | 3190 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | protected function setUp() |
| 23 | 23 | { |
| 24 | - $this->filesDirectory = \dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR; |
|
| 24 | + $this->filesDirectory = \dirname(__DIR__).DIRECTORY_SEPARATOR.'_files'.DIRECTORY_SEPARATOR; |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | public function testFail() |
@@ -506,7 +506,7 @@ discard block |
||
| 506 | 506 | $object = new \SampleClass(4, 8, 15); |
| 507 | 507 | // cannot use $filesDirectory, because neither setUp() nor |
| 508 | 508 | // setUpBeforeClass() are executed before the data providers |
| 509 | - $file = \dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'foo.xml'; |
|
| 509 | + $file = \dirname(__DIR__).DIRECTORY_SEPARATOR.'_files'.DIRECTORY_SEPARATOR.'foo.xml'; |
|
| 510 | 510 | $resource = \fopen($file, 'r'); |
| 511 | 511 | |
| 512 | 512 | return [ |
@@ -557,14 +557,14 @@ discard block |
||
| 557 | 557 | |
| 558 | 558 | // cannot use $filesDirectory, because neither setUp() nor |
| 559 | 559 | // setUpBeforeClass() are executed before the data providers |
| 560 | - $file = \dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'foo.xml'; |
|
| 560 | + $file = \dirname(__DIR__).DIRECTORY_SEPARATOR.'_files'.DIRECTORY_SEPARATOR.'foo.xml'; |
|
| 561 | 561 | |
| 562 | 562 | return [ |
| 563 | 563 | // strings |
| 564 | 564 | ['a', 'b'], |
| 565 | 565 | ['a', 'A'], |
| 566 | 566 | // https://github.com/sebastianbergmann/phpunit/issues/1023 |
| 567 | - ['9E6666666','9E7777777'], |
|
| 567 | + ['9E6666666', '9E7777777'], |
|
| 568 | 568 | // integers |
| 569 | 569 | [1, 2], |
| 570 | 570 | [2, 1], |
@@ -885,60 +885,60 @@ discard block |
||
| 885 | 885 | public function testAssertXmlFileEqualsXmlFile() |
| 886 | 886 | { |
| 887 | 887 | $this->assertXmlFileEqualsXmlFile( |
| 888 | - $this->filesDirectory . 'foo.xml', |
|
| 889 | - $this->filesDirectory . 'foo.xml' |
|
| 888 | + $this->filesDirectory.'foo.xml', |
|
| 889 | + $this->filesDirectory.'foo.xml' |
|
| 890 | 890 | ); |
| 891 | 891 | |
| 892 | 892 | $this->expectException(AssertionFailedError::class); |
| 893 | 893 | |
| 894 | 894 | $this->assertXmlFileEqualsXmlFile( |
| 895 | - $this->filesDirectory . 'foo.xml', |
|
| 896 | - $this->filesDirectory . 'bar.xml' |
|
| 895 | + $this->filesDirectory.'foo.xml', |
|
| 896 | + $this->filesDirectory.'bar.xml' |
|
| 897 | 897 | ); |
| 898 | 898 | } |
| 899 | 899 | |
| 900 | 900 | public function testAssertXmlFileNotEqualsXmlFile() |
| 901 | 901 | { |
| 902 | 902 | $this->assertXmlFileNotEqualsXmlFile( |
| 903 | - $this->filesDirectory . 'foo.xml', |
|
| 904 | - $this->filesDirectory . 'bar.xml' |
|
| 903 | + $this->filesDirectory.'foo.xml', |
|
| 904 | + $this->filesDirectory.'bar.xml' |
|
| 905 | 905 | ); |
| 906 | 906 | |
| 907 | 907 | $this->expectException(AssertionFailedError::class); |
| 908 | 908 | |
| 909 | 909 | $this->assertXmlFileNotEqualsXmlFile( |
| 910 | - $this->filesDirectory . 'foo.xml', |
|
| 911 | - $this->filesDirectory . 'foo.xml' |
|
| 910 | + $this->filesDirectory.'foo.xml', |
|
| 911 | + $this->filesDirectory.'foo.xml' |
|
| 912 | 912 | ); |
| 913 | 913 | } |
| 914 | 914 | |
| 915 | 915 | public function testAssertXmlStringEqualsXmlFile() |
| 916 | 916 | { |
| 917 | 917 | $this->assertXmlStringEqualsXmlFile( |
| 918 | - $this->filesDirectory . 'foo.xml', |
|
| 919 | - \file_get_contents($this->filesDirectory . 'foo.xml') |
|
| 918 | + $this->filesDirectory.'foo.xml', |
|
| 919 | + \file_get_contents($this->filesDirectory.'foo.xml') |
|
| 920 | 920 | ); |
| 921 | 921 | |
| 922 | 922 | $this->expectException(AssertionFailedError::class); |
| 923 | 923 | |
| 924 | 924 | $this->assertXmlStringEqualsXmlFile( |
| 925 | - $this->filesDirectory . 'foo.xml', |
|
| 926 | - \file_get_contents($this->filesDirectory . 'bar.xml') |
|
| 925 | + $this->filesDirectory.'foo.xml', |
|
| 926 | + \file_get_contents($this->filesDirectory.'bar.xml') |
|
| 927 | 927 | ); |
| 928 | 928 | } |
| 929 | 929 | |
| 930 | 930 | public function testXmlStringNotEqualsXmlFile() |
| 931 | 931 | { |
| 932 | 932 | $this->assertXmlStringNotEqualsXmlFile( |
| 933 | - $this->filesDirectory . 'foo.xml', |
|
| 934 | - \file_get_contents($this->filesDirectory . 'bar.xml') |
|
| 933 | + $this->filesDirectory.'foo.xml', |
|
| 934 | + \file_get_contents($this->filesDirectory.'bar.xml') |
|
| 935 | 935 | ); |
| 936 | 936 | |
| 937 | 937 | $this->expectException(AssertionFailedError::class); |
| 938 | 938 | |
| 939 | 939 | $this->assertXmlStringNotEqualsXmlFile( |
| 940 | - $this->filesDirectory . 'foo.xml', |
|
| 941 | - \file_get_contents($this->filesDirectory . 'foo.xml') |
|
| 940 | + $this->filesDirectory.'foo.xml', |
|
| 941 | + \file_get_contents($this->filesDirectory.'foo.xml') |
|
| 942 | 942 | ); |
| 943 | 943 | } |
| 944 | 944 | |
@@ -995,10 +995,10 @@ discard block |
||
| 995 | 995 | public function testXMLStructureIsSame() |
| 996 | 996 | { |
| 997 | 997 | $expected = new \DOMDocument; |
| 998 | - $expected->load($this->filesDirectory . 'structureExpected.xml'); |
|
| 998 | + $expected->load($this->filesDirectory.'structureExpected.xml'); |
|
| 999 | 999 | |
| 1000 | 1000 | $actual = new \DOMDocument; |
| 1001 | - $actual->load($this->filesDirectory . 'structureExpected.xml'); |
|
| 1001 | + $actual->load($this->filesDirectory.'structureExpected.xml'); |
|
| 1002 | 1002 | |
| 1003 | 1003 | $this->assertEqualXMLStructure( |
| 1004 | 1004 | $expected->firstChild, |
@@ -1010,10 +1010,10 @@ discard block |
||
| 1010 | 1010 | public function testXMLStructureWrongNumberOfAttributes() |
| 1011 | 1011 | { |
| 1012 | 1012 | $expected = new \DOMDocument; |
| 1013 | - $expected->load($this->filesDirectory . 'structureExpected.xml'); |
|
| 1013 | + $expected->load($this->filesDirectory.'structureExpected.xml'); |
|
| 1014 | 1014 | |
| 1015 | 1015 | $actual = new \DOMDocument; |
| 1016 | - $actual->load($this->filesDirectory . 'structureWrongNumberOfAttributes.xml'); |
|
| 1016 | + $actual->load($this->filesDirectory.'structureWrongNumberOfAttributes.xml'); |
|
| 1017 | 1017 | |
| 1018 | 1018 | $this->expectException(ExpectationFailedException::class); |
| 1019 | 1019 | |
@@ -1027,10 +1027,10 @@ discard block |
||
| 1027 | 1027 | public function testXMLStructureWrongNumberOfNodes() |
| 1028 | 1028 | { |
| 1029 | 1029 | $expected = new \DOMDocument; |
| 1030 | - $expected->load($this->filesDirectory . 'structureExpected.xml'); |
|
| 1030 | + $expected->load($this->filesDirectory.'structureExpected.xml'); |
|
| 1031 | 1031 | |
| 1032 | 1032 | $actual = new \DOMDocument; |
| 1033 | - $actual->load($this->filesDirectory . 'structureWrongNumberOfNodes.xml'); |
|
| 1033 | + $actual->load($this->filesDirectory.'structureWrongNumberOfNodes.xml'); |
|
| 1034 | 1034 | |
| 1035 | 1035 | $this->expectException(ExpectationFailedException::class); |
| 1036 | 1036 | |
@@ -1044,10 +1044,10 @@ discard block |
||
| 1044 | 1044 | public function testXMLStructureIsSameButDataIsNot() |
| 1045 | 1045 | { |
| 1046 | 1046 | $expected = new \DOMDocument; |
| 1047 | - $expected->load($this->filesDirectory . 'structureExpected.xml'); |
|
| 1047 | + $expected->load($this->filesDirectory.'structureExpected.xml'); |
|
| 1048 | 1048 | |
| 1049 | 1049 | $actual = new \DOMDocument; |
| 1050 | - $actual->load($this->filesDirectory . 'structureIsSameButDataIsNot.xml'); |
|
| 1050 | + $actual->load($this->filesDirectory.'structureIsSameButDataIsNot.xml'); |
|
| 1051 | 1051 | |
| 1052 | 1052 | $this->assertEqualXMLStructure( |
| 1053 | 1053 | $expected->firstChild, |
@@ -1059,10 +1059,10 @@ discard block |
||
| 1059 | 1059 | public function testXMLStructureAttributesAreSameButValuesAreNot() |
| 1060 | 1060 | { |
| 1061 | 1061 | $expected = new \DOMDocument; |
| 1062 | - $expected->load($this->filesDirectory . 'structureExpected.xml'); |
|
| 1062 | + $expected->load($this->filesDirectory.'structureExpected.xml'); |
|
| 1063 | 1063 | |
| 1064 | 1064 | $actual = new \DOMDocument; |
| 1065 | - $actual->load($this->filesDirectory . 'structureAttributesAreSameButValuesAreNot.xml'); |
|
| 1065 | + $actual->load($this->filesDirectory.'structureAttributesAreSameButValuesAreNot.xml'); |
|
| 1066 | 1066 | |
| 1067 | 1067 | $this->assertEqualXMLStructure( |
| 1068 | 1068 | $expected->firstChild, |
@@ -1074,10 +1074,10 @@ discard block |
||
| 1074 | 1074 | public function testXMLStructureIgnoreTextNodes() |
| 1075 | 1075 | { |
| 1076 | 1076 | $expected = new \DOMDocument; |
| 1077 | - $expected->load($this->filesDirectory . 'structureExpected.xml'); |
|
| 1077 | + $expected->load($this->filesDirectory.'structureExpected.xml'); |
|
| 1078 | 1078 | |
| 1079 | 1079 | $actual = new \DOMDocument; |
| 1080 | - $actual->load($this->filesDirectory . 'structureIgnoreTextNodes.xml'); |
|
| 1080 | + $actual->load($this->filesDirectory.'structureIgnoreTextNodes.xml'); |
|
| 1081 | 1081 | |
| 1082 | 1082 | $this->assertEqualXMLStructure( |
| 1083 | 1083 | $expected->firstChild, |
@@ -1113,7 +1113,7 @@ discard block |
||
| 1113 | 1113 | |
| 1114 | 1114 | $this->expectException(AssertionFailedError::class); |
| 1115 | 1115 | |
| 1116 | - $this->assertIsReadable(__DIR__ . DIRECTORY_SEPARATOR . 'NotExisting'); |
|
| 1116 | + $this->assertIsReadable(__DIR__.DIRECTORY_SEPARATOR.'NotExisting'); |
|
| 1117 | 1117 | } |
| 1118 | 1118 | |
| 1119 | 1119 | public function testAssertNotIsReadableThrowsException() |
@@ -1143,7 +1143,7 @@ discard block |
||
| 1143 | 1143 | |
| 1144 | 1144 | $this->expectException(AssertionFailedError::class); |
| 1145 | 1145 | |
| 1146 | - $this->assertIsWritable(__DIR__ . DIRECTORY_SEPARATOR . 'NotExisting'); |
|
| 1146 | + $this->assertIsWritable(__DIR__.DIRECTORY_SEPARATOR.'NotExisting'); |
|
| 1147 | 1147 | } |
| 1148 | 1148 | |
| 1149 | 1149 | public function testAssertNotIsWritableThrowsException() |
@@ -1173,7 +1173,7 @@ discard block |
||
| 1173 | 1173 | |
| 1174 | 1174 | $this->expectException(AssertionFailedError::class); |
| 1175 | 1175 | |
| 1176 | - $this->assertDirectoryExists(__DIR__ . DIRECTORY_SEPARATOR . 'NotExisting'); |
|
| 1176 | + $this->assertDirectoryExists(__DIR__.DIRECTORY_SEPARATOR.'NotExisting'); |
|
| 1177 | 1177 | } |
| 1178 | 1178 | |
| 1179 | 1179 | public function testAssertDirectoryNotExistsThrowsException() |
@@ -1185,7 +1185,7 @@ discard block |
||
| 1185 | 1185 | |
| 1186 | 1186 | public function testAssertDirectoryNotExists() |
| 1187 | 1187 | { |
| 1188 | - $this->assertDirectoryNotExists(__DIR__ . DIRECTORY_SEPARATOR . 'NotExisting'); |
|
| 1188 | + $this->assertDirectoryNotExists(__DIR__.DIRECTORY_SEPARATOR.'NotExisting'); |
|
| 1189 | 1189 | |
| 1190 | 1190 | $this->expectException(AssertionFailedError::class); |
| 1191 | 1191 | |
@@ -1205,7 +1205,7 @@ discard block |
||
| 1205 | 1205 | |
| 1206 | 1206 | $this->expectException(AssertionFailedError::class); |
| 1207 | 1207 | |
| 1208 | - $this->assertDirectoryIsReadable(__DIR__ . DIRECTORY_SEPARATOR . 'NotExisting'); |
|
| 1208 | + $this->assertDirectoryIsReadable(__DIR__.DIRECTORY_SEPARATOR.'NotExisting'); |
|
| 1209 | 1209 | } |
| 1210 | 1210 | |
| 1211 | 1211 | public function testAssertDirectoryNotIsReadableThrowsException() |
@@ -1228,7 +1228,7 @@ discard block |
||
| 1228 | 1228 | |
| 1229 | 1229 | $this->expectException(AssertionFailedError::class); |
| 1230 | 1230 | |
| 1231 | - $this->assertDirectoryIsWritable(__DIR__ . DIRECTORY_SEPARATOR . 'NotExisting'); |
|
| 1231 | + $this->assertDirectoryIsWritable(__DIR__.DIRECTORY_SEPARATOR.'NotExisting'); |
|
| 1232 | 1232 | } |
| 1233 | 1233 | |
| 1234 | 1234 | public function testAssertDirectoryNotIsWritableThrowsException() |
@@ -1251,7 +1251,7 @@ discard block |
||
| 1251 | 1251 | |
| 1252 | 1252 | $this->expectException(AssertionFailedError::class); |
| 1253 | 1253 | |
| 1254 | - $this->assertFileExists(__DIR__ . DIRECTORY_SEPARATOR . 'NotExisting'); |
|
| 1254 | + $this->assertFileExists(__DIR__.DIRECTORY_SEPARATOR.'NotExisting'); |
|
| 1255 | 1255 | } |
| 1256 | 1256 | |
| 1257 | 1257 | public function testAssertFileNotExistsThrowsException() |
@@ -1263,7 +1263,7 @@ discard block |
||
| 1263 | 1263 | |
| 1264 | 1264 | public function testAssertFileNotExists() |
| 1265 | 1265 | { |
| 1266 | - $this->assertFileNotExists(__DIR__ . DIRECTORY_SEPARATOR . 'NotExisting'); |
|
| 1266 | + $this->assertFileNotExists(__DIR__.DIRECTORY_SEPARATOR.'NotExisting'); |
|
| 1267 | 1267 | |
| 1268 | 1268 | $this->expectException(AssertionFailedError::class); |
| 1269 | 1269 | |
@@ -1283,7 +1283,7 @@ discard block |
||
| 1283 | 1283 | |
| 1284 | 1284 | $this->expectException(AssertionFailedError::class); |
| 1285 | 1285 | |
| 1286 | - $this->assertFileIsReadable(__DIR__ . DIRECTORY_SEPARATOR . 'NotExisting'); |
|
| 1286 | + $this->assertFileIsReadable(__DIR__.DIRECTORY_SEPARATOR.'NotExisting'); |
|
| 1287 | 1287 | } |
| 1288 | 1288 | |
| 1289 | 1289 | public function testAssertFileNotIsReadableThrowsException() |
@@ -1306,7 +1306,7 @@ discard block |
||
| 1306 | 1306 | |
| 1307 | 1307 | $this->expectException(AssertionFailedError::class); |
| 1308 | 1308 | |
| 1309 | - $this->assertFileIsWritable(__DIR__ . DIRECTORY_SEPARATOR . 'NotExisting'); |
|
| 1309 | + $this->assertFileIsWritable(__DIR__.DIRECTORY_SEPARATOR.'NotExisting'); |
|
| 1310 | 1310 | } |
| 1311 | 1311 | |
| 1312 | 1312 | public function testAssertFileNotIsWritableThrowsException() |
@@ -2470,7 +2470,7 @@ discard block |
||
| 2470 | 2470 | { |
| 2471 | 2471 | $this->assertThat( |
| 2472 | 2472 | null, |
| 2473 | - $this->callback(function ($other) { |
|
| 2473 | + $this->callback(function($other) { |
|
| 2474 | 2474 | return true; |
| 2475 | 2475 | }) |
| 2476 | 2476 | ); |
@@ -2484,60 +2484,60 @@ discard block |
||
| 2484 | 2484 | public function testAssertFileEquals() |
| 2485 | 2485 | { |
| 2486 | 2486 | $this->assertFileEquals( |
| 2487 | - $this->filesDirectory . 'foo.xml', |
|
| 2488 | - $this->filesDirectory . 'foo.xml' |
|
| 2487 | + $this->filesDirectory.'foo.xml', |
|
| 2488 | + $this->filesDirectory.'foo.xml' |
|
| 2489 | 2489 | ); |
| 2490 | 2490 | |
| 2491 | 2491 | $this->expectException(AssertionFailedError::class); |
| 2492 | 2492 | |
| 2493 | 2493 | $this->assertFileEquals( |
| 2494 | - $this->filesDirectory . 'foo.xml', |
|
| 2495 | - $this->filesDirectory . 'bar.xml' |
|
| 2494 | + $this->filesDirectory.'foo.xml', |
|
| 2495 | + $this->filesDirectory.'bar.xml' |
|
| 2496 | 2496 | ); |
| 2497 | 2497 | } |
| 2498 | 2498 | |
| 2499 | 2499 | public function testAssertFileNotEquals() |
| 2500 | 2500 | { |
| 2501 | 2501 | $this->assertFileNotEquals( |
| 2502 | - $this->filesDirectory . 'foo.xml', |
|
| 2503 | - $this->filesDirectory . 'bar.xml' |
|
| 2502 | + $this->filesDirectory.'foo.xml', |
|
| 2503 | + $this->filesDirectory.'bar.xml' |
|
| 2504 | 2504 | ); |
| 2505 | 2505 | |
| 2506 | 2506 | $this->expectException(AssertionFailedError::class); |
| 2507 | 2507 | |
| 2508 | 2508 | $this->assertFileNotEquals( |
| 2509 | - $this->filesDirectory . 'foo.xml', |
|
| 2510 | - $this->filesDirectory . 'foo.xml' |
|
| 2509 | + $this->filesDirectory.'foo.xml', |
|
| 2510 | + $this->filesDirectory.'foo.xml' |
|
| 2511 | 2511 | ); |
| 2512 | 2512 | } |
| 2513 | 2513 | |
| 2514 | 2514 | public function testAssertStringEqualsFile() |
| 2515 | 2515 | { |
| 2516 | 2516 | $this->assertStringEqualsFile( |
| 2517 | - $this->filesDirectory . 'foo.xml', |
|
| 2518 | - \file_get_contents($this->filesDirectory . 'foo.xml') |
|
| 2517 | + $this->filesDirectory.'foo.xml', |
|
| 2518 | + \file_get_contents($this->filesDirectory.'foo.xml') |
|
| 2519 | 2519 | ); |
| 2520 | 2520 | |
| 2521 | 2521 | $this->expectException(AssertionFailedError::class); |
| 2522 | 2522 | |
| 2523 | 2523 | $this->assertStringEqualsFile( |
| 2524 | - $this->filesDirectory . 'foo.xml', |
|
| 2525 | - \file_get_contents($this->filesDirectory . 'bar.xml') |
|
| 2524 | + $this->filesDirectory.'foo.xml', |
|
| 2525 | + \file_get_contents($this->filesDirectory.'bar.xml') |
|
| 2526 | 2526 | ); |
| 2527 | 2527 | } |
| 2528 | 2528 | |
| 2529 | 2529 | public function testAssertStringNotEqualsFile() |
| 2530 | 2530 | { |
| 2531 | 2531 | $this->assertStringNotEqualsFile( |
| 2532 | - $this->filesDirectory . 'foo.xml', |
|
| 2533 | - \file_get_contents($this->filesDirectory . 'bar.xml') |
|
| 2532 | + $this->filesDirectory.'foo.xml', |
|
| 2533 | + \file_get_contents($this->filesDirectory.'bar.xml') |
|
| 2534 | 2534 | ); |
| 2535 | 2535 | |
| 2536 | 2536 | $this->expectException(AssertionFailedError::class); |
| 2537 | 2537 | |
| 2538 | 2538 | $this->assertStringNotEqualsFile( |
| 2539 | - $this->filesDirectory . 'foo.xml', |
|
| 2540 | - \file_get_contents($this->filesDirectory . 'foo.xml') |
|
| 2539 | + $this->filesDirectory.'foo.xml', |
|
| 2540 | + \file_get_contents($this->filesDirectory.'foo.xml') |
|
| 2541 | 2541 | ); |
| 2542 | 2542 | } |
| 2543 | 2543 | |
@@ -2947,7 +2947,7 @@ discard block |
||
| 2947 | 2947 | |
| 2948 | 2948 | public function testAssertJsonStringEqualsJsonFile() |
| 2949 | 2949 | { |
| 2950 | - $file = __DIR__ . '/../_files/JsonData/simpleObject.json'; |
|
| 2950 | + $file = __DIR__.'/../_files/JsonData/simpleObject.json'; |
|
| 2951 | 2951 | $actual = \json_encode(['Mascott' => 'Tux']); |
| 2952 | 2952 | $message = ''; |
| 2953 | 2953 | |
@@ -2956,7 +2956,7 @@ discard block |
||
| 2956 | 2956 | |
| 2957 | 2957 | public function testAssertJsonStringEqualsJsonFileExpectingExpectationFailedException() |
| 2958 | 2958 | { |
| 2959 | - $file = __DIR__ . '/../_files/JsonData/simpleObject.json'; |
|
| 2959 | + $file = __DIR__.'/../_files/JsonData/simpleObject.json'; |
|
| 2960 | 2960 | $actual = \json_encode(['Mascott' => 'Beastie']); |
| 2961 | 2961 | $message = ''; |
| 2962 | 2962 | |
@@ -2976,7 +2976,7 @@ discard block |
||
| 2976 | 2976 | |
| 2977 | 2977 | public function testAssertJsonStringEqualsJsonFileExpectingException() |
| 2978 | 2978 | { |
| 2979 | - $file = __DIR__ . '/../_files/JsonData/simpleObject.json'; |
|
| 2979 | + $file = __DIR__.'/../_files/JsonData/simpleObject.json'; |
|
| 2980 | 2980 | |
| 2981 | 2981 | try { |
| 2982 | 2982 | $this->assertJsonStringEqualsJsonFile($file, null); |
@@ -2989,7 +2989,7 @@ discard block |
||
| 2989 | 2989 | |
| 2990 | 2990 | public function testAssertJsonStringNotEqualsJsonFile() |
| 2991 | 2991 | { |
| 2992 | - $file = __DIR__ . '/../_files/JsonData/simpleObject.json'; |
|
| 2992 | + $file = __DIR__.'/../_files/JsonData/simpleObject.json'; |
|
| 2993 | 2993 | $actual = \json_encode(['Mascott' => 'Beastie']); |
| 2994 | 2994 | $message = ''; |
| 2995 | 2995 | |
@@ -2998,7 +2998,7 @@ discard block |
||
| 2998 | 2998 | |
| 2999 | 2999 | public function testAssertJsonStringNotEqualsJsonFileExpectingException() |
| 3000 | 3000 | { |
| 3001 | - $file = __DIR__ . '/../_files/JsonData/simpleObject.json'; |
|
| 3001 | + $file = __DIR__.'/../_files/JsonData/simpleObject.json'; |
|
| 3002 | 3002 | |
| 3003 | 3003 | try { |
| 3004 | 3004 | $this->assertJsonStringNotEqualsJsonFile($file, null); |
@@ -3011,8 +3011,8 @@ discard block |
||
| 3011 | 3011 | |
| 3012 | 3012 | public function testAssertJsonFileNotEqualsJsonFile() |
| 3013 | 3013 | { |
| 3014 | - $fileExpected = __DIR__ . '/../_files/JsonData/simpleObject.json'; |
|
| 3015 | - $fileActual = __DIR__ . '/../_files/JsonData/arrayObject.json'; |
|
| 3014 | + $fileExpected = __DIR__.'/../_files/JsonData/simpleObject.json'; |
|
| 3015 | + $fileActual = __DIR__.'/../_files/JsonData/arrayObject.json'; |
|
| 3016 | 3016 | $message = ''; |
| 3017 | 3017 | |
| 3018 | 3018 | $this->assertJsonFileNotEqualsJsonFile($fileExpected, $fileActual, $message); |
@@ -3020,7 +3020,7 @@ discard block |
||
| 3020 | 3020 | |
| 3021 | 3021 | public function testAssertJsonFileEqualsJsonFile() |
| 3022 | 3022 | { |
| 3023 | - $file = __DIR__ . '/../_files/JsonData/simpleObject.json'; |
|
| 3023 | + $file = __DIR__.'/../_files/JsonData/simpleObject.json'; |
|
| 3024 | 3024 | $message = ''; |
| 3025 | 3025 | |
| 3026 | 3026 | $this->assertJsonFileEqualsJsonFile($file, $file, $message); |
@@ -3142,16 +3142,16 @@ discard block |
||
| 3142 | 3142 | { |
| 3143 | 3143 | $this->expectException(Exception::class); |
| 3144 | 3144 | |
| 3145 | - $this->assertStringMatchesFormatFile($this->filesDirectory . 'expectedFileFormat.txt', null); |
|
| 3145 | + $this->assertStringMatchesFormatFile($this->filesDirectory.'expectedFileFormat.txt', null); |
|
| 3146 | 3146 | } |
| 3147 | 3147 | |
| 3148 | 3148 | public function testAssertStringMatchesFormatFile() |
| 3149 | 3149 | { |
| 3150 | - $this->assertStringMatchesFormatFile($this->filesDirectory . 'expectedFileFormat.txt', "FOO\n"); |
|
| 3150 | + $this->assertStringMatchesFormatFile($this->filesDirectory.'expectedFileFormat.txt', "FOO\n"); |
|
| 3151 | 3151 | |
| 3152 | 3152 | $this->expectException(AssertionFailedError::class); |
| 3153 | 3153 | |
| 3154 | - $this->assertStringMatchesFormatFile($this->filesDirectory . 'expectedFileFormat.txt', "BAR\n"); |
|
| 3154 | + $this->assertStringMatchesFormatFile($this->filesDirectory.'expectedFileFormat.txt', "BAR\n"); |
|
| 3155 | 3155 | } |
| 3156 | 3156 | |
| 3157 | 3157 | public function testAssertStringNotMatchesFormatFileThrowsExceptionForInvalidArgument() |
@@ -3165,16 +3165,16 @@ discard block |
||
| 3165 | 3165 | { |
| 3166 | 3166 | $this->expectException(Exception::class); |
| 3167 | 3167 | |
| 3168 | - $this->assertStringNotMatchesFormatFile($this->filesDirectory . 'expectedFileFormat.txt', null); |
|
| 3168 | + $this->assertStringNotMatchesFormatFile($this->filesDirectory.'expectedFileFormat.txt', null); |
|
| 3169 | 3169 | } |
| 3170 | 3170 | |
| 3171 | 3171 | public function testAssertStringNotMatchesFormatFile() |
| 3172 | 3172 | { |
| 3173 | - $this->assertStringNotMatchesFormatFile($this->filesDirectory . 'expectedFileFormat.txt', "BAR\n"); |
|
| 3173 | + $this->assertStringNotMatchesFormatFile($this->filesDirectory.'expectedFileFormat.txt', "BAR\n"); |
|
| 3174 | 3174 | |
| 3175 | 3175 | $this->expectException(AssertionFailedError::class); |
| 3176 | 3176 | |
| 3177 | - $this->assertStringNotMatchesFormatFile($this->filesDirectory . 'expectedFileFormat.txt', "FOO\n"); |
|
| 3177 | + $this->assertStringNotMatchesFormatFile($this->filesDirectory.'expectedFileFormat.txt', "FOO\n"); |
|
| 3178 | 3178 | } |
| 3179 | 3179 | |
| 3180 | 3180 | /** |
@@ -12,30 +12,30 @@ |
||
| 12 | 12 | |
| 13 | 13 | class TestFailureTest extends TestCase |
| 14 | 14 | { |
| 15 | - public function testToString() |
|
| 16 | - { |
|
| 17 | - $test = new self(__FUNCTION__); |
|
| 18 | - $exception = new Exception('message'); |
|
| 19 | - $failure = new TestFailure($test, $exception); |
|
| 15 | + public function testToString() |
|
| 16 | + { |
|
| 17 | + $test = new self(__FUNCTION__); |
|
| 18 | + $exception = new Exception('message'); |
|
| 19 | + $failure = new TestFailure($test, $exception); |
|
| 20 | 20 | |
| 21 | - $this->assertEquals(__METHOD__ . ': message', $failure->toString()); |
|
| 22 | - } |
|
| 21 | + $this->assertEquals(__METHOD__ . ': message', $failure->toString()); |
|
| 22 | + } |
|
| 23 | 23 | |
| 24 | - public function testToStringForError() |
|
| 25 | - { |
|
| 26 | - $test = new self(__FUNCTION__); |
|
| 27 | - $exception = new \Error('message'); |
|
| 28 | - $failure = new TestFailure($test, $exception); |
|
| 24 | + public function testToStringForError() |
|
| 25 | + { |
|
| 26 | + $test = new self(__FUNCTION__); |
|
| 27 | + $exception = new \Error('message'); |
|
| 28 | + $failure = new TestFailure($test, $exception); |
|
| 29 | 29 | |
| 30 | - $this->assertEquals(__METHOD__ . ': message', $failure->toString()); |
|
| 31 | - } |
|
| 30 | + $this->assertEquals(__METHOD__ . ': message', $failure->toString()); |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - public function testgetExceptionAsString() |
|
| 34 | - { |
|
| 35 | - $test = new self(__FUNCTION__); |
|
| 36 | - $exception = new \Error('message'); |
|
| 37 | - $failure = new TestFailure($test, $exception); |
|
| 33 | + public function testgetExceptionAsString() |
|
| 34 | + { |
|
| 35 | + $test = new self(__FUNCTION__); |
|
| 36 | + $exception = new \Error('message'); |
|
| 37 | + $failure = new TestFailure($test, $exception); |
|
| 38 | 38 | |
| 39 | - $this->assertEquals("Error: message\n", $failure->getExceptionAsString()); |
|
| 40 | - } |
|
| 39 | + $this->assertEquals("Error: message\n", $failure->getExceptionAsString()); |
|
| 40 | + } |
|
| 41 | 41 | } |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | $exception = new Exception('message'); |
| 19 | 19 | $failure = new TestFailure($test, $exception); |
| 20 | 20 | |
| 21 | - $this->assertEquals(__METHOD__ . ': message', $failure->toString()); |
|
| 21 | + $this->assertEquals(__METHOD__.': message', $failure->toString()); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | public function testToStringForError() |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | $exception = new \Error('message'); |
| 28 | 28 | $failure = new TestFailure($test, $exception); |
| 29 | 29 | |
| 30 | - $this->assertEquals(__METHOD__ . ': message', $failure->toString()); |
|
| 30 | + $this->assertEquals(__METHOD__.': message', $failure->toString()); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | public function testgetExceptionAsString() |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | class PhptTestCaseTest extends TestCase |
| 17 | 17 | { |
| 18 | - const EXPECT_CONTENT = <<<EOF |
|
| 18 | + const EXPECT_CONTENT = <<<EOF |
|
| 19 | 19 | --TEST-- |
| 20 | 20 | EXPECT test |
| 21 | 21 | --FILE-- |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | Hello PHPUnit! |
| 25 | 25 | EOF; |
| 26 | 26 | |
| 27 | - const EXPECTF_CONTENT = <<<EOF |
|
| 27 | + const EXPECTF_CONTENT = <<<EOF |
|
| 28 | 28 | --TEST-- |
| 29 | 29 | EXPECTF test |
| 30 | 30 | --FILE-- |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | Hello %s! |
| 34 | 34 | EOF; |
| 35 | 35 | |
| 36 | - const EXPECTREGEX_CONTENT = <<<EOF |
|
| 36 | + const EXPECTREGEX_CONTENT = <<<EOF |
|
| 37 | 37 | --TEST-- |
| 38 | 38 | EXPECTREGEX test |
| 39 | 39 | --FILE-- |
@@ -42,97 +42,97 @@ discard block |
||
| 42 | 42 | Hello [HPU]{4}[nit]{3}! |
| 43 | 43 | EOF; |
| 44 | 44 | |
| 45 | - const FILE_SECTION = <<<EOF |
|
| 45 | + const FILE_SECTION = <<<EOF |
|
| 46 | 46 | <?php echo "Hello PHPUnit!"; ?> |
| 47 | 47 | |
| 48 | 48 | EOF; |
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * @var string |
|
| 52 | - */ |
|
| 53 | - private $dirname; |
|
| 54 | - |
|
| 55 | - /** |
|
| 56 | - * @var string |
|
| 57 | - */ |
|
| 58 | - private $filename; |
|
| 59 | - |
|
| 60 | - /** |
|
| 61 | - * @var PhptTestCase |
|
| 62 | - */ |
|
| 63 | - private $testCase; |
|
| 64 | - |
|
| 65 | - /** |
|
| 66 | - * @var AbstractPhpProcess|\PHPUnit_Framework_MockObject_MockObject |
|
| 67 | - */ |
|
| 68 | - private $phpProcess; |
|
| 69 | - |
|
| 70 | - protected function setUp() |
|
| 71 | - { |
|
| 72 | - $this->dirname = \sys_get_temp_dir(); |
|
| 73 | - $this->filename = $this->dirname . '/phpunit.phpt'; |
|
| 74 | - \touch($this->filename); |
|
| 75 | - |
|
| 76 | - $this->phpProcess = $this->getMockForAbstractClass(AbstractPhpProcess::class, [], '', false); |
|
| 77 | - $this->testCase = new PhptTestCase($this->filename, $this->phpProcess); |
|
| 78 | - } |
|
| 79 | - |
|
| 80 | - protected function tearDown() |
|
| 81 | - { |
|
| 82 | - @\unlink($this->filename); |
|
| 83 | - |
|
| 84 | - $this->filename = null; |
|
| 85 | - $this->testCase = null; |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - /** |
|
| 89 | - * Defines the content of the current PHPT test. |
|
| 90 | - * |
|
| 91 | - * @param string $content |
|
| 92 | - */ |
|
| 93 | - private function setPhpContent($content) |
|
| 94 | - { |
|
| 95 | - \file_put_contents($this->filename, $content); |
|
| 96 | - } |
|
| 97 | - |
|
| 98 | - /** |
|
| 99 | - * Ensures the correct line ending is used for comparison |
|
| 100 | - * |
|
| 101 | - * @param string $content |
|
| 102 | - * |
|
| 103 | - * @return string |
|
| 104 | - */ |
|
| 105 | - private function ensureCorrectEndOfLine($content) |
|
| 106 | - { |
|
| 107 | - return \strtr( |
|
| 108 | - $content, |
|
| 109 | - [ |
|
| 110 | - "\r\n" => PHP_EOL, |
|
| 111 | - "\r" => PHP_EOL, |
|
| 112 | - "\n" => PHP_EOL |
|
| 113 | - ] |
|
| 114 | - ); |
|
| 115 | - } |
|
| 116 | - |
|
| 117 | - public function testShouldRunFileSectionAsTest() |
|
| 118 | - { |
|
| 119 | - $this->setPhpContent($this->ensureCorrectEndOfLine(self::EXPECT_CONTENT)); |
|
| 120 | - |
|
| 121 | - $fileSection = '<?php echo "Hello PHPUnit!"; ?>' . PHP_EOL; |
|
| 122 | - |
|
| 123 | - $this->phpProcess |
|
| 124 | - ->expects($this->once()) |
|
| 125 | - ->method('runJob') |
|
| 126 | - ->with($fileSection) |
|
| 127 | - ->will($this->returnValue(['stdout' => '', 'stderr' => ''])); |
|
| 128 | - |
|
| 129 | - $this->testCase->run(); |
|
| 130 | - } |
|
| 131 | - |
|
| 132 | - public function testRenderFileSection() |
|
| 133 | - { |
|
| 134 | - $this->setPhpContent($this->ensureCorrectEndOfLine( |
|
| 135 | - <<<EOF |
|
| 50 | + /** |
|
| 51 | + * @var string |
|
| 52 | + */ |
|
| 53 | + private $dirname; |
|
| 54 | + |
|
| 55 | + /** |
|
| 56 | + * @var string |
|
| 57 | + */ |
|
| 58 | + private $filename; |
|
| 59 | + |
|
| 60 | + /** |
|
| 61 | + * @var PhptTestCase |
|
| 62 | + */ |
|
| 63 | + private $testCase; |
|
| 64 | + |
|
| 65 | + /** |
|
| 66 | + * @var AbstractPhpProcess|\PHPUnit_Framework_MockObject_MockObject |
|
| 67 | + */ |
|
| 68 | + private $phpProcess; |
|
| 69 | + |
|
| 70 | + protected function setUp() |
|
| 71 | + { |
|
| 72 | + $this->dirname = \sys_get_temp_dir(); |
|
| 73 | + $this->filename = $this->dirname . '/phpunit.phpt'; |
|
| 74 | + \touch($this->filename); |
|
| 75 | + |
|
| 76 | + $this->phpProcess = $this->getMockForAbstractClass(AbstractPhpProcess::class, [], '', false); |
|
| 77 | + $this->testCase = new PhptTestCase($this->filename, $this->phpProcess); |
|
| 78 | + } |
|
| 79 | + |
|
| 80 | + protected function tearDown() |
|
| 81 | + { |
|
| 82 | + @\unlink($this->filename); |
|
| 83 | + |
|
| 84 | + $this->filename = null; |
|
| 85 | + $this->testCase = null; |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + /** |
|
| 89 | + * Defines the content of the current PHPT test. |
|
| 90 | + * |
|
| 91 | + * @param string $content |
|
| 92 | + */ |
|
| 93 | + private function setPhpContent($content) |
|
| 94 | + { |
|
| 95 | + \file_put_contents($this->filename, $content); |
|
| 96 | + } |
|
| 97 | + |
|
| 98 | + /** |
|
| 99 | + * Ensures the correct line ending is used for comparison |
|
| 100 | + * |
|
| 101 | + * @param string $content |
|
| 102 | + * |
|
| 103 | + * @return string |
|
| 104 | + */ |
|
| 105 | + private function ensureCorrectEndOfLine($content) |
|
| 106 | + { |
|
| 107 | + return \strtr( |
|
| 108 | + $content, |
|
| 109 | + [ |
|
| 110 | + "\r\n" => PHP_EOL, |
|
| 111 | + "\r" => PHP_EOL, |
|
| 112 | + "\n" => PHP_EOL |
|
| 113 | + ] |
|
| 114 | + ); |
|
| 115 | + } |
|
| 116 | + |
|
| 117 | + public function testShouldRunFileSectionAsTest() |
|
| 118 | + { |
|
| 119 | + $this->setPhpContent($this->ensureCorrectEndOfLine(self::EXPECT_CONTENT)); |
|
| 120 | + |
|
| 121 | + $fileSection = '<?php echo "Hello PHPUnit!"; ?>' . PHP_EOL; |
|
| 122 | + |
|
| 123 | + $this->phpProcess |
|
| 124 | + ->expects($this->once()) |
|
| 125 | + ->method('runJob') |
|
| 126 | + ->with($fileSection) |
|
| 127 | + ->will($this->returnValue(['stdout' => '', 'stderr' => ''])); |
|
| 128 | + |
|
| 129 | + $this->testCase->run(); |
|
| 130 | + } |
|
| 131 | + |
|
| 132 | + public function testRenderFileSection() |
|
| 133 | + { |
|
| 134 | + $this->setPhpContent($this->ensureCorrectEndOfLine( |
|
| 135 | + <<<EOF |
|
| 136 | 136 | --TEST-- |
| 137 | 137 | Something to decribe it |
| 138 | 138 | --FILE-- |
@@ -140,125 +140,125 @@ discard block |
||
| 140 | 140 | --EXPECT-- |
| 141 | 141 | Something |
| 142 | 142 | EOF |
| 143 | - )); |
|
| 143 | + )); |
|
| 144 | 144 | |
| 145 | - $renderedCode = "<?php echo '" . $this->dirname . "' . '" . $this->filename . "'; ?>" . PHP_EOL; |
|
| 145 | + $renderedCode = "<?php echo '" . $this->dirname . "' . '" . $this->filename . "'; ?>" . PHP_EOL; |
|
| 146 | 146 | |
| 147 | - $this->phpProcess |
|
| 148 | - ->expects($this->once()) |
|
| 149 | - ->method('runJob') |
|
| 150 | - ->with($renderedCode) |
|
| 151 | - ->will($this->returnValue(['stdout' => '', 'stderr' => ''])); |
|
| 147 | + $this->phpProcess |
|
| 148 | + ->expects($this->once()) |
|
| 149 | + ->method('runJob') |
|
| 150 | + ->with($renderedCode) |
|
| 151 | + ->will($this->returnValue(['stdout' => '', 'stderr' => ''])); |
|
| 152 | 152 | |
| 153 | - $this->testCase->run(); |
|
| 154 | - } |
|
| 153 | + $this->testCase->run(); |
|
| 154 | + } |
|
| 155 | 155 | |
| 156 | - public function testRenderSkipifSection() |
|
| 157 | - { |
|
| 158 | - $phptContent = self::EXPECT_CONTENT . PHP_EOL; |
|
| 159 | - $phptContent .= '--SKIPIF--' . PHP_EOL; |
|
| 160 | - $phptContent .= "<?php echo 'skip: ' . __FILE__; ?>" . PHP_EOL; |
|
| 156 | + public function testRenderSkipifSection() |
|
| 157 | + { |
|
| 158 | + $phptContent = self::EXPECT_CONTENT . PHP_EOL; |
|
| 159 | + $phptContent .= '--SKIPIF--' . PHP_EOL; |
|
| 160 | + $phptContent .= "<?php echo 'skip: ' . __FILE__; ?>" . PHP_EOL; |
|
| 161 | 161 | |
| 162 | - $this->setPhpContent($phptContent); |
|
| 162 | + $this->setPhpContent($phptContent); |
|
| 163 | 163 | |
| 164 | - $renderedCode = "<?php echo 'skip: ' . '" . $this->filename . "'; ?>" . PHP_EOL; |
|
| 164 | + $renderedCode = "<?php echo 'skip: ' . '" . $this->filename . "'; ?>" . PHP_EOL; |
|
| 165 | 165 | |
| 166 | - $this->phpProcess |
|
| 167 | - ->expects($this->at(0)) |
|
| 168 | - ->method('runJob') |
|
| 169 | - ->with($renderedCode) |
|
| 170 | - ->will($this->returnValue(['stdout' => '', 'stderr' => ''])); |
|
| 166 | + $this->phpProcess |
|
| 167 | + ->expects($this->at(0)) |
|
| 168 | + ->method('runJob') |
|
| 169 | + ->with($renderedCode) |
|
| 170 | + ->will($this->returnValue(['stdout' => '', 'stderr' => ''])); |
|
| 171 | 171 | |
| 172 | - $this->testCase->run(); |
|
| 173 | - } |
|
| 172 | + $this->testCase->run(); |
|
| 173 | + } |
|
| 174 | 174 | |
| 175 | - public function testShouldRunSkipifSectionWhenExists() |
|
| 176 | - { |
|
| 177 | - $skipifSection = '<?php /** Nothing **/ ?>' . PHP_EOL; |
|
| 175 | + public function testShouldRunSkipifSectionWhenExists() |
|
| 176 | + { |
|
| 177 | + $skipifSection = '<?php /** Nothing **/ ?>' . PHP_EOL; |
|
| 178 | 178 | |
| 179 | - $phptContent = self::EXPECT_CONTENT . PHP_EOL; |
|
| 180 | - $phptContent .= '--SKIPIF--' . PHP_EOL; |
|
| 181 | - $phptContent .= $skipifSection; |
|
| 179 | + $phptContent = self::EXPECT_CONTENT . PHP_EOL; |
|
| 180 | + $phptContent .= '--SKIPIF--' . PHP_EOL; |
|
| 181 | + $phptContent .= $skipifSection; |
|
| 182 | 182 | |
| 183 | - $this->setPhpContent($phptContent); |
|
| 183 | + $this->setPhpContent($phptContent); |
|
| 184 | 184 | |
| 185 | - $this->phpProcess |
|
| 186 | - ->expects($this->at(0)) |
|
| 187 | - ->method('runJob') |
|
| 188 | - ->with($skipifSection) |
|
| 189 | - ->will($this->returnValue(['stdout' => '', 'stderr' => ''])); |
|
| 185 | + $this->phpProcess |
|
| 186 | + ->expects($this->at(0)) |
|
| 187 | + ->method('runJob') |
|
| 188 | + ->with($skipifSection) |
|
| 189 | + ->will($this->returnValue(['stdout' => '', 'stderr' => ''])); |
|
| 190 | 190 | |
| 191 | - $this->testCase->run(); |
|
| 192 | - } |
|
| 191 | + $this->testCase->run(); |
|
| 192 | + } |
|
| 193 | 193 | |
| 194 | - public function testShouldNotRunTestSectionIfSkipifSectionReturnsOutputWithSkipWord() |
|
| 195 | - { |
|
| 196 | - $skipifSection = '<?php echo "skip: Reason"; ?>' . PHP_EOL; |
|
| 194 | + public function testShouldNotRunTestSectionIfSkipifSectionReturnsOutputWithSkipWord() |
|
| 195 | + { |
|
| 196 | + $skipifSection = '<?php echo "skip: Reason"; ?>' . PHP_EOL; |
|
| 197 | 197 | |
| 198 | - $phptContent = self::EXPECT_CONTENT . PHP_EOL; |
|
| 199 | - $phptContent .= '--SKIPIF--' . PHP_EOL; |
|
| 200 | - $phptContent .= $skipifSection; |
|
| 198 | + $phptContent = self::EXPECT_CONTENT . PHP_EOL; |
|
| 199 | + $phptContent .= '--SKIPIF--' . PHP_EOL; |
|
| 200 | + $phptContent .= $skipifSection; |
|
| 201 | 201 | |
| 202 | - $this->setPhpContent($phptContent); |
|
| 202 | + $this->setPhpContent($phptContent); |
|
| 203 | 203 | |
| 204 | - $this->phpProcess |
|
| 205 | - ->expects($this->once()) |
|
| 206 | - ->method('runJob') |
|
| 207 | - ->with($skipifSection) |
|
| 208 | - ->will($this->returnValue(['stdout' => 'skip: Reason', 'stderr' => ''])); |
|
| 204 | + $this->phpProcess |
|
| 205 | + ->expects($this->once()) |
|
| 206 | + ->method('runJob') |
|
| 207 | + ->with($skipifSection) |
|
| 208 | + ->will($this->returnValue(['stdout' => 'skip: Reason', 'stderr' => ''])); |
|
| 209 | 209 | |
| 210 | - $this->testCase->run(); |
|
| 211 | - } |
|
| 210 | + $this->testCase->run(); |
|
| 211 | + } |
|
| 212 | 212 | |
| 213 | - public function testShouldRunCleanSectionWhenDefined() |
|
| 214 | - { |
|
| 215 | - $cleanSection = '<?php unlink("/tmp/something"); ?>' . PHP_EOL; |
|
| 213 | + public function testShouldRunCleanSectionWhenDefined() |
|
| 214 | + { |
|
| 215 | + $cleanSection = '<?php unlink("/tmp/something"); ?>' . PHP_EOL; |
|
| 216 | 216 | |
| 217 | - $phptContent = self::EXPECT_CONTENT . PHP_EOL; |
|
| 218 | - $phptContent .= '--CLEAN--' . PHP_EOL; |
|
| 219 | - $phptContent .= $cleanSection; |
|
| 217 | + $phptContent = self::EXPECT_CONTENT . PHP_EOL; |
|
| 218 | + $phptContent .= '--CLEAN--' . PHP_EOL; |
|
| 219 | + $phptContent .= $cleanSection; |
|
| 220 | 220 | |
| 221 | - $this->setPhpContent($phptContent); |
|
| 221 | + $this->setPhpContent($phptContent); |
|
| 222 | 222 | |
| 223 | - $this->phpProcess |
|
| 224 | - ->expects($this->at(1)) |
|
| 225 | - ->method('runJob') |
|
| 226 | - ->with($cleanSection); |
|
| 223 | + $this->phpProcess |
|
| 224 | + ->expects($this->at(1)) |
|
| 225 | + ->method('runJob') |
|
| 226 | + ->with($cleanSection); |
|
| 227 | 227 | |
| 228 | - $this->testCase->run(); |
|
| 229 | - } |
|
| 228 | + $this->testCase->run(); |
|
| 229 | + } |
|
| 230 | 230 | |
| 231 | - public function testShouldThrowsAnExceptionWhenPhptFileIsEmpty() |
|
| 232 | - { |
|
| 233 | - $this->setPhpContent(''); |
|
| 231 | + public function testShouldThrowsAnExceptionWhenPhptFileIsEmpty() |
|
| 232 | + { |
|
| 233 | + $this->setPhpContent(''); |
|
| 234 | 234 | |
| 235 | - $this->expectException(Exception::class); |
|
| 236 | - $this->expectExceptionMessage('Invalid PHPT file'); |
|
| 235 | + $this->expectException(Exception::class); |
|
| 236 | + $this->expectExceptionMessage('Invalid PHPT file'); |
|
| 237 | 237 | |
| 238 | - $this->testCase->run(); |
|
| 239 | - } |
|
| 238 | + $this->testCase->run(); |
|
| 239 | + } |
|
| 240 | 240 | |
| 241 | - public function testShouldThrowsAnExceptionWhenFileSectionIsMissing() |
|
| 242 | - { |
|
| 243 | - $this->setPhpContent( |
|
| 244 | - <<<EOF |
|
| 241 | + public function testShouldThrowsAnExceptionWhenFileSectionIsMissing() |
|
| 242 | + { |
|
| 243 | + $this->setPhpContent( |
|
| 244 | + <<<EOF |
|
| 245 | 245 | --TEST-- |
| 246 | 246 | Something to decribe it |
| 247 | 247 | --EXPECT-- |
| 248 | 248 | Something |
| 249 | 249 | EOF |
| 250 | - ); |
|
| 250 | + ); |
|
| 251 | 251 | |
| 252 | - $this->expectException(Exception::class); |
|
| 253 | - $this->expectExceptionMessage('Invalid PHPT file'); |
|
| 252 | + $this->expectException(Exception::class); |
|
| 253 | + $this->expectExceptionMessage('Invalid PHPT file'); |
|
| 254 | 254 | |
| 255 | - $this->testCase->run(); |
|
| 256 | - } |
|
| 255 | + $this->testCase->run(); |
|
| 256 | + } |
|
| 257 | 257 | |
| 258 | - public function testShouldThrowsAnExceptionWhenThereIsNoExpecOrExpectifOrExpecregexSectionInPhptFile() |
|
| 259 | - { |
|
| 260 | - $this->setPhpContent( |
|
| 261 | - <<<EOF |
|
| 258 | + public function testShouldThrowsAnExceptionWhenThereIsNoExpecOrExpectifOrExpecregexSectionInPhptFile() |
|
| 259 | + { |
|
| 260 | + $this->setPhpContent( |
|
| 261 | + <<<EOF |
|
| 262 | 262 | --TEST-- |
| 263 | 263 | Something to decribe it |
| 264 | 264 | --FILE-- |
@@ -266,56 +266,56 @@ discard block |
||
| 266 | 266 | echo "Hello world!\n"; |
| 267 | 267 | ?> |
| 268 | 268 | EOF |
| 269 | - ); |
|
| 269 | + ); |
|
| 270 | 270 | |
| 271 | - $this->expectException(Exception::class); |
|
| 272 | - $this->expectExceptionMessage('Invalid PHPT file'); |
|
| 271 | + $this->expectException(Exception::class); |
|
| 272 | + $this->expectExceptionMessage('Invalid PHPT file'); |
|
| 273 | 273 | |
| 274 | - $this->testCase->run(); |
|
| 275 | - } |
|
| 274 | + $this->testCase->run(); |
|
| 275 | + } |
|
| 276 | 276 | |
| 277 | - public function testShouldValidateExpectSession() |
|
| 278 | - { |
|
| 279 | - $this->setPhpContent(self::EXPECT_CONTENT); |
|
| 277 | + public function testShouldValidateExpectSession() |
|
| 278 | + { |
|
| 279 | + $this->setPhpContent(self::EXPECT_CONTENT); |
|
| 280 | 280 | |
| 281 | - $this->phpProcess |
|
| 282 | - ->expects($this->once()) |
|
| 283 | - ->method('runJob') |
|
| 284 | - ->with(self::FILE_SECTION) |
|
| 285 | - ->will($this->returnValue(['stdout' => 'Hello PHPUnit!', 'stderr' => ''])); |
|
| 281 | + $this->phpProcess |
|
| 282 | + ->expects($this->once()) |
|
| 283 | + ->method('runJob') |
|
| 284 | + ->with(self::FILE_SECTION) |
|
| 285 | + ->will($this->returnValue(['stdout' => 'Hello PHPUnit!', 'stderr' => ''])); |
|
| 286 | 286 | |
| 287 | - $result = $this->testCase->run(); |
|
| 287 | + $result = $this->testCase->run(); |
|
| 288 | 288 | |
| 289 | - $this->assertTrue($result->wasSuccessful()); |
|
| 290 | - } |
|
| 289 | + $this->assertTrue($result->wasSuccessful()); |
|
| 290 | + } |
|
| 291 | 291 | |
| 292 | - public function testShouldValidateExpectfSession() |
|
| 293 | - { |
|
| 294 | - $this->setPhpContent(self::EXPECTF_CONTENT); |
|
| 292 | + public function testShouldValidateExpectfSession() |
|
| 293 | + { |
|
| 294 | + $this->setPhpContent(self::EXPECTF_CONTENT); |
|
| 295 | 295 | |
| 296 | - $this->phpProcess |
|
| 297 | - ->expects($this->once()) |
|
| 298 | - ->method('runJob') |
|
| 299 | - ->with(self::FILE_SECTION) |
|
| 300 | - ->will($this->returnValue(['stdout' => 'Hello PHPUnit!', 'stderr' => ''])); |
|
| 296 | + $this->phpProcess |
|
| 297 | + ->expects($this->once()) |
|
| 298 | + ->method('runJob') |
|
| 299 | + ->with(self::FILE_SECTION) |
|
| 300 | + ->will($this->returnValue(['stdout' => 'Hello PHPUnit!', 'stderr' => ''])); |
|
| 301 | 301 | |
| 302 | - $result = $this->testCase->run(); |
|
| 302 | + $result = $this->testCase->run(); |
|
| 303 | 303 | |
| 304 | - $this->assertTrue($result->wasSuccessful()); |
|
| 305 | - } |
|
| 304 | + $this->assertTrue($result->wasSuccessful()); |
|
| 305 | + } |
|
| 306 | 306 | |
| 307 | - public function testShouldValidateExpectregexSession() |
|
| 308 | - { |
|
| 309 | - $this->setPhpContent(self::EXPECTREGEX_CONTENT); |
|
| 307 | + public function testShouldValidateExpectregexSession() |
|
| 308 | + { |
|
| 309 | + $this->setPhpContent(self::EXPECTREGEX_CONTENT); |
|
| 310 | 310 | |
| 311 | - $this->phpProcess |
|
| 312 | - ->expects($this->once()) |
|
| 313 | - ->method('runJob') |
|
| 314 | - ->with(self::FILE_SECTION) |
|
| 315 | - ->will($this->returnValue(['stdout' => 'Hello PHPUnit!', 'stderr' => ''])); |
|
| 311 | + $this->phpProcess |
|
| 312 | + ->expects($this->once()) |
|
| 313 | + ->method('runJob') |
|
| 314 | + ->with(self::FILE_SECTION) |
|
| 315 | + ->will($this->returnValue(['stdout' => 'Hello PHPUnit!', 'stderr' => ''])); |
|
| 316 | 316 | |
| 317 | - $result = $this->testCase->run(); |
|
| 317 | + $result = $this->testCase->run(); |
|
| 318 | 318 | |
| 319 | - $this->assertTrue($result->wasSuccessful()); |
|
| 320 | - } |
|
| 319 | + $this->assertTrue($result->wasSuccessful()); |
|
| 320 | + } |
|
| 321 | 321 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | protected function setUp() |
| 71 | 71 | { |
| 72 | 72 | $this->dirname = \sys_get_temp_dir(); |
| 73 | - $this->filename = $this->dirname . '/phpunit.phpt'; |
|
| 73 | + $this->filename = $this->dirname.'/phpunit.phpt'; |
|
| 74 | 74 | \touch($this->filename); |
| 75 | 75 | |
| 76 | 76 | $this->phpProcess = $this->getMockForAbstractClass(AbstractPhpProcess::class, [], '', false); |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | { |
| 119 | 119 | $this->setPhpContent($this->ensureCorrectEndOfLine(self::EXPECT_CONTENT)); |
| 120 | 120 | |
| 121 | - $fileSection = '<?php echo "Hello PHPUnit!"; ?>' . PHP_EOL; |
|
| 121 | + $fileSection = '<?php echo "Hello PHPUnit!"; ?>'.PHP_EOL; |
|
| 122 | 122 | |
| 123 | 123 | $this->phpProcess |
| 124 | 124 | ->expects($this->once()) |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | EOF |
| 143 | 143 | )); |
| 144 | 144 | |
| 145 | - $renderedCode = "<?php echo '" . $this->dirname . "' . '" . $this->filename . "'; ?>" . PHP_EOL; |
|
| 145 | + $renderedCode = "<?php echo '".$this->dirname."' . '".$this->filename."'; ?>".PHP_EOL; |
|
| 146 | 146 | |
| 147 | 147 | $this->phpProcess |
| 148 | 148 | ->expects($this->once()) |
@@ -155,13 +155,13 @@ discard block |
||
| 155 | 155 | |
| 156 | 156 | public function testRenderSkipifSection() |
| 157 | 157 | { |
| 158 | - $phptContent = self::EXPECT_CONTENT . PHP_EOL; |
|
| 159 | - $phptContent .= '--SKIPIF--' . PHP_EOL; |
|
| 160 | - $phptContent .= "<?php echo 'skip: ' . __FILE__; ?>" . PHP_EOL; |
|
| 158 | + $phptContent = self::EXPECT_CONTENT.PHP_EOL; |
|
| 159 | + $phptContent .= '--SKIPIF--'.PHP_EOL; |
|
| 160 | + $phptContent .= "<?php echo 'skip: ' . __FILE__; ?>".PHP_EOL; |
|
| 161 | 161 | |
| 162 | 162 | $this->setPhpContent($phptContent); |
| 163 | 163 | |
| 164 | - $renderedCode = "<?php echo 'skip: ' . '" . $this->filename . "'; ?>" . PHP_EOL; |
|
| 164 | + $renderedCode = "<?php echo 'skip: ' . '".$this->filename."'; ?>".PHP_EOL; |
|
| 165 | 165 | |
| 166 | 166 | $this->phpProcess |
| 167 | 167 | ->expects($this->at(0)) |
@@ -174,10 +174,10 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | public function testShouldRunSkipifSectionWhenExists() |
| 176 | 176 | { |
| 177 | - $skipifSection = '<?php /** Nothing **/ ?>' . PHP_EOL; |
|
| 177 | + $skipifSection = '<?php /** Nothing **/ ?>'.PHP_EOL; |
|
| 178 | 178 | |
| 179 | - $phptContent = self::EXPECT_CONTENT . PHP_EOL; |
|
| 180 | - $phptContent .= '--SKIPIF--' . PHP_EOL; |
|
| 179 | + $phptContent = self::EXPECT_CONTENT.PHP_EOL; |
|
| 180 | + $phptContent .= '--SKIPIF--'.PHP_EOL; |
|
| 181 | 181 | $phptContent .= $skipifSection; |
| 182 | 182 | |
| 183 | 183 | $this->setPhpContent($phptContent); |
@@ -193,10 +193,10 @@ discard block |
||
| 193 | 193 | |
| 194 | 194 | public function testShouldNotRunTestSectionIfSkipifSectionReturnsOutputWithSkipWord() |
| 195 | 195 | { |
| 196 | - $skipifSection = '<?php echo "skip: Reason"; ?>' . PHP_EOL; |
|
| 196 | + $skipifSection = '<?php echo "skip: Reason"; ?>'.PHP_EOL; |
|
| 197 | 197 | |
| 198 | - $phptContent = self::EXPECT_CONTENT . PHP_EOL; |
|
| 199 | - $phptContent .= '--SKIPIF--' . PHP_EOL; |
|
| 198 | + $phptContent = self::EXPECT_CONTENT.PHP_EOL; |
|
| 199 | + $phptContent .= '--SKIPIF--'.PHP_EOL; |
|
| 200 | 200 | $phptContent .= $skipifSection; |
| 201 | 201 | |
| 202 | 202 | $this->setPhpContent($phptContent); |
@@ -212,10 +212,10 @@ discard block |
||
| 212 | 212 | |
| 213 | 213 | public function testShouldRunCleanSectionWhenDefined() |
| 214 | 214 | { |
| 215 | - $cleanSection = '<?php unlink("/tmp/something"); ?>' . PHP_EOL; |
|
| 215 | + $cleanSection = '<?php unlink("/tmp/something"); ?>'.PHP_EOL; |
|
| 216 | 216 | |
| 217 | - $phptContent = self::EXPECT_CONTENT . PHP_EOL; |
|
| 218 | - $phptContent .= '--CLEAN--' . PHP_EOL; |
|
| 217 | + $phptContent = self::EXPECT_CONTENT.PHP_EOL; |
|
| 218 | + $phptContent .= '--CLEAN--'.PHP_EOL; |
|
| 219 | 219 | $phptContent .= $cleanSection; |
| 220 | 220 | |
| 221 | 221 | $this->setPhpContent($phptContent); |
@@ -6,12 +6,12 @@ |
||
| 6 | 6 | */ |
| 7 | 7 | class NamespaceCoverageCoversClassPublicTest extends TestCase |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * @covers ::publicMethod |
|
| 11 | - */ |
|
| 12 | - public function testSomething() |
|
| 13 | - { |
|
| 14 | - $o = new Foo\CoveredClass; |
|
| 15 | - $o->publicMethod(); |
|
| 16 | - } |
|
| 9 | + /** |
|
| 10 | + * @covers ::publicMethod |
|
| 11 | + */ |
|
| 12 | + public function testSomething() |
|
| 13 | + { |
|
| 14 | + $o = new Foo\CoveredClass; |
|
| 15 | + $o->publicMethod(); |
|
| 16 | + } |
|
| 17 | 17 | } |
@@ -3,11 +3,11 @@ |
||
| 3 | 3 | |
| 4 | 4 | class CoverageNamespacedFunctionTest extends TestCase |
| 5 | 5 | { |
| 6 | - /** |
|
| 7 | - * @covers foo\func() |
|
| 8 | - */ |
|
| 9 | - public function testFunc() |
|
| 10 | - { |
|
| 11 | - foo\func(); |
|
| 12 | - } |
|
| 6 | + /** |
|
| 7 | + * @covers foo\func() |
|
| 8 | + */ |
|
| 9 | + public function testFunc() |
|
| 10 | + { |
|
| 11 | + foo\func(); |
|
| 12 | + } |
|
| 13 | 13 | } |