function testSleepAndWakeUp() { $faber = F::instance('test'); $faber['foo'] = function () { return new Stub(); }; $faber['bar'] = 'baz'; $faber->protect('hello', function () { return 'Hello'; }); $foo = $faber['foo']; $bar = $faber['bar']; $hello = $faber['hello']; $sleep = serialize($faber); $wakeup = unserialize($sleep); $foo2 = $wakeup['foo']; $bar2 = $wakeup['bar']; $hello2 = $wakeup['hello']; assertInstanceOf('GM\\Faber\\Tests\\Stub', $foo); assertInstanceOf('Closure', $hello); assertTrue($foo === $foo2); assertTrue($bar === $bar2); assertTrue($hello === $hello2); }
protected function tearDown() { \GM\Faber::flushInstances(); \Mockery::close(); }