Created
March 7, 2012 08:57
-
-
Save giorgiosironi/1992039 to your computer and use it in GitHub Desktop.
PHPUnit's assertNull() failing
This file contains hidden or 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 Unprintable | |
{ | |
public function __construct($parent = NULL, $nestingLimit = 4) | |
{ | |
$this->parent = $parent; | |
if ($nestingLimit == 0) { | |
return; | |
} | |
for ($i = 0; $i < 10; $i++) { | |
$field = 'field' . $i; | |
$this->$field = new Unprintable($this, $nestingLimit - 1); | |
} | |
} | |
} | |
class UnprintableTest extends PHPUnit_Framework_TestCase | |
{ | |
public function setUp() | |
{ | |
ini_set('memory_limit', '32M'); | |
} | |
public function testObjectCanBeBuilt() | |
{ | |
$object = new Unprintable(); | |
$this->assertInstanceOf('Unprintable', $object); | |
} | |
public function testObjectCanBeAsserted() | |
{ | |
$object = new Unprintable(); | |
$this->assertNull($object); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment