-
-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #223 from patrickomeara/main
Unescape slashes in output
- Loading branch information
Showing
8 changed files
with
37 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ | |
->email('[email protected]'); | ||
|
||
$expected = '<script type="application/ld+json">'. | ||
'{"@context":"https:\/\/schema.org","@type":"LocalBusiness","name":"Spatie","email":"[email protected]"}'. | ||
'{"@context":"https://schema.org","@type":"LocalBusiness","name":"Spatie","email":"[email protected]"}'. | ||
'</script>'; | ||
|
||
expect($localBusiness->toScript())->toBe($expected); | ||
|
@@ -32,7 +32,7 @@ | |
->contactPoint(Schema::contactPoint()->areaServed('Worldwide')); | ||
|
||
$expected = '<script type="application/ld+json">'. | ||
'{"@context":"https:\/\/schema.org","@type":"LocalBusiness","name":"Spatie",'. | ||
'{"@context":"https://schema.org","@type":"LocalBusiness","name":"Spatie",'. | ||
'"contactPoint":{"@type":"ContactPoint","areaServed":"Worldwide"}}'. | ||
'</script>'; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ | |
$graph->get(Organization::class, Graph::IDENTIFIER_DEFAULT)->email('[email protected]'); | ||
|
||
expect($graph->toScript())->toBe( | ||
'<script type="application/ld+json">{"@context":"https:\/\/schema.org","@graph":[{"@type":"Organization","name":"My Company","email":"[email protected]"}]}</script>' | ||
'<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Organization","name":"My Company","email":"[email protected]"}]}</script>' | ||
); | ||
}); | ||
|
||
|
@@ -23,7 +23,7 @@ | |
$graph->getOrCreate(Organization::class, Graph::IDENTIFIER_DEFAULT)->email('[email protected]'); | ||
|
||
expect($graph->toScript())->toBe( | ||
'<script type="application/ld+json">{"@context":"https:\/\/schema.org","@graph":[{"@type":"Organization","name":"My Company","email":"[email protected]"}]}</script>' | ||
'<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Organization","name":"My Company","email":"[email protected]"}]}</script>' | ||
); | ||
}); | ||
|
||
|
@@ -33,7 +33,7 @@ | |
$graph->getOrCreate(Organization::class, Graph::IDENTIFIER_DEFAULT)->name('My Company')->email('[email protected]'); | ||
|
||
expect($graph->toScript())->toBe( | ||
'<script type="application/ld+json">{"@context":"https:\/\/schema.org","@graph":[{"@type":"Organization","name":"My Company","email":"[email protected]"},{"@type":"Product","brand":{"@type":"Organization","name":"My Company","email":"[email protected]"}}]}</script>' | ||
'<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Organization","name":"My Company","email":"[email protected]"},{"@type":"Product","brand":{"@type":"Organization","name":"My Company","email":"[email protected]"}}]}</script>' | ||
); | ||
}); | ||
|
||
|
@@ -44,7 +44,7 @@ | |
$graph->hide(Organization::class, 'astrotomic'); | ||
|
||
expect($graph->toScript())->toBe( | ||
'<script type="application/ld+json">{"@context":"https:\/\/schema.org","@graph":[{"@type":"Organization","name":"spatie"}]}</script>' | ||
'<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Organization","name":"spatie"}]}</script>' | ||
); | ||
}); | ||
|
||
|
@@ -56,7 +56,7 @@ | |
$graph->product()->brand($graph->organization('spatie')); | ||
|
||
expect($graph->toScript())->toBe( | ||
'<script type="application/ld+json">{"@context":"https:\/\/schema.org","@graph":[{"@type":"Product","brand":{"@type":"Organization","name":"spatie"}}]}</script>' | ||
'<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Product","brand":{"@type":"Organization","name":"spatie"}}]}</script>' | ||
); | ||
}); | ||
|
||
|
@@ -69,7 +69,7 @@ | |
$graph->show(Organization::class, null); | ||
|
||
expect($graph->toScript())->toBe( | ||
'<script type="application/ld+json">{"@context":"https:\/\/schema.org","@graph":[{"@type":"Organization","name":"spatie"},{"@type":"Organization","name":"astrotomic"},{"@type":"Product","brand":{"@type":"Organization","name":"spatie"}}]}</script>' | ||
'<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Organization","name":"spatie"},{"@type":"Organization","name":"astrotomic"},{"@type":"Product","brand":{"@type":"Organization","name":"spatie"}}]}</script>' | ||
); | ||
}); | ||
|
||
|
@@ -82,7 +82,7 @@ | |
$graph->show(Organization::class, 'spatie'); | ||
|
||
expect($graph->toScript())->toBe( | ||
'<script type="application/ld+json">{"@context":"https:\/\/schema.org","@graph":[{"@type":"Organization","name":"spatie"},{"@type":"Product","brand":{"@type":"Organization","name":"spatie"}}]}</script>' | ||
'<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Organization","name":"spatie"},{"@type":"Product","brand":{"@type":"Organization","name":"spatie"}}]}</script>' | ||
); | ||
}); | ||
|
||
|
@@ -95,7 +95,7 @@ | |
$graph->hide(Organization::class, 'astrotomic'); | ||
|
||
expect($graph->toScript())->toBe( | ||
'<script type="application/ld+json">{"@context":"https:\/\/schema.org","@graph":[{"@type":"Organization","name":"spatie"},{"@type":"Product","brand":{"@type":"Organization","name":"spatie"}}]}</script>' | ||
'<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Organization","name":"spatie"},{"@type":"Product","brand":{"@type":"Organization","name":"spatie"}}]}</script>' | ||
); | ||
}); | ||
|
||
|
@@ -107,7 +107,7 @@ | |
$graph->show(Organization::class, 'spatie'); | ||
|
||
expect($graph->toScript())->toBe( | ||
'<script type="application/ld+json">{"@context":"https:\/\/schema.org","@graph":[{"@type":"Organization","name":"spatie"},{"@type":"Product","brand":{"@type":"Organization","name":"spatie"}}]}</script>' | ||
'<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Organization","name":"spatie"},{"@type":"Product","brand":{"@type":"Organization","name":"spatie"}}]}</script>' | ||
); | ||
}); | ||
|
||
|
@@ -118,7 +118,7 @@ | |
$graph->product()->brand($graph->organization('spatie')); | ||
|
||
expect($graph->toScript())->toBe( | ||
'<script type="application/ld+json">{"@context":"https:\/\/schema.org","@graph":[{"@type":"Organization","name":"spatie"},{"@type":"Product","brand":{"@type":"Organization","name":"spatie"}}]}</script>' | ||
'<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Organization","name":"spatie"},{"@type":"Product","brand":{"@type":"Organization","name":"spatie"}}]}</script>' | ||
); | ||
}); | ||
|
||
|
@@ -130,7 +130,7 @@ | |
$graph->product()->brand($graph->organization('spatie')); | ||
|
||
expect($graph->toScript())->toBe( | ||
'<script type="application/ld+json">{"@context":"https:\/\/schema.org","@graph":[{"@type":"Organization","name":"spatie"},{"@type":"Product","brand":{"@type":"Organization","name":"spatie"}}]}</script>' | ||
'<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Organization","name":"spatie"},{"@type":"Product","brand":{"@type":"Organization","name":"spatie"}}]}</script>' | ||
); | ||
}); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,15 +14,15 @@ | |
it('can render empty', function () { | ||
$graph = new Graph(); | ||
|
||
expect((string) $graph)->toBe('<script type="application/ld+json">{"@context":"https:\/\/schema.org","@graph":[]}</script>'); | ||
expect((string) $graph)->toBe('<script type="application/ld+json">{"@context":"https://schema.org","@graph":[]}</script>'); | ||
}); | ||
|
||
it('can render single item', function () { | ||
$graph = new Graph(); | ||
$graph->add(Schema::organization()->name('My Company')); | ||
|
||
expect($graph->toScript())->toBe( | ||
'<script type="application/ld+json">{"@context":"https:\/\/schema.org","@graph":[{"@type":"Organization","name":"My Company"}]}</script>' | ||
'<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Organization","name":"My Company"}]}</script>' | ||
); | ||
}); | ||
|
||
|
@@ -32,7 +32,7 @@ | |
$graph->add(Schema::product()->name('My Product')); | ||
|
||
expect($graph->toScript())->toBe( | ||
'<script type="application/ld+json">{"@context":"https:\/\/schema.org","@graph":[{"@type":"Organization","name":"My Company"},{"@type":"Product","name":"My Product"}]}</script>' | ||
'<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Organization","name":"My Company"},{"@type":"Product","name":"My Product"}]}</script>' | ||
); | ||
}); | ||
|
||
|
@@ -42,7 +42,7 @@ | |
$graph->get(Organization::class)->email('[email protected]'); | ||
|
||
expect($graph->toScript())->toBe( | ||
'<script type="application/ld+json">{"@context":"https:\/\/schema.org","@graph":[{"@type":"Organization","name":"My Company","email":"[email protected]"}]}</script>' | ||
'<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Organization","name":"My Company","email":"[email protected]"}]}</script>' | ||
); | ||
}); | ||
|
||
|
@@ -52,7 +52,7 @@ | |
$graph->getOrCreate(Organization::class)->email('[email protected]'); | ||
|
||
expect($graph->toScript())->toBe( | ||
'<script type="application/ld+json">{"@context":"https:\/\/schema.org","@graph":[{"@type":"Organization","name":"My Company","email":"[email protected]"}]}</script>' | ||
'<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Organization","name":"My Company","email":"[email protected]"}]}</script>' | ||
); | ||
}); | ||
|
||
|
@@ -62,7 +62,7 @@ | |
$graph->getOrCreate(Organization::class)->name('My Company')->email('[email protected]'); | ||
|
||
expect($graph->toScript())->toBe( | ||
'<script type="application/ld+json">{"@context":"https:\/\/schema.org","@graph":[{"@type":"Organization","name":"My Company","email":"[email protected]"},{"@type":"Product","brand":{"@type":"Organization","name":"My Company","email":"[email protected]"}}]}</script>' | ||
'<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Organization","name":"My Company","email":"[email protected]"},{"@type":"Product","brand":{"@type":"Organization","name":"My Company","email":"[email protected]"}}]}</script>' | ||
); | ||
}); | ||
|
||
|
@@ -73,7 +73,7 @@ | |
$graph->getOrCreate(Organization::class)->name('My Company')->email('[email protected]'); | ||
|
||
expect($graph->toScript())->toBe( | ||
'<script type="application/ld+json">{"@context":"https:\/\/schema.org","@graph":[{"@type":"Product","brand":{"@type":"Organization","name":"My Company","email":"[email protected]"}}]}</script>' | ||
'<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Product","brand":{"@type":"Organization","name":"My Company","email":"[email protected]"}}]}</script>' | ||
); | ||
}); | ||
|
||
|
@@ -86,7 +86,7 @@ | |
$graph->show(Organization::class); | ||
|
||
expect($graph->toScript())->toBe( | ||
'<script type="application/ld+json">{"@context":"https:\/\/schema.org","@graph":[{"@type":"Organization","name":"My Company","email":"[email protected]"},{"@type":"Product","brand":{"@type":"Organization","name":"My Company","email":"[email protected]"}}]}</script>' | ||
'<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Organization","name":"My Company","email":"[email protected]"},{"@type":"Product","brand":{"@type":"Organization","name":"My Company","email":"[email protected]"}}]}</script>' | ||
); | ||
}); | ||
|
||
|
@@ -130,7 +130,7 @@ | |
|
||
expect($organization)->toBeInstanceOf(Organization::class); | ||
expect($graph->toScript())->toBe( | ||
'<script type="application/ld+json">{"@context":"https:\/\/schema.org","@graph":[{"@type":"Organization","name":"My Company"}]}</script>' | ||
'<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Organization","name":"My Company"}]}</script>' | ||
); | ||
}); | ||
|
||
|
@@ -143,7 +143,7 @@ | |
expect($graph)->toBeInstanceOf(Graph::class); | ||
expect($graph->organization())->toBeInstanceOf(Organization::class); | ||
expect($graph->toScript())->toBe( | ||
'<script type="application/ld+json">{"@context":"https:\/\/schema.org","@graph":[{"@type":"Organization","name":"My Company"}]}</script>' | ||
'<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Organization","name":"My Company"}]}</script>' | ||
); | ||
}); | ||
|
||
|
@@ -159,7 +159,7 @@ | |
expect($graph)->toBeInstanceOf(Graph::class); | ||
expect($graph->organization())->toBeInstanceOf(Organization::class); | ||
expect($graph->toScript())->toBe( | ||
'<script type="application/ld+json">{"@context":"https:\/\/schema.org","@graph":[{"@type":"Organization","name":"My Company","description":"This is my awesome Company."}]}</script>' | ||
'<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Organization","name":"My Company","description":"This is my awesome Company."}]}</script>' | ||
); | ||
}); | ||
|
||
|
@@ -179,7 +179,7 @@ | |
expect($graph->organization())->toBeInstanceOf(Organization::class); | ||
expect($graph->product())->toBeInstanceOf(Product::class); | ||
expect($graph->toScript())->toBe( | ||
'<script type="application/ld+json">{"@context":"https:\/\/schema.org","@graph":[{"@type":"Product","name":"My Product","brand":{"@type":"Organization","name":"My Company"}}]}</script>' | ||
'<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Product","name":"My Product","brand":{"@type":"Organization","name":"My Company"}}]}</script>' | ||
); | ||
}); | ||
|
||
|
@@ -217,7 +217,7 @@ | |
->email('[email protected]'); | ||
|
||
expect($graph->toScript())->toBe( | ||
'<script type="application/ld+json">{"@context":"https:\/\/schema.org","@graph":[{"@type":"BlogPosting","author":{"@id":"https:\/\/example.com\/#organization"},"publisher":{"@id":"https:\/\/example.com\/#organization"},"@id":"https:\/\/example.com\/blog\/my-post\/#blogPosting"},{"@type":"Organization","name":"organization","url":"https:\/\/example.com","email":"[email protected]","@id":"https:\/\/example.com\/#organization"}]}</script>' | ||
'<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"BlogPosting","author":{"@id":"https://example.com/#organization"},"publisher":{"@id":"https://example.com/#organization"},"@id":"https://example.com/blog/my-post/#blogPosting"},{"@type":"Organization","name":"organization","url":"https://example.com","email":"[email protected]","@id":"https://example.com/#organization"}]}</script>' | ||
); | ||
}); | ||
|
||
|
@@ -227,7 +227,7 @@ | |
expect($graph->getContext())->toBe('https://foobar.com'); | ||
|
||
expect($graph->toScript())->toBe( | ||
'<script type="application/ld+json">{"@context":"https:\/\/foobar.com","@graph":[]}</script>' | ||
'<script type="application/ld+json">{"@context":"https://foobar.com","@graph":[]}</script>' | ||
); | ||
}); | ||
|
||
|
@@ -243,6 +243,6 @@ | |
]); | ||
|
||
expect($graph->toScript())->toBe( | ||
'<script type="application/ld+json">{"@context":{"@vocab":"https:\/\/schema.org\/","@base":"https:\/\/domain.com\/"},"@graph":[]}</script>' | ||
'<script type="application/ld+json">{"@context":{"@vocab":"https://schema.org/","@base":"https://domain.com/"},"@graph":[]}</script>' | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters