Source of file ShopifyCollectionTest.php
Size: 1,617 Bytes - Last Modified: 2021-12-24T06:46:30+00:00
/var/www/docs.ssmods.com/process/src/tests/Page/ShopifyCollectionTest.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 | <?php namespace Dynamic\Shopify\Test\Page; use Dynamic\Shopify\Page\ShopifyCollection; use SilverStripe\Dev\SapphireTest; use SilverStripe\Forms\FieldList; use SilverStripe\ORM\ArrayList; /** * Class ShopifyCollectionTest * @package Dynamic\Shopify\Test\Page */ class ShopifyCollectionTest extends SapphireTest { /** * @var string */ protected static $fixture_file = '../Fixture/shopify-collection.yml'; /** * */ public function testGetCMSFields() { $object = $this->objFromFixture(ShopifyCollection::class, 'one'); $fields = $object->getCMSFields(); $this->assertInstanceOf(FieldList::class, $fields); $this->assertNotNull($fields->dataFieldByName('ShopifyID')); $this->assertNotNull($fields->dataFieldByName('Image')); } /** * */ public function testGetProductList() { $object = $this->objFromFixture(ShopifyCollection::class, 'one'); $products = $object->getProductList(); $this->assertInstanceOf(ArrayList::class, $products); } /** * */ public function testGetByShopifyID() { $object = $this->objFromFixture(ShopifyCollection::class, 'one'); $expected = ShopifyCollection::getByShopifyID('0012345'); $this->assertEquals($expected, $object); } /** * */ public function testGetByURLSegment() { $object = $this->objFromFixture(ShopifyCollection::class, 'one'); $expected = ShopifyCollection::getByURLSegment('collection-one'); $this->assertEquals($expected, $object); } } |