Unverified Commit c19f0d71 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3495165 by catch, joeyroth, berdir, texas-bronius: Better warning...

Issue #3495165 by catch, joeyroth, berdir, texas-bronius: Better warning message when variation cache detects an incompatible CacheRedirect

(cherry picked from commit 25b6571b)
parent 94d0636c
Loading
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -136,7 +136,8 @@ public function set(array $keys, $data, CacheableDependencyInterface $cacheabili
            // lead to a value being returned.
            if (!array_diff($common_contexts, $previous_step_contexts)) {
              trigger_error(sprintf(
                'Trying to overwrite a cache redirect with one that has nothing in common, old one at address "%s" was pointing to "%s", new one points to "%s".',
                'Trying to overwrite a cache redirect for "%s" with one that has nothing in common, old one at address "%s" was pointing to "%s", new one points to "%s".',
                $chain_cid,
                implode(', ', $previous_step_contexts),
                implode(', ', array_diff($result_contexts, $previous_step_contexts)),
                implode(', ', array_diff($contexts, $previous_step_contexts)),
+4 −4
Original line number Diff line number Diff line
@@ -441,7 +441,7 @@ public function testIncompleteRedirectException(): void {
    // a cache redirect should always be present on the redirect itself. In this
    // example, the final cache redirect should be for 'A,B:foo,B'.
    $this->expectException(\LogicException::class);
    $this->expectExceptionMessage('Trying to overwrite a cache redirect with one that has nothing in common, old one at address "house.type" was pointing to "garden.type:zen", new one points to "garden.type".');
    $this->expectExceptionMessage('Trying to overwrite a cache redirect for "your:housing:situation:ht.house" with one that has nothing in common, old one at address "house.type" was pointing to "garden.type:zen", new one points to "garden.type".');

    $this->housingType = 'house';
    $house_cacheability = (new CacheableMetadata())
@@ -484,7 +484,7 @@ public function testIncompatibleRedirectsException(): void {
    // previous redirects should always be present on the next redirect or item
    // you're trying to store.
    $this->expectException(\LogicException::class);
    $this->expectExceptionMessage('Trying to overwrite a cache redirect with one that has nothing in common, old one at address "house.type" was pointing to "garden.type", new one points to "house.orientation".');
    $this->expectExceptionMessage('Trying to overwrite a cache redirect for "your:housing:situation:ht.house" with one that has nothing in common, old one at address "house.type" was pointing to "garden.type", new one points to "house.orientation".');

    $this->housingType = 'house';
    $house_cacheability = (new CacheableMetadata())
@@ -523,7 +523,7 @@ public function testIncompatibleChainedRedirectsException(): void {
    }, E_USER_WARNING);

    $this->expectException(\LogicException::class);
    $this->expectExceptionMessage('Trying to overwrite a cache redirect with one that has nothing in common, old one at address "house.type, garden.type" was pointing to "house.orientation", new one points to "solar.type".');
    $this->expectExceptionMessage('Trying to overwrite a cache redirect for "your:housing:situation:gt.garden:ht.house" with one that has nothing in common, old one at address "house.type, garden.type" was pointing to "house.orientation", new one points to "solar.type".');

    $this->housingType = 'house';
    $house_cacheability = (new CacheableMetadata())
@@ -572,7 +572,7 @@ public function testIncompatibleChainedRedirectsComplexException(): void {
    }, E_USER_WARNING);

    $this->expectException(\LogicException::class);
    $this->expectExceptionMessage('Trying to overwrite a cache redirect with one that has nothing in common, old one at address "house.type, garden.type" was pointing to "house.orientation", new one points to "solar.type".');
    $this->expectExceptionMessage('Trying to overwrite a cache redirect for "your:housing:situation:gt.garden:ht.house" with one that has nothing in common, old one at address "house.type, garden.type" was pointing to "house.orientation", new one points to "solar.type".');

    $this->housingType = 'house';
    $house_cacheability = (new CacheableMetadata())