public function testRetrieveWithCache() { $identifier = 1; $model = factory(App\DataAccess\Eloquent\User::class)->create(['id' => 1]); $this->assertNotNull($this->authProvider->retrieveById($identifier)); $this->assertTrue(\Cache::has("user:{$identifier}")); $cache = \Cache::get("user:{$identifier}"); $this->assertInstanceOf(get_class($model), $cache); $this->assertEquals($model->id, $cache->id); }
public function testRetrieveWithCache() { $identifier = 1; $user = new stdClass(); $user->id = $identifier; $this->authProvider->shouldReceive('createModel->newQuery->find')->andReturn($user); $this->assertNotNull($this->authProvider->retrieveById($identifier)); $this->assertTrue(\Cache::has("user:{$identifier}")); $cache = \Cache::get("user:{$identifier}"); $this->assertEquals($user->id, $cache->id); }