Skip to content

Commit

Permalink
Merge pull request #51 from simPod/expr-tostring
Browse files Browse the repository at this point in the history
Add Expression::toString()
  • Loading branch information
simPod authored Aug 15, 2020
2 parents 9d064cb + 690710f commit 5f9cbef
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Sql/Expression.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,9 @@ public function __toString() : string
{
return $this->innerExpression;
}

public function toString() : string
{
return $this->innerExpression;
}
}
12 changes: 12 additions & 0 deletions tests/Sql/ExpressionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,16 @@ public function testNew() : void
(string) Expression::new("UUIDStringToNum('6d38d288-5b13-4714-b6e4-faa59ffd49d8')")
);
}

public function testToString() : void
{
self::assertSame(
"UUIDStringToNum('6d38d288-5b13-4714-b6e4-faa59ffd49d8')",
(string) Expression::new("UUIDStringToNum('6d38d288-5b13-4714-b6e4-faa59ffd49d8')")
);
self::assertSame(
"UUIDStringToNum('6d38d288-5b13-4714-b6e4-faa59ffd49d8')",
Expression::new("UUIDStringToNum('6d38d288-5b13-4714-b6e4-faa59ffd49d8')")->toString()
);
}
}

0 comments on commit 5f9cbef

Please sign in to comment.