Skip to content

Commit

Permalink
HasSpatial tests updated.
Browse files Browse the repository at this point in the history
  • Loading branch information
tkaratug committed Jan 20, 2022
1 parent 27c9a43 commit 999c065
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/HasSpatialTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function it_generates_sql_query_for_selectDistanceTo_scope(): void

// Assert
$this->assertEquals(
expected: "select *, CONCAT(ST_AsText(addresses.$castedAttr), ',', ST_SRID(addresses.$castedAttr)) as $castedAttr, ST_Distance(
expected: "select *, CONCAT(ST_AsText(addresses.$castedAttr, 'axis-order=long-lat'), ',', ST_SRID(addresses.$castedAttr)) as $castedAttr, ST_Distance(
ST_SRID($castedAttr, ?),
ST_SRID(Point(?, ?), ?)
) as distance from `addresses`",
Expand All @@ -45,7 +45,7 @@ public function it_generates_sql_query_for_withinDistanceTo_scope(): void

// 3. Assert
$this->assertEquals(
expected: "select *, CONCAT(ST_AsText(addresses.$castedAttr), ',', ST_SRID(addresses.$castedAttr)) as $castedAttr from `addresses` where ST_Distance(
expected: "select *, CONCAT(ST_AsText(addresses.$castedAttr, 'axis-order=long-lat'), ',', ST_SRID(addresses.$castedAttr)) as $castedAttr from `addresses` where ST_Distance(
ST_SRID($castedAttr, ?),
ST_SRID(Point(?, ?), ?)
) <= ?",
Expand All @@ -69,15 +69,15 @@ public function it_generates_sql_query_for_orderByDistanceTo_scope(): void

// 3. Assert
$this->assertEquals(
expected: "select *, CONCAT(ST_AsText(addresses.$castedAttr), ',', ST_SRID(addresses.$castedAttr)) as $castedAttr from `addresses` order by ST_Distance(
expected: "select *, CONCAT(ST_AsText(addresses.$castedAttr, 'axis-order=long-lat'), ',', ST_SRID(addresses.$castedAttr)) as $castedAttr from `addresses` order by ST_Distance(
ST_SRID($castedAttr, ?),
ST_SRID(Point(?, ?), ?)
) asc",
actual: $queryForAsc->toSql()
);

$this->assertEquals(
expected: "select *, CONCAT(ST_AsText(addresses.$castedAttr), ',', ST_SRID(addresses.$castedAttr)) as $castedAttr from `addresses` order by ST_Distance(
expected: "select *, CONCAT(ST_AsText(addresses.$castedAttr, 'axis-order=long-lat'), ',', ST_SRID(addresses.$castedAttr)) as $castedAttr from `addresses` order by ST_Distance(
ST_SRID($castedAttr, ?),
ST_SRID(Point(?, ?), ?)
) desc",
Expand All @@ -97,7 +97,7 @@ public function it_generates_sql_query_for_location_casted_attributes(): void

// 2. Act & Assert
$this->assertEquals(
expected: "select *, CONCAT(ST_AsText(addresses.$castedAttr), ',', ST_SRID(addresses.$castedAttr)) as $castedAttr from `addresses`",
expected: "select *, CONCAT(ST_AsText(addresses.$castedAttr, 'axis-order=long-lat'), ',', ST_SRID(addresses.$castedAttr)) as $castedAttr from `addresses`",
actual: $address->query()->toSql()
);
}
Expand Down

0 comments on commit 999c065

Please sign in to comment.