public function testSetReflectionClassFactory() { $this->if($treemap = new testedClass(uniqid(), uniqid()))->then->object($treemap->setReflectionClassFactory($factory = function ($className) use(&$reflectionClassInstance) { return $reflectionClassInstance = new \reflectionClass(__CLASS__); }))->isIdenticalTo($treemap)->object($treemap->getReflectionClass(uniqid()))->isIdenticalTo($reflectionClassInstance)->object($treemap->getReflectionClass(uniqid()))->isIdenticalTo($reflectionClassInstance)->exception(function () use($treemap) { $treemap->setReflectionClassFactory(function () { }); })->isInstanceOf('mageekguy\\atoum\\exceptions\\logic\\invalidArgument')->hasMessage('Reflection class factory must take one argument'); }