Exemplo n.º 1
0
 public function preparePathRegexp_PathWithNamedParameter_ReturnsRegExp()
 {
     // arrange
     $app = new App(self::VALID_APP_NAME);
     // act
     $regexp = $app->preparePathRegexp('/multi/path/:arg/path');
     // assert
     Assert::areEqual($regexp, "/^\\/multi\\/path\\/(?P<arg>[^\\/]+)\\/path\$/");
 }
Exemplo n.º 2
0
 public function delete_ValidHandler_RegisterEndpoint()
 {
     // arrange
     $expectedEndpoint = new Endpoint(self::VALID_ENDPOINT_PATH, $this->VALID_ENDPOINT_DEPENDENCIES, $this->VALID_ENDPOINT_HANDLER);
     $module = new Module(self::VALID_MODULE_NAME);
     // act
     $module->delete(self::VALID_ENDPOINT_PATH, $this->VALID_ENDPOINT_DEPENDENCIES, $this->VALID_ENDPOINT_HANDLER);
     // assert
     Assert::areSame($module->endpoints, ['GET' => [], 'POST' => [], 'PUT' => [], 'DELETE' => [self::VALID_ENDPOINT_PATH => $expectedEndpoint]]);
 }