herloct / codeception-slim-module Goto Github PK
View Code? Open in Web Editor NEWCodeception Module for Slim 3 Microframework.
License: MIT License
Codeception Module for Slim 3 Microframework.
License: MIT License
Hi there. Why is class \Herloct\Codeception\Module\Slim
final? Why can't I extend it?
Hello,
I ran into an issue where I was extending the slim response in the container for my app and the test was failing because we are creating new Slim\Http\Response's instead of getting them from the app's container in this module.
I only have a need right now to retrieve the response from the container. However, I could imagine that anything that's in the container is fair game for extension. With that in mind, I looked at retrieving the request object from the container but that one seems to be more difficult since we have to inject a mock environment into Slim. Which brings me to why I'm opening this issue.
Currently, this module expects the user to fully instantiate a Slim app inside a DI container. This makes it difficult (perhaps impossible) for the module to inject the mock environment into Slim later down the road which, in turn, makes it difficult for us to use the request in the app's container.
Personally, I think the way the container is structured would have to be changed. Maybe we could require 'middleware' and 'routes' services in the container instead of App::class. Then we could instantiate the slim app with our mock environment and add the middleware and routes from the container to our app.
Of course, if there's a way to just Slim to parse the mock environment after it's instantiated, that would work too.
I'd like to get your thoughts on how we might be able to get around this.
Hello,
Thank you for writing this library to integrate slim PHP with codeception. I've found it very handy so far. That being said, I believe I have found a bug. When using the codeception-slim-module, the request->getParsedBody() method always returns null. I believe this is due to the following code in Lib\Connector\Slim.php lines 56-61:
$parsed = [];
if ($request->getMethod() !== 'GET') {
$parsed = $request->getParameters();
}
$slimRequest = $slimRequest
->withParsedBody($parsed);
My 'fix' for the bug was to remove those lines :) but I'm not sure if I'm breaking some other functionality in doing so. I'm not sure what the original intention for that code was and I am hoping you can help guide me to a solution for the issue. I'm working on a test that will illustrate the bug and will submit a pull request referencing this issue.
I have not been able to enabled this module to work with my Slim REST API. I have followed the README.md but it is not very clear and should be expanded.
[Codeception\Exception\ConfigurationException]
Module \Herloct\Codeception\Module\Slim could not be found and loaded
Is there any chance you could expand the documentation a bit further as there is no other information online.
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.