Skip to content

Commit

Permalink
Fix #72
Browse files Browse the repository at this point in the history
  • Loading branch information
Pieter Colpaert committed Aug 26, 2015
1 parent 8b5c735 commit 5dd0c3f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/irail/stations/Stations.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ public static function getStations($query = '', $country = '')
$newstations->{'@context'} = $stations->{'@context'};
$newstations->{'@graph'} = [];

//https://github.com/iRail/stations/issues/72
$query = str_ireplace('- ', '-', $query);

//https://github.com/iRail/hyperRail/issues/129
$query = str_ireplace('l alleud', "l'alleud", $query);

Expand Down
6 changes: 6 additions & 0 deletions tests/StationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ public function testEdgeCases()
$result5a = Stations::getStations("braine l'alleud");
$result5b = Stations::getStations('braine l alleud'); //for hafas purposes: https://github.com/iRail/hyperRail/issues/129
$this->assertEquals($result5a->{'@graph'}[0]->{'@id'}, $result5b->{'@graph'}[0]->{'@id'});

// Check whether a space after a - doesn't break the autocomplete: https://github.com/iRail/stations/issues/72
$result6a = Stations::getStations('La Louviere- Centre');
$result6b = Stations::getStations('La Louvière-Centre');
$this->assertEquals($result6a->{'@graph'}[0]->{'@id'}, $result6b->{'@graph'}[0]->{'@id'});

}

public function testId()
Expand Down

0 comments on commit 5dd0c3f

Please sign in to comment.