-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
Ouch, just discovered that my tests broke after upgrading from 2.1.1 to 2.1.2. Turned out to be two issues:
- The first issue was that my middleware mock broke. Quite subtle, but turns out that the use of
process()over__invoke()introduced in Fix Issue #34: Testing 'Internal Server Error (500)' #35 caused this to happen:
Slim Application Error:
Type: UnexpectedValueException
Message: Middleware must return instance of \Psr\Http\Message\ResponseInterface
File: /vagrant/vendor/slim/slim/Slim/MiddlewareAwareTrait.php
Line: 75
Trace: #0 /vagrant/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(123): Slim\App->Slim\{closure}(Object(Slim\Http\Request), Object(Slim\Http\Response))
#1 /vagrant/vendor/slim/slim/Slim/App.php(370): Slim\App->callMiddlewareStack(Object(Slim\Http\Request), Object(Slim\Http\Response))
#2 /vagrant/vendor/there4/slim-test-helpers/src/There4/Slim/Test/WebTestClient.php(107): Slim\App->process(Object(Slim\Http\Request), Object(Slim\Http\Response))
#3 /vagrant/vendor/there4/slim-test-helpers/src/There4/Slim/Test/WebTestClient.php(38): There4\Slim\Test\WebTestClient->request('get', '/api/auth/login', Array, Array)
#4 /vagrant/tests/integration/AuthTest.php(7): There4\Slim\Test\WebTestClient->get('/api/auth/login')
#5 [internal function]: AuthTest->testLoginRoute()
#6 /vagrant/vendor/phpunit/phpunit/src/Framework/TestCase.php(909): ReflectionMethod->invokeArgs(Object(AuthTest), Array)
#7 /vagrant/vendor/phpunit/phpunit/src/Framework/TestCase.php(768): PHPUnit_Framework_TestCase->runTest()
#8 /vagrant/vendor/phpunit/phpunit/src/Framework/TestResult.php(612): PHPUnit_Framework_TestCase->runBare()
#9 /vagrant/vendor/phpunit/phpunit/src/Framework/TestCase.php(724): PHPUnit_Framework_TestResult->run(Object(AuthTest))
#10 /vagrant/vendor/phpunit/phpunit/src/Framework/TestSuite.php(722): PHPUnit_Framework_TestCase->run(Object(PHPUnit_Framework_TestResult))
#11 /vagrant/vendor/phpunit/phpunit/src/Framework/TestSuite.php(722): PHPUnit_Framework_TestSuite->run(Object(PHPUnit_Framework_TestResult))
#12 /vagrant/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(440): PHPUnit_Framework_TestSuite->run(Object(PHPUnit_Framework_TestResult))
#13 /vagrant/vendor/phpunit/phpunit/src/TextUI/Command.php(149): PHPUnit_TextUI_TestRunner->doRun(Object(PHPUnit_Framework_TestSuite), Array)
#14 /vagrant/vendor/phpunit/phpunit/src/TextUI/Command.php(100): PHPUnit_TextUI_Command->run(Array, true)
#15 /vagrant/vendor/phpunit/phpunit/phpunit(52): PHPUnit_TextUI_Command::main()
#16 {main}
View in rendered output by enabling the "displayErrorDetails" setting.
To fix this, I made a slightly more complicated mock. Would have been better if there was a way to disable all middleware. Didn't find one, but I wouldn't be surprised if it exists..
- The second issue was more directly related to Fix Issue #34: Testing 'Internal Server Error (500)' #35. I had a test that catched RuntimeException triggered by 500 errors that I had to rewrite: danmichaelo/croptool@098b95d
While these two issues are not likely to bite many users, I wonder if the best would be to delete the 2.1.2 release and release it as 3.0.0 instead?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels