Advertisement
Guest User

Untitled

a guest
Aug 2nd, 2015
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. <?php
  2.  
  3. class Foo {
  4. public $name;
  5. public $age;
  6.  
  7. public function __construct($name, $age) {
  8. }
  9. }
  10.  
  11. class FooTest {
  12. /**
  13. * Will fail test with a single error "failed asserting $name = $foo->name"
  14. */
  15. public function testWithAssert($name, $age) {
  16. $foo = new Foo($name, $age);
  17. $this->assertEquals($age, $foo->name);
  18. $this->assertEquals($name, $foo->age);
  19. }
  20. /**
  21. * Will fail test two errors, one for name and one for age
  22. */
  23. public function testWithExpect($name, $age) {
  24. $foo = new Foo($name, $age);
  25. $this->expectEquals($age, $foo->name);
  26. $this->expectEquals($name, $foo->age);
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement