prophesize(EntityManagerInterface::class)->reveal(); $result = (new ReopeningEntityManagerDelegator())(new ServiceManager(), '', function () use ($em) { return $em; }); $ref = new ReflectionObject($result); $prop = $ref->getProperty('wrapped'); $prop->setAccessible(true); $this->assertSame($em, $prop->getValue($result)); } }