Example #1
0
 /**
  * @covers PitchBlade\Router\Route\Route::__construct
  * @covers PitchBlade\Router\Route\Route::wherePattern
  * @covers PitchBlade\Router\Route\Route::matchesRequest
  * @covers PitchBlade\Router\Route\Route::doesMatch
  * @covers PitchBlade\Router\Route\Route::isRequiredSegmentSet
  * @covers PitchBlade\Router\Route\Route::areRequirementsMet
  */
 public function testMatchesRequestWithNonMatchingRequirement()
 {
     $segment = $this->getMock('\\PitchBlade\\Router\\Path\\Segment');
     $segment->expects($this->once())->method('isOptional')->will($this->returnValue(false));
     $segment->expects($this->any())->method('isVariable')->will($this->returnValue(true));
     $segment->expects($this->any())->method('getValue')->will($this->returnValue('foo'));
     $path = $this->getMock('\\PitchBlade\\Router\\Path\\Parser');
     $path->expects($this->any())->method('getParts')->will($this->returnValue([$segment]));
     $route = new Route('name', $path, function () {
     });
     $route->wherePattern(['foo' => 'baz']);
     $request = $this->getMock('\\PitchBlade\\Network\\Http\\RequestData');
     $request->expects($this->once())->method('getPath')->will($this->returnValue('/bar'));
     $this->assertFalse($route->matchesRequest($request));
 }