Skip to content

Commit

Permalink
Add setter for the string value
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonlam604 committed May 9, 2016
1 parent 05d29b1 commit 1c7f4ef
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Stringizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,11 @@ public function getStringOriginal()
return $this->valueOriginal;
}

public function setString($value)
{
$this->value = $value;
}

public function getString()
{
return $this->__toString();
Expand Down
10 changes: 10 additions & 0 deletions tests/StringizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,14 @@ public function testInvalidObjectWithNoToString()
{
new Stringizer((object) array());
}

public function testSetter()
{
$s = new Stringizer("fizz");
$this->assertEquals("fizz", $s);

$s->setString("buzz");
$this->assertEquals("buzz", $s);

}
}

0 comments on commit 1c7f4ef

Please sign in to comment.