From 12987f8a7c7a073f7afa82a82dbf70b44c9f00a4 Mon Sep 17 00:00:00 2001 From: Danilo Azevedo Date: Thu, 24 Dec 2020 10:26:18 -0300 Subject: [PATCH] Use PHPUnit_Framework_TestCase::getMockBuilder instead of PHPUnit_Framework_TestCase::getMock PHPUnit_Framework_TestCase::getMock is deprecated. Fixes the following warnings: PHPUnit 5.7.27 by Sebastian Bergmann and contributors. ....................E...........................WWWWWWWWWWWWWWWWW 65 / 97 ( 67%) WWWWW....WWWWWWWWW.............. 97 / 97 (100%) Time: 101 ms, Memory: 8.00MB There was 1 error: 1) Cascade\Tests\Config\Loader\ClassLoader\HandlerLoaderTest::testHandlerForProcessor TypeError: Argument 1 passed to Mock_TestHandler_f2eedf4c::pushProcessor() must be callable, string given, called in /home/danilo/monolog-cascade/src/Config/Loader/ClassLoader/HandlerLoader.php on line 187 /home/danilo/monolog-cascade/src/Config/Loader/ClassLoader/HandlerLoader.php:187 /home/danilo/monolog-cascade/tests/Config/Loader/ClassLoader/HandlerLoaderTest.php:263 PHPUnit 5.7.27 by Sebastian Bergmann and contributors. ................................................WWWWWWWWWWWWWWWWW 65 / 97 ( 67%) WWWWW....WWWWWWWWW.............. 97 / 97 (100%) Time: 102 ms, Memory: 8.00MB There were 31 warnings: 1) Cascade\Tests\Config\Loader\FileLoader\FileLoaderAbstractTest::testReadFrom PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead 2) Cascade\Tests\Config\Loader\FileLoader\FileLoaderAbstractTest::testLoadFileFromString PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead 3) Cascade\Tests\Config\Loader\FileLoader\FileLoaderAbstractTest::testValidateExtension with data set #0 (true, 'hello/world.test') PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead 4) Cascade\Tests\Config\Loader\FileLoader\FileLoaderAbstractTest::testValidateExtension with data set #1 (true, 'hello/world.php') PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead 5) Cascade\Tests\Config\Loader\FileLoader\FileLoaderAbstractTest::testValidateExtension with data set #2 (false, 'hello/world.jpeg') PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead 6) Cascade\Tests\Config\Loader\FileLoader\FileLoaderAbstractTest::testValidateExtension with data set #3 (false, 'hello/world') PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead 7) Cascade\Tests\Config\Loader\FileLoader\FileLoaderAbstractTest::testValidateExtension with data set #4 (false, '') PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead 8) Cascade\Tests\Config\Loader\FileLoader\FileLoaderAbstractTest::testGetSectionOf with data set #0 (array(array('AA', 'AB'), array('BA', 'BB')), 'b', array('BA', 'BB')) PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead 9) Cascade\Tests\Config\Loader\FileLoader\FileLoaderAbstractTest::testGetSectionOf with data set #1 (array('A', 'B'), 'c', array('A', 'B')) PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead 10) Cascade\Tests\Config\Loader\FileLoader\FileLoaderAbstractTest::testGetSectionOf with data set #2 (array('A', 'B'), '', array('A', 'B')) PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead 11) Cascade\Tests\Config\Loader\FileLoader\FileLoaderAbstractTest::testloadFileFromInvalidFile PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead 12) Cascade\Tests\Config\Loader\FileLoader\JsonTest::testLoad PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead 13) Cascade\Tests\Config\Loader\FileLoader\JsonTest::testSupportsWithInvalidResource with data set #0 (array()) PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead 14) Cascade\Tests\Config\Loader\FileLoader\JsonTest::testSupportsWithInvalidResource with data set #1 (true) PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead 15) Cascade\Tests\Config\Loader\FileLoader\JsonTest::testSupportsWithInvalidResource with data set #2 (123) PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead 16) Cascade\Tests\Config\Loader\FileLoader\JsonTest::testSupportsWithInvalidResource with data set #3 (123.456) PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead 17) Cascade\Tests\Config\Loader\FileLoader\JsonTest::testSupportsWithInvalidResource with data set #4 (null) PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead 18) Cascade\Tests\Config\Loader\FileLoader\JsonTest::testSupportsWithInvalidResource with data set #5 (stdClass Object ()) PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead 19) Cascade\Tests\Config\Loader\FileLoader\JsonTest::testSupportsWithInvalidResource with data set #6 (Closure Object (...)) PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead 20) Cascade\Tests\Config\Loader\FileLoader\JsonTest::testSupportsWithJsonString PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead 21) Cascade\Tests\Config\Loader\FileLoader\JsonTest::testSupportsWithJsonFile PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead 22) Cascade\Tests\Config\Loader\FileLoader\JsonTest::testSupportsWithNonJsonString PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead 23) Cascade\Tests\Config\Loader\FileLoader\YamlTest::testLoad PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead 24) Cascade\Tests\Config\Loader\FileLoader\YamlTest::testSupportsWithInvalidResource with data set #0 (array()) PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead 25) Cascade\Tests\Config\Loader\FileLoader\YamlTest::testSupportsWithInvalidResource with data set #1 (true) PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead 26) Cascade\Tests\Config\Loader\FileLoader\YamlTest::testSupportsWithInvalidResource with data set #2 (123) PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead 27) Cascade\Tests\Config\Loader\FileLoader\YamlTest::testSupportsWithInvalidResource with data set #3 (123.456) PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead 28) Cascade\Tests\Config\Loader\FileLoader\YamlTest::testSupportsWithInvalidResource with data set #4 (null) PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead 29) Cascade\Tests\Config\Loader\FileLoader\YamlTest::testSupportsWithInvalidResource with data set #5 (stdClass Object ()) PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead 30) Cascade\Tests\Config\Loader\FileLoader\YamlTest::testSupportsWithYamlString PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead 31) Cascade\Tests\Config\Loader\FileLoader\YamlTest::testSupportsWithYamlFile PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead WARNINGS! Tests: 97, Assertions: 139, Warnings: 31. --- tests/Config/Loader/FileLoader/FileLoaderAbstractTest.php | 5 ++--- tests/Config/Loader/FileLoader/JsonTest.php | 5 ++--- tests/Config/Loader/FileLoader/YamlTest.php | 5 ++--- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/tests/Config/Loader/FileLoader/FileLoaderAbstractTest.php b/tests/Config/Loader/FileLoader/FileLoaderAbstractTest.php index 30d695c..19103f7 100644 --- a/tests/Config/Loader/FileLoader/FileLoaderAbstractTest.php +++ b/tests/Config/Loader/FileLoader/FileLoaderAbstractTest.php @@ -33,9 +33,8 @@ public function setUp() { parent::setUp(); - $fileLocatorMock = $this->getMock( - 'Symfony\Component\Config\FileLocatorInterface' - ); + $fileLocatorMock = $this->getMockBuilder('Symfony\Component\Config\FileLocatorInterface') + ->getMock(); $this->mock = $this->getMockForAbstractClass( 'Cascade\Config\Loader\FileLoader\FileLoaderAbstract', diff --git a/tests/Config/Loader/FileLoader/JsonTest.php b/tests/Config/Loader/FileLoader/JsonTest.php index 1f5a729..ca78a85 100644 --- a/tests/Config/Loader/FileLoader/JsonTest.php +++ b/tests/Config/Loader/FileLoader/JsonTest.php @@ -29,9 +29,8 @@ public function setUp() { parent::setUp(); - $fileLocatorMock = $this->getMock( - 'Symfony\Component\Config\FileLocatorInterface' - ); + $fileLocatorMock = $this->getMockBuilder('Symfony\Component\Config\FileLocatorInterface') + ->getMock(); $this->jsonLoader = $this->getMockBuilder( 'Cascade\Config\Loader\FileLoader\Json' diff --git a/tests/Config/Loader/FileLoader/YamlTest.php b/tests/Config/Loader/FileLoader/YamlTest.php index d5f7e5f..161a65a 100644 --- a/tests/Config/Loader/FileLoader/YamlTest.php +++ b/tests/Config/Loader/FileLoader/YamlTest.php @@ -31,9 +31,8 @@ public function setUp() { parent::setUp(); - $fileLocatorMock = $this->getMock( - 'Symfony\Component\Config\FileLocatorInterface' - ); + $fileLocatorMock = $this->getMockBuilder('Symfony\Component\Config\FileLocatorInterface') + ->getMock(); $this->yamlLoader = $this->getMockBuilder( 'Cascade\Config\Loader\FileLoader\Yaml'