Skip to content
This repository has been archived by the owner on Feb 1, 2020. It is now read-only.

Commit

Permalink
Add Version::__toString()
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Deruwe committed Jan 21, 2014
1 parent 2c5ade6 commit 945a6d8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/lib/Herrera/Version/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,14 @@ public function isStable()
{
return empty($this->preRelease);
}

/**
* Returns string representation.
*
* @return string The string representation.
*/
public function __toString()
{
return Dumper::toString($this);
}
}
5 changes: 5 additions & 0 deletions src/tests/lib/Herrera/Version/Tests/VersionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ public function testIsStable()
$this->assertTrue($version->isStable());
}

public function testToString()
{
$this->assertEquals('1.2.3-pre.1+build.1', (string) $this->version);
}

protected function setUp()
{
$this->version = new Version(
Expand Down

0 comments on commit 945a6d8

Please sign in to comment.