configObject = (new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this)) ->getObject(\Magento\Framework\Locale\Config::class); $retrievedLocales = $this->configObject->getAllowedLocales(); $differences = array_diff($this::$allAllowedLocales, $retrievedLocales); $this->assertEmpty($differences); foreach ($this::$sampleAbsentLocales as $absentLocale) { $this->assertNotContains($absentLocale, $retrievedLocales); } } public function testGetAllowedLocalesGivenDataArray() { $this->configObject = (new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this)) ->getObject( \Magento\Framework\Locale\Config::class, [ 'data' => [ 'allowedLocales' => $this::$sampleAdditionalLocales, ], ] ); $retrievedLocalesWithAdditions = $this->configObject->getAllowedLocales(); $differences = array_diff( array_unique(array_merge($this::$allAllowedLocales, $this::$sampleAdditionalLocales)), $retrievedLocalesWithAdditions ); $this->assertEmpty($differences); foreach ($this::$sampleAbsentLocales as $absentLocale) { $this->assertNotContains($absentLocale, $retrievedLocalesWithAdditions); } } public function testGetAllowedLocalesGivenRedundantDataArray() { $this->configObject = (new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this)) ->getObject( \Magento\Framework\Locale\Config::class, [ 'data' => [ 'allowedLocales' => $this::$samplePresentLocales, ], ] ); $retrievedLocalesWithRedundencies = $this->configObject->getAllowedLocales(); $differences = array_diff( $this::$allAllowedLocales, $retrievedLocalesWithRedundencies ); $this->assertEmpty($differences); foreach ($this::$sampleAbsentLocales as $absentLocale) { $this->assertNotContains($absentLocale, $retrievedLocalesWithRedundencies); } } public function testGetAllowedCurrenciesNoDataArray() { $this->configObject = (new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this)) ->getObject(\Magento\Framework\Locale\Config::class); $retrievedCurrencies = $this->configObject->getAllowedCurrencies(); $differences = array_diff($this::$allAllowedCurrencies, $retrievedCurrencies); $this->assertEmpty($differences); foreach ($this::$sampleAbsentCurrencies as $absentCurrency) { $this->assertNotContains($absentCurrency, $retrievedCurrencies); } } public function testGetAllowedCurrenciesGivenDataArray() { $this->configObject = (new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this)) ->getObject( \Magento\Framework\Locale\Config::class, [ 'data' => [ 'allowedCurrencies' => $this::$sampleAdditionalCurrencies, ], ] ); $retrievedCurrenciesWithAdditions = $this->configObject->getAllowedCurrencies(); $differences = array_diff( array_unique(array_merge($this::$allAllowedCurrencies, $this::$samplePresentCurrencies)), $retrievedCurrenciesWithAdditions ); $this->assertEmpty($differences); foreach ($this::$sampleAbsentCurrencies as $absentCurrency) { $this->assertNotContains($absentCurrency, $retrievedCurrenciesWithAdditions); } } public function testGetAllowedCurrenciesGivenRedundantDataArray() { $this->configObject = (new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this)) ->getObject( \Magento\Framework\Locale\Config::class, [ 'data' => [ 'allowedCurrencies' => $this::$samplePresentCurrencies, ], ] ); $retrievedCurrenciesWithRedundencies = $this->configObject->getAllowedCurrencies(); $differences = array_diff( $this::$allAllowedCurrencies, $retrievedCurrenciesWithRedundencies ); $this->assertEmpty($differences); foreach ($this::$sampleAbsentCurrencies as $absentCurrency) { $this->assertNotContains($absentCurrency, $retrievedCurrenciesWithRedundencies); } } }