[TASK] Adjust Log tests for changed exception format in PHP7 59/39859/3
authorAlexander Opitz <opitz.alexander@googlemail.com>
Mon, 1 Jun 2015 10:51:57 +0000 (12:51 +0200)
committerFrank Nägler <typo3@naegler.net>
Fri, 5 Jun 2015 11:57:42 +0000 (13:57 +0200)
https://github.com/php/php-src/commit/3ae995f03c8f60c4a4c9718262545cf5a6a08da3

Resolves: #67189
Releases: master, 6.2
Change-Id: Icc94ebb403d963b6cdb367df8e7a590c581e940c
Reviewed-on: http://review.typo3.org/39859
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Frank Nägler <typo3@naegler.net>
Tested-by: Frank Nägler <typo3@naegler.net>
typo3/sysext/core/Tests/Unit/Log/LogRecordTest.php

index 7685bb9..52926a6 100644 (file)
@@ -157,7 +157,14 @@ class LogRecordTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
        public function toStringIncludesExceptionDataAsJson() {
                $dataArray = array('exception' => new \Exception('foo'));
                $record = $this->getRecord(array('data' => $dataArray));
-               $this->assertContains('\'Exception\' with message \'foo\'', (string)$record);
+               // Since 7.0.0-dev 17.05.2015 the output of Exception is changed.
+               // https://github.com/php/php-src/commit/3ae995f03c8f60c4a4c9718262545cf5a6a08da3
+               // To check for dev version we need to compare with a version before 7.0.0
+               if (version_compare(PHP_VERSION, '6.99.00') >= 0) {
+                       $this->assertContains('Exception: foo', (string)$record);
+               } else {
+                       $this->assertContains('\'Exception\' with message \'foo\'', (string)$record);
+               }
        }
 
 }