Created
July 15, 2015 19:54
-
-
Save ircmaxell/6e380f34a5b244bb70f9 to your computer and use it in GitHub Desktop.
Expectations
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 Foo { | |
public $name; | |
public $age; | |
public function __construct($name, $age) { | |
} | |
} | |
class FooTest { | |
/** | |
* Will fail test with a single error "failed asserting $name = $foo->name" | |
*/ | |
public function testWithAssert($name, $age) { | |
$foo = new Foo($name, $age); | |
$this->assertEquals($age, $foo->name); | |
$this->assertEquals($name, $foo->age); | |
} | |
/** | |
* Will fail test two errors, one for name and one for age | |
*/ | |
public function testWithExpect($name, $age) { | |
$foo = new Foo($name, $age); | |
$this->expectEquals($age, $foo->name); | |
$this->expectEquals($name, $foo->age); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment