Example #1
0
 public function testId()
 {
     //test whether the right object is returned
     $result1 = Stations::getStationFromID('008892007');
     $result2 = Stations::getStationFromID('BE.NMBS.008892007');
     $result3 = Stations::getStationFromID('http://irail.be/stations/NMBS/008892007');
     $this->assertEquals($result1->{'name'}, $result2->{'name'});
     $this->assertEquals($result3->{'name'}, $result2->{'name'});
 }
Example #2
0
 public function testSort()
 {
     //test whether Ghent Sint Pieters is the first object when searching for Belgian stations in a sorted fashion
     $results = Stations::getStations('Gent', 'be', true);
     $result1 = $results->{'@graph'}[0];
     $ghentsp = Stations::getStationFromID('http://irail.be/stations/NMBS/008892007');
     $this->assertEquals($result1->{'name'}, $ghentsp->{'name'});
     $results = Stations::getStations('Brussel', '', true);
     $result2 = $results->{'@graph'}[0];
     //The busiest station in Brussels is the south one
     $brusselssouth = Stations::getStations('Brussels South')->{'@graph'}[0];
     $this->assertEquals($result2->{'name'}, $brusselssouth->{'name'});
 }