dbxapp 4.1.3
CMS, Shop, Workflows und modulare Geschäftsanwendungen
Loading...
Searching...
No Matches
shop_repository_request_cache_test.php
Go to the documentation of this file.
1<?php
2
3$file = dirname(__DIR__) . '/include/dbxShopRepository.class.php';
4$repo = file_get_contents($file);
5
6$fail = static function (string $message, int $code): void {
7 fwrite(STDERR, "FAIL: $message\n");
8 exit($code);
9};
10
11if (!is_string($repo)) {
12 $fail('Shop-Repository konnte nicht gelesen werden.', 1);
13}
14
15if (strpos($repo, 'public function install(bool $maintenance = false): void') === false
16 || strpos($repo, 'if (!$maintenance || $maintenanceDone)') === false
17 || strpos($repo, '$this->syncShopSchemaFromDd();') === false) {
18 $fail('Schema-/Defaultpflege ist nicht explizit auf den Wartungsmodus begrenzt.', 2);
19}
20
21if (strpos($repo, 'private array $requestCache = array();') === false
22 || strpos($repo, 'private function remember(string $key, callable $loader): array') === false
23 || strpos($repo, 'private function clearRequestCache(): void') === false) {
24 $fail('Der request-lokale Referenzcache fehlt.', 3);
25}
26
27foreach (array('attribute_definitions', 'attribute_filter_definitions', 'groups', 'channels') as $key) {
28 if (strpos($repo, "\$this->remember('" . $key . "'") === false) {
29 $fail('Referenzliste wird nicht request-lokal wiederverwendet: ' . $key, 4);
30 }
31}
32
33if (substr_count($repo, '$this->clearRequestCache();') < 8) {
34 $fail('Der Request-Cache wird nach Repository-Mutationen nicht ausreichend invalidiert.', 5);
35}
36
37echo "OK shop repository request cache\n";
exit
Definition index.php:146