public function testMuxApp() { $app = MuxApp::mountWithUrlMap(["/foo" => ['ProductController', 'fooAction'], "/bar" => ['ProductController', 'barAction']]); $this->assertNotNull($app); $this->assertInstanceOf('Funk\\App\\MuxApp', $app); $this->assertInstanceOf('PHPSGI\\App', $app, 'Must be an instanceof PHPSGI App'); }
public function testCompositorWithUrlMap() { $compositor = new Compositor(); $compositor->app(MuxApp::mountWithUrlMap(["/foo" => ['ProductController', 'fooAction'], "/bar" => ['ProductController', 'barAction']])); $app = $compositor->wrap(); $this->assertInstanceOf('Funk\\App\\MuxApp', $app, 'When there is only one app and no middleware, the returned type should be just MuxApp'); $env = Utils::createEnv('GET', '/foo'); $response = $app($env, []); $this->assertNotEmpty($response); $this->assertEquals('foo', $response); }