businessportal24()->create(); $before = WebPageCache::generation(); $company->delete(); expect(WebPageCache::generation())->toBe($before + 1); }); test('restoring a soft-deleted company flushes the public page caches', function () { /** @var TestCase $this */ $company = Company::factory()->businessportal24()->create(); $company->delete(); $before = WebPageCache::generation(); $company->restore(); expect(WebPageCache::generation())->toBe($before + 1); }); test('changing is_active flushes the public page caches', function () { /** @var TestCase $this */ $company = Company::factory()->businessportal24()->create(['is_active' => true]); $before = WebPageCache::generation(); $company->update(['is_active' => false]); expect(WebPageCache::generation())->toBe($before + 1); $company->update(['is_active' => true]); expect(WebPageCache::generation())->toBe($before + 2); }); test('a change without public effect does not flush the page caches', function () { /** @var TestCase $this */ $company = Company::factory()->businessportal24()->create(); $before = WebPageCache::generation(); // Telefonnummer und ein Save ohne Änderung: kein Grund, die gesamte // öffentliche Seite in den Neuaufbau zu zwingen. $company->update(['phone' => '+49 30 555 0']); $company->touch(); expect(WebPageCache::generation())->toBe($before); });