diff --git a/tests/Unit/Integrations/Divi/Design/ReferenceUsageQueryTest.php b/tests/Unit/Integrations/Divi/Design/ReferenceUsageQueryTest.php index b40a3f3..a4349fd 100644 --- a/tests/Unit/Integrations/Divi/Design/ReferenceUsageQueryTest.php +++ b/tests/Unit/Integrations/Divi/Design/ReferenceUsageQueryTest.php @@ -12,8 +12,8 @@ use Mockery; final class ReferenceUsageQueryTest extends TestCase { /** A color reference as post_content holds it: quotes JSON-escaped (formats ยง2). */ - private const COLOR_REF = '$variable({"type":"color","value":{"name":' - . '"gcid-holz000001","settings":{}}})$'; + private const COLOR_REF = '$variable({\u0022type\u0022:\u0022color\u0022,\u0022value\u0022:{\u0022name\u0022:' + . '\u0022gcid-holz000001\u0022,\u0022settings\u0022:{}}})$'; public function testCandidatesContainAnIdAnEscapedHyphenOrAnEscapedLetter(): void { @@ -58,10 +58,15 @@ final class ReferenceUsageQueryTest extends TestCase { $query = new ReferenceUsageQuery(['gcid-holz000001']); - self::assertTrue($query->matches('')); + self::assertTrue($query->matches('')); self::assertTrue($query->matches('' - . '')); - self::assertFalse($query->matches('')); + . '')); + self::assertFalse($query->matches('')); + // Escaped letter, nested two levels deep inside a global module: only decoded attributes reveal the ID. + $nested = ''; + self::assertStringNotContainsString('gcid-holz000001', $nested); + self::assertTrue($query->matches($nested)); } public function testUnreadableMarkupAndDivi4ContentCount(): void @@ -69,7 +74,8 @@ final class ReferenceUsageQueryTest extends TestCase $query = new ReferenceUsageQuery(['gcid-holz000001']); self::assertTrue($query->matches(''), 'never closed'); - self::assertTrue($query->matches(''), 'attrs no JSON'); + self::assertTrue($query->matches(''), 'attrs no JSON'); + self::assertTrue($query->matches(''), 'no JSON, no raw ID'); self::assertTrue($query->matches('[et_pb_text background_color="gcid-holz000001"]x[/et_pb_text]'), 'Divi 4'); }