Closed hkulekci closed 7 years ago
@webimpress I changed the methods as createMock
but PHPStorm dont autocomplete createMock
method. I dont understand why. On the other hand, I did not find any documentaion about createPartialMock()
except https://github.com/sebastianbergmann/phpunit/wiki/Release-Announcement-for-PHPUnit-5.5.0 this announcement. I try to use but give some errors. You can find below.
There were 8 errors:
1) ZendTest\Log\PsrLoggerAdapterTest::testPsrLogLevelsMapsToPriorities with data set #0 ('emergency', 0)
Invalid argument supplied for foreach()
/........zend-log/src/Logger.php:217
2) ZendTest\Log\PsrLoggerAdapterTest::testPsrLogLevelsMapsToPriorities with data set #1 ('alert', 1)
Invalid argument supplied for foreach()
/........zend-log/src/Logger.php:217
3) ZendTest\Log\PsrLoggerAdapterTest::testPsrLogLevelsMapsToPriorities with data set #2 ('critical', 2)
Invalid argument supplied for foreach()
/........zend-log/src/Logger.php:217
4) ZendTest\Log\PsrLoggerAdapterTest::testPsrLogLevelsMapsToPriorities with data set #3 ('error', 3)
Invalid argument supplied for foreach()
/........zend-log/src/Logger.php:217
5) ZendTest\Log\PsrLoggerAdapterTest::testPsrLogLevelsMapsToPriorities with data set #4 ('warning', 4)
Invalid argument supplied for foreach()
/........zend-log/src/Logger.php:217
6) ZendTest\Log\PsrLoggerAdapterTest::testPsrLogLevelsMapsToPriorities with data set #5 ('notice', 5)
Invalid argument supplied for foreach()
/........zend-log/src/Logger.php:217
7) ZendTest\Log\PsrLoggerAdapterTest::testPsrLogLevelsMapsToPriorities with data set #6 ('info', 6)
Invalid argument supplied for foreach()
/........zend-log/src/Logger.php:217
8) ZendTest\Log\PsrLoggerAdapterTest::testPsrLogLevelsMapsToPriorities with data set #7 ('debug', 7)
Invalid argument supplied for foreach()
/........zend-log/src/Logger.php:217
I changed the methods as createMock
Thanks !
PHPStorm dont autocomplete createMock method.
Try invalidate cache in your PHPStorm, it should be fine then (File
-> Invalidate Caches / Restart
).
On the other hand, I did not find any documentaion about createPartialMock()
You have right, this method is not described in PHPUnit docs, probably it should be there...
I try to use but give some errors
This is interesting, because this "partial mock" mocks only provided methods (in our case only log
method) and it's not mocking __destruct
method. So this method is called at the end, and we have got these errors. It's fine for me to use getMockBuilder
then.
Thanks @hkulekci !
@hkulekci in that occassion it would be nice also change deprecated setExpectedException
method (deprecated since Release 5.2.0) to expectException
(and expectExceptionMessage
when needed).
Please check also for methods getMock in files:
test/Writer/MongoTest.php
(line 53),test/Writer/MongoDBTest.php
(line 64).@webimpress Thank you for explanation of createPartialMock. I sent an update for setExpectedException
and MongoDB test files.
@hkulekci please change it also here:
@webimpress ohh sorry. I already searched but really missed. reviewing is really harder than writing code. 👍 thank you for patience.
👍 thanks!
PHPUnit version update