Commit graph

3946 commits

Author SHA1 Message Date
Diego Surita
32459b11b6
Fix some deprecation warnings (#64)
* Fix PHP 8.1 deprecation warnings on Helper and FormHelper

- fix deprecation warning when Helper::_entityPath is null
- fix `strftime` function deprecation warning on FormHelper::_getDateTimeValue method

ref: ARCH-11

* Switch deprecated utf8_encode function to mb_convert_encoding function

ref: ARCH-13

* Hide strftime deprecation warning

Since CakePHP 2 doesn't require the installation of `intl` PHP extension in it's documentation, I can't use the alternative `IntlDateFormatter::format` because it relies such extension.

ref: ARCH-13

* Roll back the use of strftime

ref: ARCH-11

* Fix preg_split subject param null deprecated on FormHelper::dateTime

* Fix preg_split deprecated null param limit on CakeResponse::checkNotModified

* fix: get rid of (some) PHP deprecation warnings

- CakeResponse.php strotime() and preg_split() warnings

* Ignore hide srtftime function deprecation warning from PHPCS

* Fix typo on phpcs ignore comments

---------

Co-authored-by: Jan Pešek <jan@sinch.cz>
2024-01-29 22:49:02 +01:00
Diego Surita
8473730ba2 Fix passing a null input to h function
Fix the following deprecation warning: Deprecated (8192): htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated [APP/Vendor/cakephp/cakephp/lib/Cake/basics.php, line 231]
2023-12-19 15:27:45 +01:00
Koji Tanaka
797b7e0a3c test: MysqlTest::testTinyintCasting() Use assertEquals for assertions as in other record-retrieval tests. 2023-02-19 13:58:40 +01:00
Koji Tanaka
747f9e3d13 test: Fixed improved return value of mocked PDO class exec() method.
Return value of PDO::exec() is the number of rows affected,
which is 0 for any of these method calls.
2023-02-19 13:58:40 +01:00
Koji Tanaka
7df7fefca4 test: Separate FormHelperTest::testSecuredFileInput() by PHP Version.
Added 'full_path' key
https://www.php.net/manual/en/migration81.new-features.php#migration81.new-features.core.upload-full-path-key
2023-02-19 13:58:40 +01:00
Koji Tanaka
9115ec765f test: Skip DebuggerTest::testExportVarRecursion() in PHP 8.1+.
PHP 8.1+, $GLOBALS no longer has $GLOBALS as an element.
2023-02-19 13:58:40 +01:00
Koji Tanaka
0489533600 test: Fixed expected value when float value is specified in DboSource::value() argument. 2023-02-11 13:58:44 +01:00
Koji Tanaka
ddd53dd874 test: Fixed PostgresTest::testAlterSchema()
The last few lines of PostgresTest::testAlterSchema() were added in the following commit. There was a problem, but the test succeeds in less than PHP 7.4.
6a4e7558fc (diff-bb8406239275388d1950fd590496d45d70b9e85b1c521ec75837e1138c9743d9)
In PHP 7.4+, after executing DboSource::dropSchema(), executing DboSource::alterSchema() raises a "Warning Error" and the test fails.
2023-02-11 13:58:44 +01:00
Koji Tanaka
ca2c909ac9 test: Restore if LC_NUMERIC is changed during testing.
Improved PostgresTest::testLocalizedFloats().
This test changes the locale (LC_NUMERIC) and restores it last. Therefore, if the test failed, subsequent tests referencing the locale could fail.
2023-02-11 13:58:44 +01:00
Koji Tanaka
1d1750ae8c fix: PaginatorHelper::numbers() generates extra separator string in PHP 8.0+. 2023-01-30 21:28:56 +01:00
Koji Tanaka
3acfb1da49 fix: Relative time may not be cached if specified in CacheHelper duration 2023-01-22 14:24:47 +01:00
Koji Tanaka
85452fd81c test: Skip test PaginatorHelperTest::testNumbers() 2023-01-11 22:45:29 +01:00
Koji Tanaka
3721b5bec2 test: Skip a part of test for Mysql
Some strings are not quoted correctly in PHP 8.0+.
2023-01-11 22:45:29 +01:00
Koji Tanaka
d21c18e079 test: Skip some tests for cache feature
If expiration date is specified as a relative time, there is a bug that prevents the test from being cached, so the test is skipped.
2023-01-11 22:45:29 +01:00
Koji Tanaka
f369064c7d test: In PHP 8.0+ DebuggerTest::testOutput() marked as incomplete. 2023-01-11 22:45:29 +01:00
Koji Tanaka
cbf4682ad5 test: Change the test to match the behavior of the MailTransport class.
see: https://github.com/kamilwylegala/cakephp2-php8/pull/20

Co-authored-by: Kenshin Okinaka <okinakak@yahoo.co.jp>
2023-01-11 22:45:29 +01:00
Koji Tanaka
5ab5310120 test: Fixed FileTest::testPermission()
Co-authored-by: Kenshin Okinaka <okinakak@yahoo.co.jp>
2023-01-11 22:45:29 +01:00
Koji Tanaka
fd5f39df07 test: Fixed CakeNumberTest::testCurrencyFractionSymbol()
Change in behavior of == comparison operators in PHP 8.0 has revealed a bug in the test code.
 see: https://www.php.net/manual/en/migration80.incompatible.php#migration80.incompatible.core.string-number-comparision

 Co-authored-by: Kenshin Okinaka <okinakak@yahoo.co.jp>
2023-01-11 22:45:29 +01:00
Koji Tanaka
c82693b920 test: Fixed DebuggerTest
Some tests relied on output format settings in other tests.
2023-01-11 22:45:29 +01:00
Koji Tanaka
d47407353b test: Update DebuggerTest for PHP 8.0+ 2023-01-11 22:45:29 +01:00
Koji Tanaka
1d6fd78d45 test: Fix ConnectionManagerTest::testSourceList().
Co-authored-by: Kenshin Okinaka <okinakak@yahoo.co.jp>
2023-01-11 22:45:29 +01:00
Koji Tanaka
bab8a84436 test: Improved MemcachedEngineTest/MemcacheEngineTest. 2023-01-11 22:45:29 +01:00
Koji Tanaka
d7d7230929 test: Fix CakeEmailTest::testResetWithCharset()
Co-authored-by: Kenshin Okinaka <okinakak@yahoo.co.jp>
2023-01-11 22:45:29 +01:00
Koji Tanaka
7c55817dbc test: Change TLS version used in testEnableCryptoTlsV11().
Co-authored-by: Kenshin Okinaka <okinakak@yahoo.co.jp>
2023-01-11 22:45:29 +01:00
Koji Tanaka
d69a09b972 test: Fix error "Error : Unknown named parameter $some" in CakeEventManagerTest 2023-01-11 22:45:29 +01:00
Koji Tanaka
e0101949e4 test: Fix for MysqlTest, a new test error in PHP 8.0
Co-authored-by: Kenshin Okinaka <okinakak@yahoo.co.jp>
2023-01-11 22:45:29 +01:00
Koji Tanaka
40d5f32516 test: Fix assertion of SecurityComponentTest::testCsrfNonceVacuum() 2023-01-11 22:45:29 +01:00
Koji Tanaka
7e4adb37e5 test: Replace deprecated assertion methods that access non-public properties with methods that use reflection.
Co-authored-by: Kenshin Okinaka <okinakak@yahoo.co.jp>
2023-01-11 22:45:29 +01:00
Koji Tanaka
b5e7d582d9 test: Replace deprecated assertInternalType()
Co-authored-by: Kenshin Okinaka <okinakak@yahoo.co.jp>
2023-01-11 22:45:29 +01:00
Koji Tanaka
a5f6b6c8ee test: Attempting to read an undefined variable causes a Warning error (PHP 8.0+)
see: https://www.php.net/manual/en/migration80.incompatible.php
2023-01-11 22:45:29 +01:00
Koji Tanaka
76d1673958 test: Allow ErrorHandlerTest to run even if CakeLog configs (stdout and stderr) are not configured.
When ErrorHandlerTest is run with CakeTestRunner (TestShell) (or run with ShellTest, etc.), these configs are provided in the initialization process of the Shell class, but are not needed in many test cases.
2023-01-11 22:45:29 +01:00
Koji Tanaka
b46b6c758f test: Replace deprecated attributeEqualTo() 2023-01-11 22:45:29 +01:00
Koji Tanaka
b1138db8f4 test: phpunit command does not use TestShell, HtmlCoverageReport. So skip test. 2023-01-11 22:45:29 +01:00
Koji Tanaka
2a7c06e16f test: Replace PHPUnit's class name in tests
Co-authored-by: Kenshin Okinaka <okinakak@yahoo.co.jp>
2023-01-11 22:45:29 +01:00
Koji Tanaka
75437a4a85 test: Replace deprecated setExpectedException() 2023-01-11 22:45:29 +01:00
Koji Tanaka
b1417587ad test: Replace deprecated @expectedException* to $this->expectException*() 2023-01-11 22:45:29 +01:00
Koji Tanaka
fe34a8551c test: Replace deprecated @expectedException PHPUnit_Framework_Error 2023-01-11 22:45:29 +01:00
Koji Tanaka
c04692f76c test: Replace deprecated @expectedException* to expectWarning*()/expectNotice*() 2023-01-11 22:45:29 +01:00
Koji Tanaka
eaefdbb977 test: Replace assertNotContains() with assertStringNotContainsString() for text assertion.
assertNotContains() can no longer be used for text containment assertion.
2023-01-11 22:45:29 +01:00
Koji Tanaka
dfc1c56625 test: Replace assertContains() with assertStringContainsString() for text assertion.
assertContains() can no longer be used for text containment assertion.
2023-01-11 22:45:29 +01:00
Koji Tanaka
6529d5a308 test: Replace deprecated assertNotRegExp() with assertDoesNotMatchRegularExpression().
Co-authored-by: Kenshin Okinaka <okinakak@yahoo.co.jp>
2023-01-11 22:45:29 +01:00
Koji Tanaka
883ce8041e test: Replace deprecated assertRegExp() with assertMatchesRegularExpression().
Co-authored-by: Kenshin Okinaka <okinakak@yahoo.co.jp>
2023-01-11 22:45:29 +01:00
Koji Tanaka
c194e9b63e test: Not using CakeHtmlReporter, because it is not compatible with PHPUnit 9. 2023-01-11 22:45:29 +01:00
Koji Tanaka
927b57fa14 test: Add App::uses() missing in the test code. 2023-01-11 22:45:29 +01:00
Koji Tanaka
831bfe9315 test: In ConfigureTest::testBootstrap(), set error handler, so add cleanup.
This is because PHPUnit error handlers cannot catch PHP errors in tests that run after DebuggerTest if they expect them to occur and break the test process.
2023-01-11 22:45:29 +01:00
Koji Tanaka
b1229c9107 test: Removed pre-checking of tests that were skipped in the PHPUnit version since the minimum version is now 9.5. 2023-01-11 22:45:29 +01:00
Koji Tanaka
a95654de88 clean: Stop overriding TestCase::run().
Overriding the run method to perform fixture management processing is no longer necessary since moved it to CakeFixtureInjector.

Co-authored-by: Kenshin Okinaka <okinakak@yahoo.co.jp>
2023-01-11 22:45:29 +01:00
Koji Tanaka
75716f76bc test: Add return type declarations to overridden methods of TestCase classes. 2023-01-11 22:45:29 +01:00
Koji Tanaka
0692ce5b62 test: Updated TestSuite class for PHPUnit 9.5 2023-01-11 22:45:29 +01:00
José Muñoz
3719cce178 runCommand $command as string
Sets typehint for runCommand argument as string.

Fixes original default behavior to send string $command rather than null.
2022-01-16 07:47:57 -07:00