コード例 #1
0
 /**
  * Tests that the getRequest() method returns null.
  */
 public function testGetRequest()
 {
     $config = array('routes' => array('/testRoute' => function () {
         return false;
     }));
     $handler = new PatternMatchHandler($config);
     $this->assertTrue($handler->isAppropriate('/testRoute', array(), array(), 'GET'));
     $this->assertNull($handler->getRequest());
 }
コード例 #2
0
 /**
  * Test that the plugin doesn't break with the PatternMatchHandler.
  */
 public function testCompatibilityWithPatternMatchHandler()
 {
     // make it appear that we are generating a cross origin request
     $_SERVER['HTTP_ORIGIN'] = 'www.example.com';
     // some dummy variables that are needed by the plugin
     $config = array('routes' => array('/testDummy' => function () {
         return true;
     }));
     $handler = new PatternMatchHandler($config);
     $this->assertTrue($handler->isAppropriate('/testDummy', array(), array(), 'GET'));
     $plugin = new CrossOriginRequestPlugin(array('whitelist' => 'all'));
     try {
         $plugin->afterHandlerSelected($handler);
         $this->assertTrue(true);
     } catch (AccessDeniedException $e) {
         $this->fail('Cross origin plugin should not have denied access.');
     }
 }