Ejemplo n.º 1
0
 /**
  * @expectedException \RuntimeException
  * @expectedExceptionMessage It is not allowed to delete the default currency
  */
 public function testDeleteDefault()
 {
     CurrencyQuery::create()->addAscendingOrderByColumn('RAND()')->limit(1)->update(array('ByDefault' => true));
     $currency = CurrencyQuery::create()->findOneByByDefault(1);
     $event = new CurrencyDeleteEvent($currency->getId());
     $action = new Currency($this->getCurrencyConverter());
     $action->delete($event, null, $this->getMockEventDispatcher());
 }
Ejemplo n.º 2
0
 /**
  * @param CurrencyModel $currency
  * @depends testSetDefault
  */
 public function testDelete(CurrencyModel $currency)
 {
     $event = new CurrencyDeleteEvent($currency->getId());
     $event->setDispatcher($this->dispatcher);
     $action = new Currency();
     $action->delete($event);
     $deletedCurrency = $event->getCurrency();
     $this->assertInstanceOf('Thelia\\Model\\Currency', $deletedCurrency);
     $this->assertTrue($deletedCurrency->isDeleted());
 }