Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
SkuTest.php
1<?php
2
4
8
9class SkuTest extends BaseTest
10{
12 private static $factory;
14 private static $repository;
15
16 public static function setUpBeforeClass() : void
17 {
18 parent::setUpBeforeClass();
19 static::$factory = static::$container->make(Dependency::SKU_FACTORY, ['iblockId' => 8]);
20 static::$repository = static::$container->make(Dependency::SKU_REPOSITORY, ['iblockId' => 8]);
21 }
22
23 protected function setUp() : void
24 {
25 }
26
27 private function createNewSku(): BaseSku
28 {
29 return static::$factory->createEntity(static::$factory::SKU);
30 }
31
32 private function loadExistingSku(): BaseSku
33 {
34 // ToDo move it to mocks
35 return static::$repository->getEntityById(1078);
36 }
37
38 public function testLoadPartialSkuCollection(): void
39 {
40 $sku = $this->loadExistingSku();
41 $newSku = $this->createNewSku();
42
43 $skuCollection = $sku->getParentCollection();
44
45 $this->assertFalse($skuCollection->isChanged());
46 $skuCollection->add($newSku);
47 $this->assertTrue($skuCollection->isChanged());
48 }
49}