public function setUp() { $this->doctrine = $this->getMockDoctrine(); $em = $this->getEntityManager(); $this->createSchema($em); $this->loadFixtures($em); $factory = new AdapterFactory($this->doctrine, 'EUR', array('EUR', 'USD'), self::CURRENCY_ENTITY); $this->adapter = $factory->createDoctrineAdapter(); }
public function testCreateDoctrineAdapter() { $em = $this->getEntityManager(); $this->loadFixtures($em); $factory = new AdapterFactory($this->doctrine, 'USD', array('EUR'), self::CURRENCY_ENTITY); $adapter = $factory->createDoctrineAdapter(); $this->assertInstanceOf('Lexik\\Bundle\\CurrencyBundle\\Adapter\\DoctrineCurrencyAdapter', $adapter); $this->assertEquals('USD', $adapter->getDefaultCurrency()); $this->assertEquals(array('EUR'), $adapter->getManagedCurrencies()); $this->assertEquals(2, count($adapter)); }
public function setUp() { $this->doctrine = $this->getMockDoctrine(); $em = $this->getEntityManager(); $this->createSchema($em); $this->loadFixtures($em); $factory = new AdapterFactory($this->doctrine, 'EUR', array('EUR', 'USD'), self::CURRENCY_ENTITY); $converter = new Converter($factory->createDoctrineAdapter()); $formatter = new Formatter('fr'); $this->container = new Container(); $this->container->set('lexik_currency.converter', $converter); $this->container->set('lexik_currency.formatter', $formatter); }
public function setUp() { $this->doctrine = $this->getMockDoctrine(); $em = $this->getEntityManager(); $this->createSchema($em); $this->loadFixtures($em); $factory = new AdapterFactory($this->doctrine, 'EUR', array('EUR', 'USD'), self::CURRENCY_ENTITY); $converter = new Converter($factory->createDoctrineAdapter()); $this->container = new Container(); $this->container->set('lexik_currency.converter', $converter); $this->translator = $this->getMock('Symfony\\Component\\Translation\\TranslatorInterface'); $this->translator->expects($this->any())->method('getLocale')->will($this->returnValue('fr')); }