mirror of
https://github.com/wearepixel/laravel-google-shopping-feed.git
synced 2026-11-14 13:21:46 +00:00
test: fix addItem assertion and add xml parseability check
This commit is contained in:
@@ -39,7 +39,7 @@ function validProduct(array $overrides = []): array
|
||||
$feed = LaravelGoogleShoppingFeed::init('', '', '');
|
||||
$feed->addItem(validProduct());
|
||||
|
||||
expect($feed)->toBeInstanceOf(LaravelGoogleShoppingFeed::class);
|
||||
expect($feed->toXml())->toContain('prod-1');
|
||||
});
|
||||
|
||||
it('throws for missing required field', function (string $field) {
|
||||
@@ -145,6 +145,14 @@ function validProduct(array $overrides = []): array
|
||||
$feed = LaravelGoogleShoppingFeed::init('', '', '');
|
||||
expect($feed->toXml())->toStartWith('<?xml');
|
||||
});
|
||||
|
||||
it('generates parseable xml', function () {
|
||||
$feed = LaravelGoogleShoppingFeed::init('Store', 'Desc', 'https://example.com');
|
||||
$feed->addItem(validProduct());
|
||||
|
||||
$result = simplexml_load_string($feed->toXml());
|
||||
expect($result)->not->toBeFalse();
|
||||
});
|
||||
});
|
||||
|
||||
describe('generate', function () {
|
||||
|
||||
Reference in New Issue
Block a user