/** * Tests installation and uninstallation. */ function testInstallationAndUninstallation() { /** @var \Drupal\Core\Extension\ModuleInstallerInterface $module_installer */ $module_installer = \Drupal::service('module_installer'); $module_handler = \Drupal::moduleHandler(); $this->assertTrue(Currency::load('XXX') instanceof CurrencyInterface); $this->assertTrue(CurrencyLocale::load('en_US') instanceof CurrencyLocaleInterface); $module_installer->uninstall(array('currency')); $this->assertFalse($module_handler->moduleExists('currency')); }
/** * @covers ::toArray */ public function testToArray() { $language_code = strtolower($this->randomMachineName()); $country_code = strtoupper($this->randomMachineName()); $expected_array = ['decimalSeparator' => $this->randomMachineName(), 'groupingSeparator' => $this->randomMachineName(), 'locale' => $language_code . '_' . $country_code, 'pattern' => $this->randomMachineName()]; $this->sut->setLocale($language_code, $country_code); $this->sut->setDecimalSeparator($expected_array['decimalSeparator']); $this->sut->setGroupingSeparator($expected_array['groupingSeparator']); $this->sut->setPattern($expected_array['pattern']); $array = $this->sut->toArray(); $this->assertArrayHasKey('uuid', $array); unset($array['uuid']); $this->assertEquals($expected_array, $array); }