protected function proceed() { $srv = new CurrenciesService(); switch ($this->action) { case 'get': $this->succeed($srv->get($this->params['id'])); break; case 'getMain': $main = $srv->getDefault(); $this->succeed($main); break; case 'getAll': $this->succeed($srv->getAll()); break; } }
/** @depends testUpdate */ public function testUpdateMain() { $srv = new CurrenciesService(); $eur = new Currency("Eur", "€", ",", ".", "#,##0.00\$", 1, true, true); $eur->id = $srv->create($eur); $yen = new Currency("Yen", "Y", " ", " ", "#\$", 120, false, false); $yen->id = $srv->create($yen); $yen->isMain = true; $this->assertTrue($srv->update($yen)); $eurRead = $srv->get($eur->id); $yenRead = $srv->get($yen->id); $this->assertTrue($yenRead->isMain, "Main not set"); $this->assertFalse($eurRead->isMain, "Old main not unset"); }