Source of file ProductCategoryTest.php
Size: 0,958 Bytes - Last Modified: 2021-12-23T10:48:01+00:00
/var/www/docs.ssmods.com/process/src/tests/ProductCategoryTest.php
12345678910111213141516171819202122232425262728293031 | <?php class SWS_ProductCategoryTest extends SWS_Test { public function setUp() { parent::setUp(); $category = $this->objFromFixture('ProductCategory', 'general'); $this->assertTrue(is_numeric($category->ID)); } public function testProductCategoryProducts() { $category = $this->objFromFixture('ProductCategory', 'general'); $productA = $this->objFromFixture('Product', 'productA'); $productB = $this->objFromFixture('Product', 'productB'); $this->loginAs('admin'); $category->doPublish(); $productA->doPublish(); $productB->doPublish(); $this->logOut(); $this->assertEquals(2, $category->Products()->count()); $list = Product::get() ->innerJoin('ProductCategory_Products', "\"ProductCategory_Products\".\"ProductID\" = \"Product\".\"ID\"") ->where("\"ProductCategory_Products\".\"ProductCategoryID\" = '".$category->ID."' OR \"ParentID\" = '".$category->ID."'"); $this->assertEquals(2, $list->count()); } } |