Very specific test fix question #1183
samcoppock
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
As I mentioned in other questions I am attempting to remove modifications from Winter CMS core files - including testing files.
One of the files I am trying to fix is
'tests/PluginTestCase.php' ( which is an old file which was replaced with 'modules/system/tests/bootstrap/PluginTestCase.php' )
To do this I started by moving all custom lines of code ( and nothing else ) to the new version of the file and clearly marking them as being our own code. ( so I could easily remove them later ) This left me with a blank 'tests/PluginTestCase.php' - none of our custom code was in it and none of the original october/winter code ( which as been moved to the new file ) was left in it
At this point my tests extended the old version of PluginTestCase.php which in turn now extends the new version of the file - effectively meaning I am only running current winter CMS code + our own custom code. And it worked.
This enabled to remove the custom code from 'modules/system/tests/bootstrap/PluginTestCase.php' back into 'tests/PluginTestCase.php' which no longer has any winter/october code in it and i have got to the point where there is just one thing left to remove from 'modules/system/tests/bootstrap/PluginTestCase.php'.
And its causing some issues
currently the part of 'modules/system/tests/bootstrap/PluginTestCase.php' which i need to remove out own code from looks like this
The problem is that our own code MUST come after '$app = require DIR . '/../../../../bootstrap/app.php';'
if it does not then we get a 'RuntimeException: A facade root has not been set.' error ( this happens when swapping $app-> to App:: )
But it must also come before '$app->make('Illuminate\Contracts\Console\Kernel')->bootstrap();' or else certain tests ( which send http requests ) return 500 instead of 200 status codes ( which is to be expected if the execution context is wrong.
Is there any way to set the execution context AFTER '$app->make('Illuminate\Contracts\Console\Kernel')->bootstrap();' has run?
on a side note
why does '$app->make('Illuminate\Contracts\Console\Kernel')->bootstrap();' get called twice?
is this a typo?
Beta Was this translation helpful? Give feedback.
All reactions