Does anyone have a good test component for integration test in expressive?

Expressive have not a integration test component like as zend-test.

So I wrote this component zfegg/expressive-test.


     public function testHome() {
        // $response = $this->runApp('GET', '/');  //  Test "GET /"
        $response = $this->runApp(
            ['body' => '2'],
            ['HTTP_CONTENT_TYPE' => 'application/json'],
            ['cookie' => '3']

        $this->assertEqual(200, $response->getStatusCode()));

I do not know how about my component.

May be you have a better test components or tools.

So I want to know how do you integration test to your expressive project.

That can help me refactor. Or may be can change me to use another components or tools.

I’d suggest e2e testing it, rather than integration-testing it.

About e2e, it is hard to mock some api and objects.


  • oauth2/callback.
  • Authenticated session/token.

How do you solve this.

PHPUnit can create mock object for ignore authentication.

In an e2e scenario, you do not mock anything at all. That’s why it is called end-to-end.

So that how to testing oauth2 callback API? when the provider have a captcha.

What you said e2e tools ? Is it postman, jmeter etc.?

Anything that can fire an HTTP request and can be run in automation.

I usually run a selenium+behat setup that is completely unaware of the application implementation (separate autoloader, almost separate project, certainly separate/independent Docker container).

1 Like

Thanks for reply.

I get a good information. selenium + behat and docker.

I don’t known what’s selenium. May be I need some time to learn it.

I’m using codecption in a project.

I’m testing my Mezzio apps with Codeception for e2e testing, and I have to say it feels cumbersome for something I’ve always done easily with zend-test.
Marc Guyer wrote a brief post on how to e2e testing on Mezzio with bare PHPUnit:
Integrating it with packages like phpunit-dom-assertions would result in easier test-suite maintenance in my experience.
@ocramius would you consider accepting such a package under mainstream Mezzio umbrella?
Ping @matthew