Skip to content

Commit

Permalink
More tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalybaev committed Feb 2, 2019
1 parent c006b82 commit 98a44de
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
3 changes: 2 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ $feedXml = $feed->build();

## TO-DO
* Cover all Google Merchant feed properties
* Write tests
* More tests
* Your feedback?

## License

Expand Down
19 changes: 19 additions & 0 deletions tests/feed/ProductTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ public function testSetAttribute()
], $product->getXmlStructure(static::PRODUCT_NAMESPACE));
}

/**
* Tests adding multiple attributes values.
*/
public function testAddingAttribute()
{
$product = new \Vitalybaev\GoogleMerchant\Product();
Expand All @@ -54,6 +57,22 @@ public function testAddingAttribute()
['name' => "{http://base.google.com/ns/1.0}additional_image_link", "value" => "https://example.com/image2.jpg"],
],
], $product->getXmlStructure(static::PRODUCT_NAMESPACE));

$product = new \Vitalybaev\GoogleMerchant\Product();
$product->setAttribute('additional_image_link', 'https://example.com/image1.jpg');
$this->assertEquals([
'item' => [
['name' => "{http://base.google.com/ns/1.0}additional_image_link", "value" => "https://example.com/image1.jpg"],
],
], $product->getXmlStructure(static::PRODUCT_NAMESPACE));

$product->addAttribute('additional_image_link', 'https://example.com/image2.jpg');
$this->assertEquals([
'item' => [
['name' => "{http://base.google.com/ns/1.0}additional_image_link", "value" => "https://example.com/image1.jpg"],
['name' => "{http://base.google.com/ns/1.0}additional_image_link", "value" => "https://example.com/image2.jpg"],
],
], $product->getXmlStructure(static::PRODUCT_NAMESPACE));
}

/**
Expand Down

0 comments on commit 98a44de

Please sign in to comment.