Skip to content

Instantly share code, notes, and snippets.

@ircmaxell
Created July 15, 2015 19:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ircmaxell/6e380f34a5b244bb70f9 to your computer and use it in GitHub Desktop.
Save ircmaxell/6e380f34a5b244bb70f9 to your computer and use it in GitHub Desktop.
Expectations
<?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