/** * * @param ServiceLocatorInterface $serviceLocator * @return */ public function createService(ServiceLocatorInterface $validatorManager) { $serviceLocator = $validatorManager->getServiceLocator(); $list = $serviceLocator->get('NetglueMoney\\Service\\CurrencyList'); $validator = new CurrencyCode(); $validator->setCurrencyList($list); return $validator; }
/** * @depends testSetGetCurrencyList */ public function testBasic(CurrencyCode $v) { $this->assertFalse($v->isValid('123')); $this->assertFalse($v->isValid(array())); $this->assertTrue($v->isValid('GBP')); $this->assertTrue($v->isValid('USD')); $v->getCurrencyList()->add('GBP'); $this->assertTrue($v->isValid('GBP')); $this->assertFalse($v->isValid('USD')); }