Comments (5)
A better solution:
class SlimHelper extends Slim
{
public static function clearInstances()
{
self::$apps = [];
}
}
Then in getSlimInstance()
, SlimHelper::clearInstances();
from slim-unit-testing-example.
I see this has all just been addressed in slim-test-helpers in a far better way 😄
I'll close this!
Thanks
from slim-unit-testing-example.
@dasgarner have you tested it actually fixes your original problem (it does for me but better be safe than sorry) :)
from slim-unit-testing-example.
Yes, it does indeed - can't believe I didn't think of ->setName('default')
Amusingly I also ran into $app->environment
being cached between requests and managed to fix it with changes in WebTestClient:
// Prepare a mock environment
$this->app->environment = Slim\Environment::mock(array_merge($options, $optionalHeaders));
$this->app->request = new Slim\Http\Request($this->app->environment);
However I see you also fixed that too!
So thanks very much 😄
from slim-unit-testing-example.
@dasgarner, you're welcome, thanks!
from slim-unit-testing-example.
Related Issues (8)
- Multiple request in one test method. HOT 6
- Not able to access headers within the app when testing HOT 6
- Upgrade project to Slim V3 HOT 3
- Question: Simple test goes wrong. HOT 4
- Question: Passing PUT variables with a test HOT 17
- Get parameters don't get through from the test? HOT 3
- Update samples to use render() instead of include HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from slim-unit-testing-example.