public function testOutputArray() { $obj = new TestContainer(); $this->cacheMock->shouldReceive('set')->once()->with('key1', $obj->arrayCallable()); $ref = $this->obj; $result = $ref(array($obj, 'arrayCallable'), 'key1')->toJSON(); $this->assertEquals('[{"foo":"bar"},{"foo2":"bar2"}]', $result); $obj = ''; }