Created
February 9, 2012 10:55
-
-
Save proofek/1779262 to your computer and use it in GitHub Desktop.
phpunit assertion gotcha
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class myClass | |
{ | |
public function __toString() | |
{ | |
return "mememe"; | |
} | |
} | |
class TestCase extends PHPUnit_Framework_TestCase | |
{ | |
public function testAssertStringWithObject() | |
{ | |
$class = new myClass(); | |
$this->assertEquals('mememe', $class); | |
} | |
public function testAssertStringWithSerialisedObject() | |
{ | |
$class = new myClass(); | |
$this->assertEquals('mememe', "$class"); | |
} | |
} |
Author
proofek
commented
Feb 9, 2012
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment