Модульные тесты CakePHP, генерирующие ошибки в моей системе

Я столкнулся с парой проблем в CakePHP, для которых я хочу представить исправления, но я хочу убедиться, что все внесенные изменения проходят модульные тесты. Проблема в том, что модульные тесты не совсем работают для меня с готовым кодом! Я уверен, что сами юнит-тесты в порядке и проходят хорошо для других, так что, вероятно, что-то в моей среде вызывает проблему.

Я использую CakePHP версии 3.2.5 на PHP версии 5.6.19. Моя конфигурация сборки PHP (включенная, потому что мне пришлось пару раз перестраивать ее, чтобы заставить ее выполнять большую часть тестов, поэтому теоретически возможно, что это проблема):

'./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'

Там также могут быть настройки php.ini, которые влияют на некоторые из этого?

Команды, используемые для настройки CakePHP для тестов

$ git clone [email protected]:cakephp/cakephp.git
$ cd cakephp

Первая попытка

$ 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

Это связано с тем, что он пытается проанализировать «13 10, 2015» с использованием локали fr_FR, но, похоже, это неверно. Я исправил это, изменив строку на «13/10/2015» в строках 169 и 185. (Я также добавил assertNotNull вызовы.)

Вторая попытка

$ 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

Я не полностью отследил это, просто заставил это терпеть неудачу и позволил тестам продолжаться, добавляя $this->assertNotNull($result);,

Третья попытка

$ 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

Большинство этих проблем, по-видимому, связаны с этим. Хотелось бы иметь возможность решить эту проблему, чтобы я мог сделать пиар с уверенностью!

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы [email protected]