Ejemplo n.º 1
0
 /**
  * Test route default conditions
  *
  * Pre-conditions:
  * Route class has default conditions;
  *
  * Post-conditions:
  * Case A: Route instance has default conditions;
  * Case B: Route instance has newly merged conditions;
  */
 public function testRouteDefaultConditions()
 {
     Slim_Route::setDefaultConditions(array('id' => '\\d+'));
     $r = new Slim_Route('/foo', function () {
     });
     //Case A
     $this->assertEquals(Slim_Route::getDefaultConditions(), $r->getConditions());
     //Case B
     $r->conditions(array('name' => '[a-z]{2,5}'));
     $c = $r->getConditions();
     $this->assertArrayHasKey('id', $c);
     $this->assertArrayHasKey('name', $c);
 }