Beispiel #1
0
 public function testIsValid()
 {
     $query = new RouteQuery();
     $this->assertFalse($query->isValid());
     $query->setRoute(123);
     $this->assertTrue($query->isValid());
     $query->setRoute("123");
     $this->assertTrue($query->isValid());
 }
Beispiel #2
0
 protected function prepareRouteQuery($routeId)
 {
     $query = $routeId;
     if (!$query instanceof RouteQuery) {
         $query = new RouteQuery();
         $query->setRoute($routeId);
     }
     return $query;
 }
Beispiel #3
0
 public function testGetRouteWithQuery()
 {
     $provider = $this->getMockProviderReturnsRouteParser();
     $cercanias = new Cercanias($provider);
     $query = new RouteQuery();
     $query->setRoute(1);
     $route = $cercanias->getRoute($query);
     $this->assertInstanceOf('\\Cercanias\\Entity\\Route', $route);
     $this->assertEquals(1, $route->getId());
 }
Beispiel #4
0
 public function testGetRouteParser()
 {
     $mockAdapter = $this->getMockAdapterReturnsFixtureContent("route-sansebastian.html");
     $provider = new Provider($mockAdapter);
     $query = new RouteQuery();
     $query->setRoute(Provider::ROUTE_SAN_SEBASTIAN);
     $routeParser = $provider->getRouteParser($query);
     $this->assertInstanceOf('\\Cercanias\\Provider\\HorariosRenfeCom\\RouteParser', $routeParser);
     $this->assertEquals("61", $routeParser->getRouteId());
     $this->assertEquals("San Sebastián", $routeParser->getRouteName());
     $this->assertEquals(30, $routeParser->getStations()->count());
 }