Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to PHPUnit 5.7 #101

Closed
wants to merge 3 commits into from
Closed

Upgrade to PHPUnit 5.7 #101

wants to merge 3 commits into from

Conversation

hertz1
Copy link
Contributor

@hertz1 hertz1 commented Dec 24, 2020

This is required in order to run tests with Monolog 2. The changes are described in each commit.

If this PR is accepted, I will open a new one for Monolog 2 support.

This is required in order to run tests with Monolog 2. Otherwise this error occurs:

PHPUnit 4.8.36 by Sebastian Bergmann and contributors.

..................PHP Fatal error:  Declaration of Mock_TestHandler_bc3472b7::setFormatter(Monolog\Formatter\FormatterInterface $formatter) must be compatible with Monolog\Handler\AbstractProcessingHandler::setFormatter(Monolog\Formatter\FormatterInterface $formatter): Monolog\Handler\HandlerInterface in /home/danilo/monolog-cascade/vendor/phpunit/phpunit-mock-objects/src/Framework/MockObject/Generator.php(290) : eval()'d code on line 11
PHP Stack trace:
PHP   1. {main}() /home/danilo/monolog-cascade/vendor/phpunit/phpunit/phpunit:0
PHP   2. PHPUnit_TextUI_Command::main() /home/danilo/monolog-cascade/vendor/phpunit/phpunit/phpunit:52
PHP   3. PHPUnit_TextUI_Command->run() /home/danilo/monolog-cascade/vendor/phpunit/phpunit/src/TextUI/Command.php:100
PHP   4. PHPUnit_TextUI_TestRunner->doRun() /home/danilo/monolog-cascade/vendor/phpunit/phpunit/src/TextUI/Command.php:149
PHP   5. PHPUnit_Framework_TestSuite->run() /home/danilo/monolog-cascade/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:440
PHP   6. PHPUnit_Framework_TestSuite->run() /home/danilo/monolog-cascade/vendor/phpunit/phpunit/src/Framework/TestSuite.php:722
PHP   7. PHPUnit_Framework_TestSuite_DataProvider->run() /home/danilo/monolog-cascade/vendor/phpunit/phpunit/src/Framework/TestSuite.php:722
PHP   8. Cascade\Tests\Config\Loader\ClassLoader\HandlerLoaderTest->run() /home/danilo/monolog-cascade/vendor/phpunit/phpunit/src/Framework/TestSuite.php:722
PHP   9. PHPUnit_Framework_TestResult->run() /home/danilo/monolog-cascade/vendor/phpunit/phpunit/src/Framework/TestCase.php:724
PHP  10. Cascade\Tests\Config\Loader\ClassLoader\HandlerLoaderTest->runBare() /home/danilo/monolog-cascade/vendor/phpunit/phpunit/src/Framework/TestResult.php:612
PHP  11. Cascade\Tests\Config\Loader\ClassLoader\HandlerLoaderTest->runTest() /home/danilo/monolog-cascade/vendor/phpunit/phpunit/src/Framework/TestCase.php:768
PHP  12. ReflectionMethod->invokeArgs() /home/danilo/monolog-cascade/vendor/phpunit/phpunit/src/Framework/TestCase.php:908
PHP  13. Cascade\Tests\Config\Loader\ClassLoader\HandlerLoaderTest->testHandlers() /home/danilo/monolog-cascade/vendor/phpunit/phpunit/src/Framework/TestCase.php:908
PHP  14. Cascade\Tests\Config\Loader\ClassLoader\HandlerLoaderTest->doTestMethodCalledInHandler() /home/danilo/monolog-cascade/tests/Config/Loader/ClassLoader/HandlerLoaderTest.php:237
PHP  15. PHPUnit_Framework_MockObject_MockBuilder->getMock() /home/danilo/monolog-cascade/tests/Config/Loader/ClassLoader/HandlerLoaderTest.php:169
PHP  16. Cascade\Tests\Config\Loader\ClassLoader\HandlerLoaderTest->getMock() /home/danilo/monolog-cascade/vendor/phpunit/phpunit-mock-objects/src/Framework/MockObject/MockBuilder.php:100
PHP  17. PHPUnit_Framework_MockObject_Generator->getMock() /home/danilo/monolog-cascade/vendor/phpunit/phpunit/src/Framework/TestCase.php:1339
PHP  18. PHPUnit_Framework_MockObject_Generator->getObject() /home/danilo/monolog-cascade/vendor/phpunit/phpunit-mock-objects/src/Framework/MockObject/Generator.php:213
PHP  19. PHPUnit_Framework_MockObject_Generator->evalClass() /home/danilo/monolog-cascade/vendor/phpunit/phpunit-mock-objects/src/Framework/MockObject/Generator.php:237
PHP  20. eval() /home/danilo/monolog-cascade/vendor/phpunit/phpunit-mock-objects/src/Framework/MockObject/Generator.php:290
ProcessableHandlerInterface::pushProcessor expects the $callback argument to be a callable. Fix the following error:

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
…mework_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 theorchard#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 theorchard#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 theorchard#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 theorchard#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 theorchard#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 theorchard#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 theorchard#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 theorchard#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 theorchard#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 theorchard#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 theorchard#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 theorchard#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 theorchard#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 theorchard#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 theorchard#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 theorchard#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 theorchard#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.
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 12987f8 on hertz1:master into 034f018 on theorchard:master.

@rantonmattei
Copy link
Contributor

Ping @mymac80 @bhavinrshah or @andymc for reviews and merging requests. I am no longer the maintainer... Folks at The Orchard have review and merging rights.

@hertz1 hertz1 closed this Jun 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants