Пример #1
0
 /**
  * @covers ::getCurrency
  */
 public function testCurrency()
 {
     $refund = new Refund();
     $currency = new Currency('EUR');
     $purchase = $this->getMock('CL\\Purchases\\StorePurchase', ['getCurrency']);
     $purchase->expects($this->once())->method('getCurrency')->will($this->returnValue($currency));
     $refund->setStorePurchase($purchase);
     $this->assertSame($currency, $refund->getCurrency());
 }
Пример #2
0
 public static function initialize(Config $config)
 {
     ItemGroupTrait::initialize($config);
     TimestampsTrait::initialize($config);
     RandomKeyTrait::initialize($config);
     $config->setTable('StorePurchase')->addRels([new Rel\BelongsTo('purchase', $config, Purchase::getRepo()), new Rel\BelongsTo('store', $config, Store::getRepo()), new Rel\HasMany('items', $config, PurchaseItem::getRepo(), ['inverseOf' => 'storePurchase']), new Rel\HasMany('refunds', $config, Refund::getRepo(), ['inverseOf' => 'storePurchase'])]);
 }
Пример #3
0
 /**
  * @covers ::getRefunds
  */
 public function testRefunds()
 {
     $storePurchase = new StorePurchase();
     $refunds = $storePurchase->getRefunds();
     $this->assertEquals(Refund::getRepo(), $refunds->getRel()->getRepo());
 }