public static function initialize(Config $config) { CurrencyTrait::initialize($config); ValueTrait::initialize($config); SoftDeleteTrait::initialize($config); $config->addRels([new Rel\BelongsTo('store', $config, Store::getRepo()), new Rel\HasMany('productItems', $config, ProductItem::getRepo(), ['foreignKey' => 'refId'])])->addAsserts([new Assert\Present('name'), new Assert\LengthLessThan('name', 150)]); }
/** * @covers ::getDescription */ public function testGetDescription() { $item = new ProductItem(); $item->setProduct(new Product(['name' => 'test name'])); $this->assertEquals('test name', $item->getDescription()); }