/** * @test * @covers Asd\Router\Route::__construct * @covers Asd\Router\Route::getPath */ public function constructor_removesUnnecessarySlashesFromPath() { $route = new Route('GET', '//my-path', $this->callbackStub); $this->assertEquals('my-path', $route->getPath()); $route = new Route('GET', 'my-path//', $this->callbackStub); $this->assertEquals('my-path', $route->getPath()); $route = new Route('GET', '//my-path//', $this->callbackStub); $this->assertEquals('my-path', $route->getPath()); }
/** * Check if the route compared has the same properties * @param Route $route route to be compared * @return boolean */ public function equals(Route $route) : bool { if ($this->method !== $route->getMethod()) { return false; } if ($this->path !== $route->getPath()) { return false; } return true; }