getSupported(); // Pokladna 1 - nenastavené kontexty $this->assertInstanceOf(PosEntity::class, $supported[1]); $this->assertEquals('Pokladna 1', $supported[1]->getName()); $this->assertEmpty($supported[1]->getData()['country_context']); $this->assertEmpty($supported[1]->getData()['language_context']); $this->assertEmpty($supported[1]->getData()['currency_context']); // EURO pokladna - CZ, angličtina, eura $this->assertInstanceOf(PosEntity::class, $supported[2]); $this->assertEquals('EURO pokladna', $supported[2]->getName()); $this->assertEquals('CZ', $supported[2]->getData()['country_context']); $this->assertEquals('en', $supported[2]->getData()['language_context']); $this->assertEquals('EUR', $supported[2]->getData()['currency_context']); // CZK Pokladna - CZ, čeština, koruny $this->assertInstanceOf(PosEntity::class, $supported[3]); $this->assertEquals('CZK Pokladna', $supported[3]->getName()); $this->assertEquals('CZ', $supported[3]->getData()['country_context']); $this->assertEquals('cs', $supported[3]->getData()['language_context']); $this->assertEquals('CZK', $supported[3]->getData()['currency_context']); } public function testActivateAndCheckPosContext() { $posContext = Contexts::get(PosContext::class); // Nemám aktivované žádné ID $this->assertNull($posContext->getActiveId()); $this->assertNull($posContext->getActive()); // Aktivuju "CZK Pokladna". $posContext->activate(3); $this->pos = Contexts::get(PosContext::class)->getActive(); $this->assertEquals(3, Contexts::get(PosContext::class)->getActiveId()); $this->assertEquals(3, $this->pos->getId()); $this->assertEquals('www.xtreme.cz', Contexts::get(DomainContext::class)->getActiveId()); $this->assertEquals('CZ', Contexts::get(CountryContext::class)->getActiveId()); $this->assertEquals('cs', Contexts::get(LanguageContext::class)->getActiveId()); $this->assertEquals('CZK', Contexts::get(CurrencyContext::class)->getActiveId()); // Aktivuju "EURO Pokladna". $posContext->activate(2); $this->pos = Contexts::get(PosContext::class)->getActive(); $this->assertEquals(2, Contexts::get(PosContext::class)->getActiveId()); $this->assertEquals(2, $this->pos->getId()); $this->assertEquals('www.xtreme.eu', Contexts::get(DomainContext::class)->getActiveId()); $this->assertEquals('CZ', Contexts::get(CountryContext::class)->getActiveId()); $this->assertEquals('en', Contexts::get(LanguageContext::class)->getActiveId()); $this->assertEquals('EUR', Contexts::get(CurrencyContext::class)->getActiveId()); // Aktivuju "Pokladna 1" - nemá nic nastaveno a tak musí odpovídat pro default kontextů $posContext->activate(1); $this->pos = Contexts::get(PosContext::class)->getActive(); $this->assertEquals(1, Contexts::get(PosContext::class)->getActiveId()); $this->assertEquals(1, $this->pos->getId()); $this->assertEquals('www.kupshop.local', Contexts::get(DomainContext::class)->getActiveId()); $this->assertEquals(Contexts::get(CountryContext::class)->getDefaultId(), Contexts::get(CountryContext::class)->getActiveId()); $this->assertEquals(Contexts::get(LanguageContext::class)->getDefaultId(), Contexts::get(LanguageContext::class)->getActiveId()); $this->assertEquals(Contexts::get(CurrencyContext::class)->getDefaultId(), Contexts::get(CurrencyContext::class)->getActiveId()); } public function getDataSet() { return $this->getJsonDataSetFromFile(); } }