generated from spatie/package-skeleton-laravel
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathFeedTest.php
45 lines (38 loc) · 1.59 KB
/
FeedTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
use Donmbelembe\LaravelFacebookCatalog\LaravelFacebookCatalog;
use function Spatie\Snapshots\assertMatchesXmlSnapshot;
it('throws an exception when there is a missing required attributes', function () {
LaravelFacebookCatalog::setTitle('Example feed');
LaravelFacebookCatalog::setDescription('Example feed of the Example shop');
LaravelFacebookCatalog::setLink('https://example.shop');
LaravelFacebookCatalog::addItem([
'link' => 'https://example.shop/p/foo-bar',
'id' => 'SKU123',
'title' => 'Foo bar',
'image_link' => 'https://example.shop/images/foo-bar.png',
'description' => 'Foo bar best product',
'availability' => 'new',
// "price" => 99.99,
'brand' => 'Foo brand',
'condition' => 'new',
]);
LaravelFacebookCatalog::display();
})->throws(\Exception::class);
it('generate correctly even with optional attributes', function () {
LaravelFacebookCatalog::setTitle('Example feed');
LaravelFacebookCatalog::setDescription('Example feed of the Example shop');
LaravelFacebookCatalog::setLink('https://example.shop');
LaravelFacebookCatalog::addItem([
'link' => 'https://example.shop/p/foo-bar',
'id' => 'SKU123',
'title' => 'Foo bar',
'image_link' => 'https://example.shop/images/foo-bar.png',
'description' => 'Foo bar best product',
'availability' => 'new',
'price' => 99.99,
'brand' => 'Foo brand',
'condition' => 'new',
'age_group' => 'teen',
]);
assertMatchesXmlSnapshot(LaravelFacebookCatalog::generate());
});