Beispiel #1
0
 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');
 }
Beispiel #2
0
 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);
 }