I've come across a couple of issues in CakePHP that I want to submit fixes for, but I want to make sure that any changes I make pass the unit tests. Problem is that the unit tests don't quite work for me with out-of-the-box code! I'm assured that the unit tests themselves are fine and pass just fine for others, so it's presumably something in my environment causing the problem.
I'm running CakePHP version 3.2.5 on PHP version 5.6.19. My PHP build configuration (included because I had to rebuild it a couple of times to get it to run this much of the tests, so it's theoretically possible that this is the problem):
'./configure' '--enable-fileinfo' '--enable-phar' '--disable-maintainer-zts' '--enable-bcmath' '--enable-calendar' '--enable-ftp' '--enable-gd-native-ttf' '--enable-libxml' '--enable-mbstring' '--enable-pdo=shared' '--enable-sockets' '--with-apxs2=/usr/sbin/apxs' '--with-curl' '--with-freetype-dir=/usr' '--with-gd' '--with-jpeg-dir=/usr' '--with-kerberos' '--with-libdir=lib64' '--with-mssql=/usr' '--with-mysql=/usr' '--with-mysqli=/usr/bin/mysql_config' '--with-pcre-regex' '--with-pdo-mysql=shared' '--without-sqlite' '--with-sqlite3=shared' '--with-pdo-sqlite=shared,/usr' '--with-pic' '--with-png-dir=/usr' '--with-zlib' '--with-zlib-dir=/usr' '--with-openssl' '--enable-intl'
There may also be php.ini settings that affect some of this?
Commands used to set up CakePHP for the tests
$ git clone git@github.com:cakephp/cakephp.git
$ cd cakephp
First try
$ make test
[bunch of stuff here where it installs all the dependencies]
vendor/bin/phpunit
PHPUnit 5.2.12 by Sebastian Bergmann and contributors.
............................................................. 61 / 6777 ( 0%)
[etc.]
............................................................. 1159 / 6777 ( 17%)
........FF......PHP Fatal error: Call to a member function format() on null in /home/cake/cakephp/tests/TestCase/I18n/DateTest.php on line 170
Fatal error: Call to a member function format() on null in /home/cake/cakephp/tests/TestCase/I18n/DateTest.php on line 170
make: *** [test] Error 255
This one is because it's trying to parse "13 10, 2015" using the fr_FR locale, but it seems that's not valid. I fixed it by changing the string to "13/10/2015" on lines 169 and 185. (I also added assertNotNull
calls.)
Second try
$ make test
[etc.]
............................................................. 4209 / 6777 ( 62%)
.......................FF.......................PHP Fatal error: Call to a member function format() on null in /home/cake/cakephp/tests/TestCase/Database/Type/TimeTypeTest.php on line 184
Fatal error: Call to a member function format() on null in /home/cake/cakephp/tests/TestCase/Database/Type/TimeTypeTest.php on line 184
make: *** [test] Error 255
I didn't fully track this one down, just got it to fail and allow the tests to proceed by adding $this->assertNotNull($result);
.
Third try
$ make test
[etc.]
There were 5 errors:
1) Cake\Test\TestCase\I18n\IcuFormatterTest::testNativePluralSelection
Aura\Intl\Exception\CannotInstantiateFormatter: msgfmt_create: message formatter creation failed: U_ILLEGAL_CHARACTER
/home/cake/cakephp/src/I18n/Formatter/IcuFormatter.php:97
/home/cake/cakephp/src/I18n/Formatter/IcuFormatter.php:51
/home/cake/cakephp/tests/TestCase/I18n/Formatter/IcuFormatterTest.php:81
2) Cake\Test\TestCase\ORM\QueryTest::testCountWithSubselect
PDOException: SQLSTATE[HY000]: General error: 25 bind or column index out of range
/home/cake/cakephp/src/Database/Statement/StatementDecorator.php:171
/home/cake/cakephp/src/Database/Statement/StatementDecorator.php:171
/home/cake/cakephp/src/Database/Statement/BufferedStatement.php:74
/home/cake/cakephp/src/Database/Statement/SqliteStatement.php:41
/home/cake/cakephp/src/Database/Connection.php:270
/home/cake/cakephp/src/Database/Query.php:188
/home/cake/cakephp/src/ORM/Query.php:793
/home/cake/cakephp/src/ORM/Query.php:739
/home/cake/cakephp/tests/TestCase/ORM/QueryTest.php:1543
/home/cake/cakephp/tests/TestCase/DatabaseSuite.php:68
3) Cake\Test\TestCase\ORM\QueryTest::testCountWithExpressions
PDOException: SQLSTATE[HY000]: General error: 25 bind or column index out of range
/home/cake/cakephp/src/Database/Statement/StatementDecorator.php:171
/home/cake/cakephp/src/Database/Statement/StatementDecorator.php:171
/home/cake/cakephp/src/Database/Statement/BufferedStatement.php:74
/home/cake/cakephp/src/Database/Statement/SqliteStatement.php:41
/home/cake/cakephp/src/Database/Connection.php:270
/home/cake/cakephp/src/Database/Query.php:188
/home/cake/cakephp/src/ORM/Query.php:793
/home/cake/cakephp/src/ORM/Query.php:739
/home/cake/cakephp/tests/TestCase/ORM/QueryTest.php:1564
/home/cake/cakephp/tests/TestCase/DatabaseSuite.php:68
4) Cake\Test\TestCase\ORM\QueryTest::testCountWithSubselect
PDOException: SQLSTATE[HY000]: General error: 25 bind or column index out of range
/home/cake/cakephp/src/Database/Statement/StatementDecorator.php:171
/home/cake/cakephp/src/Database/Statement/StatementDecorator.php:171
/home/cake/cakephp/src/Database/Statement/BufferedStatement.php:74
/home/cake/cakephp/src/Database/Statement/SqliteStatement.php:41
/home/cake/cakephp/src/Database/Connection.php:270
/home/cake/cakephp/src/Database/Query.php:188
/home/cake/cakephp/src/ORM/Query.php:793
/home/cake/cakephp/src/ORM/Query.php:739
/home/cake/cakephp/tests/TestCase/ORM/QueryTest.php:1543
/home/cake/cakephp/tests/TestCase/DatabaseSuite.php:68
5) Cake\Test\TestCase\ORM\QueryTest::testCountWithExpressions
PDOException: SQLSTATE[HY000]: General error: 25 bind or column index out of range
/home/cake/cakephp/src/Database/Statement/StatementDecorator.php:171
/home/cake/cakephp/src/Database/Statement/StatementDecorator.php:171
/home/cake/cakephp/src/Database/Statement/BufferedStatement.php:74
/home/cake/cakephp/src/Database/Statement/SqliteStatement.php:41
/home/cake/cakephp/src/Database/Connection.php:270
/home/cake/cakephp/src/Database/Query.php:188
/home/cake/cakephp/src/ORM/Query.php:793
/home/cake/cakephp/src/ORM/Query.php:739
/home/cake/cakephp/tests/TestCase/ORM/QueryTest.php:1564
/home/cake/cakephp/tests/TestCase/DatabaseSuite.php:68
--
There were 26 failures:
1) Cake\Test\TestCase\I18n\DateTest::testI18nFormat with data set "mutable" ('Cake\I18n\Date')
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'jeudi 14 janvier 2010 00:00:00 UTC'
+'jeudi 14 janvier 2010 00:00:00 UTC+00:00'
/home/cake/cakephp/tests/TestCase/I18n/DateTest.php:112
2) Cake\Test\TestCase\I18n\DateTest::testI18nFormat with data set "immutable" ('Cake\I18n\FrozenDate')
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'jeudi 14 janvier 2010 00:00:00 UTC'
+'jeudi 14 janvier 2010 00:00:00 UTC+00:00'
/home/cake/cakephp/tests/TestCase/I18n/DateTest.php:112
3) Cake\Test\TestCase\I18n\NumberTest::testCurrency
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'₹ 10,01,00,100.00'
+'Rs 10,01,00,100.00'
/home/cake/cakephp/tests/TestCase/I18n/NumberTest.php:206
4) Cake\Test\TestCase\I18n\NumberTest::testConfig
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'₹ 15,000.00'
+'Rs 15,000.00'
/home/cake/cakephp/tests/TestCase/I18n/NumberTest.php:550
5) Cake\Test\TestCase\I18n\NumberTest::testOrdinal
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'1st'
+'1ˢᵗ'
/home/cake/cakephp/tests/TestCase/I18n/NumberTest.php:569
6) Cake\Test\TestCase\I18n\TimeTest::testI18nFormat with data set "mutable" ('Cake\I18n\Time')
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-jueves 14 de enero de 2010 13:59:28 GMT
+jueves 14 de enero de 2010 13:59:28 GMT+00:00
/home/cake/cakephp/tests/TestCase/I18n/TimeTest.php:858
/home/cake/cakephp/tests/TestCase/I18n/TimeTest.php:439
7) Cake\Test\TestCase\I18n\TimeTest::testI18nFormat with data set "immutable" ('Cake\I18n\FrozenTime')
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-jueves 14 de enero de 2010 13:59:28 GMT
+jueves 14 de enero de 2010 13:59:28 GMT+00:00
/home/cake/cakephp/tests/TestCase/I18n/TimeTest.php:858
/home/cake/cakephp/tests/TestCase/I18n/TimeTest.php:439
8) Cake\Test\TestCase\I18n\TimeTest::testI18nFormatWithOffsetTimezone with data set "mutable" ('Cake\I18n\Time')
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-Wednesday January 1 2014 12:00:00 AM GMT
+Wednesday January 1 2014 12:00:00 AM GMT+00:00
/home/cake/cakephp/tests/TestCase/I18n/TimeTest.php:858
/home/cake/cakephp/tests/TestCase/I18n/TimeTest.php:496
9) Cake\Test\TestCase\I18n\TimeTest::testI18nFormatWithOffsetTimezone with data set "immutable" ('Cake\I18n\FrozenTime')
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-Wednesday January 1 2014 12:00:00 AM GMT
+Wednesday January 1 2014 12:00:00 AM GMT+00:00
/home/cake/cakephp/tests/TestCase/I18n/TimeTest.php:858
/home/cake/cakephp/tests/TestCase/I18n/TimeTest.php:496
10) Cake\Test\TestCase\I18n\TimeTest::testToString with data set "mutable" ('Cake\I18n\Time')
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-dimanche 20 avril 2014 22:10:00 UTC
+dimanche 20 avril 2014 22:10:00 UTC+00:00
/home/cake/cakephp/tests/TestCase/I18n/TimeTest.php:858
/home/cake/cakephp/tests/TestCase/I18n/TimeTest.php:567
11) Cake\Test\TestCase\I18n\TimeTest::testToString with data set "immutable" ('Cake\I18n\FrozenTime')
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-dimanche 20 avril 2014 22:10:00 UTC
+dimanche 20 avril 2014 22:10:00 UTC+00:00
/home/cake/cakephp/tests/TestCase/I18n/TimeTest.php:858
/home/cake/cakephp/tests/TestCase/I18n/TimeTest.php:567
12) Cake\Test\TestCase\I18n\TimeTest::testParseDateTime with data set "mutable" ('Cake\I18n\Time')
Failed asserting that null is not null.
/home/cake/cakephp/tests/TestCase/I18n/TimeTest.php:746
13) Cake\Test\TestCase\I18n\TimeTest::testParseDateTime with data set "immutable" ('Cake\I18n\FrozenTime')
Failed asserting that null is not null.
/home/cake/cakephp/tests/TestCase/I18n/TimeTest.php:746
14) Cake\Test\TestCase\I18n\TimeTest::testParseDate with data set "mutable" ('Cake\I18n\Time')
Failed asserting that null is not null.
/home/cake/cakephp/tests/TestCase/I18n/TimeTest.php:780
15) Cake\Test\TestCase\I18n\TimeTest::testParseDate with data set "immutable" ('Cake\I18n\FrozenTime')
Failed asserting that null is not null.
/home/cake/cakephp/tests/TestCase/I18n/TimeTest.php:780
16) Cake\Test\TestCase\I18n\TimeTest::testParseTime with data set "mutable" ('Cake\I18n\Time')
Failed asserting that null is not null.
/home/cake/cakephp/tests/TestCase/I18n/TimeTest.php:800
17) Cake\Test\TestCase\I18n\TimeTest::testParseTime with data set "immutable" ('Cake\I18n\FrozenTime')
Failed asserting that null is not null.
/home/cake/cakephp/tests/TestCase/I18n/TimeTest.php:800
18) Cake\Test\TestCase\Network\ResponseTest::testOutputCompressed
Failed asserting that true is false.
/home/cake/cakephp/tests/TestCase/Network/ResponseTest.php:532
19) Cake\Test\TestCase\Validation\ValidationTest::testLocalizedTime
Failed asserting that false is true.
/home/cake/cakephp/tests/TestCase/Validation/ValidationTest.php:1570
20) Cake\Test\TestCase\View\Helper\TimeHelperTest::testFormat
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'Thursday January 14 2010 1:59:28 PM GMT'
+'Thursday January 14 2010 1:59:28 PM GMT+00:00'
/home/cake/cakephp/tests/TestCase/View/Helper/TimeHelperTest.php:499
/home/cake/cakephp/tests/TestCase/View/Helper/TimeHelperTest.php:441
21) Cake\Test\TestCase\Database\Type\DateTimeTypeTest::testLocaleParserDisable
null does not match expected type "object".
/home/cake/cakephp/tests/TestCase/Database/Type/DateTimeTypeTest.php:227
/home/cake/cakephp/tests/TestCase/DatabaseSuite.php:68
22) Cake\Test\TestCase\Database\Type\DateTimeTypeTest::testMarshalWithLocaleParsing
null does not match expected type "object".
/home/cake/cakephp/tests/TestCase/Database/Type/DateTimeTypeTest.php:244
/home/cake/cakephp/tests/TestCase/DatabaseSuite.php:68
23) Cake\Test\TestCase\Database\Type\TimeTypeTest::testMarshalWithLocaleParsing
Failed asserting that null is not null.
/home/cake/cakephp/tests/TestCase/Database/Type/TimeTypeTest.php:184
/home/cake/cakephp/tests/TestCase/DatabaseSuite.php:68
24) Cake\Test\TestCase\Database\Type\DateTimeTypeTest::testLocaleParserDisable
null does not match expected type "object".
/home/cake/cakephp/tests/TestCase/Database/Type/DateTimeTypeTest.php:227
/home/cake/cakephp/tests/TestCase/DatabaseSuite.php:68
25) Cake\Test\TestCase\Database\Type\DateTimeTypeTest::testMarshalWithLocaleParsing
null does not match expected type "object".
/home/cake/cakephp/tests/TestCase/Database/Type/DateTimeTypeTest.php:244
/home/cake/cakephp/tests/TestCase/DatabaseSuite.php:68
26) Cake\Test\TestCase\Database\Type\TimeTypeTest::testMarshalWithLocaleParsing
Failed asserting that null is not null.
/home/cake/cakephp/tests/TestCase/Database/Type/TimeTypeTest.php:184
/home/cake/cakephp/tests/TestCase/DatabaseSuite.php:68
FAILURES!
Tests: 6777, Assertions: 20613, Errors: 5, Failures: 26, Skipped: 144.
make: *** [test] Error 2
The majority of these issues appear to be i18n related. Would love to be able to get this resolved so that I can make PRs with confidence!