Skip to content

Instantly share code, notes, and snippets.

@giorgiosironi
Created March 7, 2012 08:57
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 giorgiosironi/1992039 to your computer and use it in GitHub Desktop.
Save giorgiosironi/1992039 to your computer and use it in GitHub Desktop.
PHPUnit's assertNull() failing
<?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