|
1 | 1 | <?php |
2 | 2 |
|
3 | 3 | use Astrotomic\OpenGraph\StructuredProperties\Audio; |
| 4 | +use Astrotomic\OpenGraph\StructuredProperties\Image; |
4 | 5 | use Astrotomic\OpenGraph\Types\Article; |
5 | 6 | use Astrotomic\OpenGraph\Types\Book; |
6 | 7 | use Astrotomic\OpenGraph\Types\Profile; |
7 | 8 | use Astrotomic\OpenGraph\Types\Website; |
| 9 | +use function Spatie\Snapshots\{assertMatchesHtmlSnapshot}; |
8 | 10 |
|
9 | 11 | it('can generate website tags', function () { |
10 | 12 | $og = Website::make('Title | Example') |
@@ -35,6 +37,30 @@ public function __toString() |
35 | 37 | assertMatchesHtmlSnapshot((string) $og); |
36 | 38 | })->group('global', 'website'); |
37 | 39 |
|
| 40 | +it('can generate website tags with structured image', function () { |
| 41 | + $og = Website::make('Title | Example') |
| 42 | + ->url('http://www.example.com') |
| 43 | + ->description('Description') |
| 44 | + ->locale('en_US') |
| 45 | + ->alternateLocale('en_GB') |
| 46 | + ->siteName('Example') |
| 47 | + ->image(Image::make('http://www.example.com/image1.jpg')->mimeType('image/jpeg')); |
| 48 | + |
| 49 | + assertMatchesHtmlSnapshot((string) $og); |
| 50 | +})->group('global', 'website'); |
| 51 | + |
| 52 | +it('can generate website tags with structured image without url suffix', function () { |
| 53 | + $og = Website::make('Title | Example') |
| 54 | + ->url('http://www.example.com') |
| 55 | + ->description('Description') |
| 56 | + ->locale('en_US') |
| 57 | + ->alternateLocale('en_GB') |
| 58 | + ->siteName('Example') |
| 59 | + ->image(Image::make('http://www.example.com/image1.jpg', false)->mimeType('image/jpeg')); |
| 60 | + |
| 61 | + assertMatchesHtmlSnapshot((string) $og); |
| 62 | +})->group('global', 'website'); |
| 63 | + |
38 | 64 | it('can generate website tags with conditional callbacks', function () { |
39 | 65 | $og = Website::make('Title | Example') |
40 | 66 | ->url('http://www.example.com') |
|
0 commit comments