/** * @test * @depends it_does_not_retrieve_inactive_files_and_uses_cache_by_default */ function it_retrieves_inactive_files_and_does_not_cache_in_maintenance_mode() { $this->repository->maintenance(); $this->assertFalse($this->repository->isCacheEnabled(), "Cache not marked disabled"); $this->assertTrue($this->repository->isInactiveIncluded(), "Inactive not marked as included"); // test if now inactive records are returned $this->assertCount(3, $this->repository->all(), "Incorrect count for total in maintenance mode"); // set cache by looking up a record $this->repository->findBy(self::UNIQUE_FIELD, '999'); // change the record without busting the cache $this->app['db']->table(static::TABLE_NAME)->where(self::UNIQUE_FIELD, '999')->update(['name' => 'changed!']); // if the change registered, the cache didn't work $check = $this->repository->findBy(self::UNIQUE_FIELD, '999'); $this->assertEquals('changed!', $check->name, "Result was still cached, could not see change"); }