Skip to content

Commit

Permalink
remove clearing cache for integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Usik2203 committed Nov 25, 2020
1 parent f55f411 commit be7872a
Show file tree
Hide file tree
Showing 25 changed files with 1 addition and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ private function compareFilterNames(array $a, array $b)
*/
public function testLayeredNavigationForConfigurableProducts()
{
CacheCleaner::cleanAll();
$attributeCode = 'test_configurable';

/** @var Config $eavConfig */
Expand Down Expand Up @@ -258,7 +257,7 @@ private function getQueryProductsWithArrayOfCustomAttributes($attributeCode, $fi
*/
public function testFilterProductsByDropDownCustomAttribute()
{
CacheCleaner::cleanAll();
CacheCleaner::clean(['eav']);
$attributeCode = 'second_test_configurable';
$optionValue = $this->getDefaultAttributeOptionValue($attributeCode);
$query = <<<QUERY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,6 @@ public function testRedirectsAndCustomInput()
$urlRewriteModel->setId($urlRewriteModel->getId());
$urlRewriteModel->save();

ObjectManager::getInstance()->get(\Magento\TestFramework\Helper\CacheCleaner::class)->cleanAll();

//modifying query by adding spaces to avoid getting cached values.
$this->queryUrlAndAssertResponse(
(int) $product->getEntityId(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,6 @@ public function testSaveActionAndDuplicateWithUrlPathAttribute()
$urlPathAttribute = $product->getCustomAttribute('url_path');
$this->assertEquals($urlPathAttribute->getValue(), $product->getSku());

// clean cache
CacheCleaner::cleanAll();

// dispatch Save&Duplicate action and check it
$this->assertSaveAndDuplicateAction($product);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ protected function setUp(): void
public function testGetEntityAttributeCodes()
{
$entityType = 'catalog_product';
CacheCleaner::cleanAll();
$this->assertEquals(
$this->config->getEntityAttributeCodes($entityType),
$this->config->getEntityAttributeCodes($entityType)
Expand All @@ -42,7 +41,6 @@ public function testGetAttribute()
{
$entityType = 'catalog_product';
$attributeCode = 'color';
CacheCleaner::cleanAll();
$this->assertEquals(
$this->config->getAttribute($entityType, $attributeCode),
$this->config->getAttribute($entityType, $attributeCode)
Expand All @@ -52,7 +50,6 @@ public function testGetAttribute()
public function testGetEntityType()
{
$entityType = 'catalog_product';
CacheCleaner::cleanAll();
$this->assertEquals(
$this->config->getEntityType($entityType),
$this->config->getEntityType($entityType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ protected function setUp(): void

public function testGetAllOptions()
{
CacheCleaner::cleanAll();
$allOptions = $this->model->getAllOptions();
$cachedAllOptions = $this->model->getAllOptions();
$this->assertEquals($allOptions, $cachedAllOptions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ class AttributeTest extends \PHPUnit\Framework\TestCase
*/
protected function setUp(): void
{
CacheCleaner::cleanAll();
$this->objectManager = Bootstrap::getObjectManager();
$this->productRepository = $this->objectManager->get(ProductRepositoryInterface::class);
$this->attributeRepository = $this->objectManager->get(AttributeRepository::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public function testModifyMeta()
{
$inputMeta = include __DIR__ . '/_files/input_meta_for_categories.php';
$expectedCategories = include __DIR__ . '/_files/expected_categories.php';
CacheCleaner::cleanAll();
$this->assertCategoriesInMeta($expectedCategories, $this->object->modifyMeta($inputMeta));
// Verify cached data
$this->assertCategoriesInMeta($expectedCategories, $this->object->modifyMeta($inputMeta));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class AddressMetadataTest extends \PHPUnit\Framework\TestCase

protected function setUp(): void
{
CacheCleaner::cleanAll();
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
$objectManager->configure(
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class CustomerMetadataTest extends \PHPUnit\Framework\TestCase

protected function setUp(): void
{
CacheCleaner::cleanAll();
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
$objectManager->configure(
[\Magento\Framework\Api\ExtensionAttribute\Config\Reader::class => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,13 @@ protected function setUp(): void

public function testGetCountryHtmlSelect()
{
CacheCleaner::cleanAll();
$result = $this->block->getCountryHtmlSelect();
$resultTwo = $this->block->getCountryHtmlSelect();
$this->assertEquals($result, $resultTwo);
}

public function testGetRegionHtmlSelect()
{
CacheCleaner::cleanAll();
$result = $this->block->getRegionHtmlSelect();
$resultTwo = $this->block->getRegionHtmlSelect();
$this->assertEquals($result, $resultTwo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ protected function setUp(): void
public function testGetEntityAttributeCodes()
{
$entityType = 'test';
CacheCleaner::cleanAll();
$entityAttributeCodes1 = $this->config->getEntityAttributeCodes($entityType);
$this->assertEquals(
[
Expand All @@ -60,7 +59,6 @@ public function testGetEntityAttributeCodesWithObject()
$testEntityType = Bootstrap::getObjectManager()->create(\Magento\Eav\Model\Entity\Type::class)
->loadByCode('test');
$attributeSetId = $testEntityType->getDefaultAttributeSetId();
CacheCleaner::cleanAll();
$object = new DataObject(
[
'attribute_set_id' => $attributeSetId,
Expand All @@ -86,7 +84,6 @@ public function testGetEntityAttributeCodesWithObject()
public function testGetAttributes()
{
$entityType = 'test';
CacheCleaner::cleanAll();
$attributes1 = $this->config->getAttributes($entityType);
$expectedAttributeCodes = [
'attribute_for_search_1',
Expand All @@ -111,7 +108,6 @@ public function testGetAttributes()
public function testGetAttribute()
{
$entityType = 'test';
CacheCleaner::cleanAll();
$attribute1 = $this->config->getAttribute($entityType, 'attribute_for_search_1');
$this->assertEquals('attribute_for_search_1', $attribute1->getAttributeCode());
$this->assertEquals('varchar', $attribute1->getBackendType());
Expand Down Expand Up @@ -153,8 +149,6 @@ public function testGetAttributeWithCacheUserDefinedAttribute()
$config = Bootstrap::getObjectManager()->create(\Magento\Eav\Model\Config::class);
$updatedAttribute = $config->getAttribute($entityType, 'foo');
$this->assertEquals('foo', $updatedAttribute->getFrontendLabel());
// Clean cache
CacheCleaner::cleanAll();
$config = Bootstrap::getObjectManager()->create(\Magento\Eav\Model\Config::class);
// Check that attribute data has changed
$updatedAttributeAfterCacheClean = $config->getAttribute($entityType, 'foo');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ class DefaultFrontendTest extends \PHPUnit\Framework\TestCase

protected function setUp(): void
{
CacheCleaner::cleanAll();
$this->objectManager = Bootstrap::getObjectManager();

$this->defaultFrontend = $this->objectManager->get(DefaultFrontend::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class AttributeLoaderTest extends \PHPUnit\Framework\TestCase

protected function setUp(): void
{
CacheCleaner::cleanAll();
$this->objectManager = Bootstrap::getObjectManager();
$this->attributeLoader = $this->objectManager->get(AttributeLoader::class);
$entityType = $this->objectManager->create(\Magento\Eav\Model\Entity\Type::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ protected function setUp(): void

public function testGetMetadata()
{
CacheCleaner::cleanAll();
$this->assertEquals(
$this->objectManager->create(Config::class)->getMetadata(),
$this->objectManager->create(Config::class)->getMetadata()
Expand All @@ -37,7 +36,6 @@ public function testGetMetadata()
*/
public function testGetData($scope)
{
CacheCleaner::cleanAll();
$this->assertEquals(
$this->objectManager->create(Config::class)->getData($scope),
$this->objectManager->create(Config::class)->getData($scope)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ protected function setUp(): void

public function testLoad()
{
CacheCleaner::cleanAll();
$data = $this->object->load('global');
$this->assertNotEmpty($data);
$cachedData = $this->object->load('global');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ protected function setUp(): void
*/
public function testGetRouteFrontName($route, $scope)
{
CacheCleaner::cleanAll();
$this->assertEquals(
$this->objectManager->create(Config::class)->getRouteFrontName($route, $scope),
$this->objectManager->create(Config::class)->getRouteFrontName($route, $scope)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ protected function setUp(): void
set_error_handler(null);
$this->resourceConnection = Bootstrap::getObjectManager()
->get(ResourceConnection::class);
CacheCleaner::cleanAll();
}

protected function tearDown(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ protected function setUp(): void

public function testGetMethodsMap()
{
CacheCleaner::cleanAll();
$data = $this->object->getMethodsMap(\Magento\Framework\Reflection\MethodsMap::class);
$this->assertArrayHasKey('getMethodsMap', $data);
$cachedData = $this->object->getMethodsMap(\Magento\Framework\Reflection\MethodsMap::class);
Expand All @@ -33,7 +32,6 @@ public function testGetMethodsMap()

public function testGetMethodParams()
{
CacheCleaner::cleanAll();
$data = $this->object->getMethodParams(
\Magento\Framework\Reflection\MethodsMap::class,
'getMethodParams'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ protected function setUp(): void
public function testLoadData()
{
$data = $this->translate->loadData(null, true)->getData();
CacheCleaner::cleanAll();
$this->translate->loadData()->getData();
$dataCached = $this->translate->loadData()->getData();
$this->assertEquals($data, $dataCached);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public function testGetTemplate()
\Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea('adminhtml');
$this->objectManager->get(\Magento\Framework\View\DesignInterface::class)
->setDesignTheme('FrameworkViewUiComponent/default');
CacheCleaner::cleanAll();

$resultOne = $this->model->getTemplate('test.xml');
$resultTwo = $this->model->getTemplate('test.xml');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ public function testProcessPortuguese()
$secondStore = $storeRepository->get('fixture_second_store');

// check if Portuguese language is specified for the second store
CacheCleaner::cleanAll();
$storeResolver = $this->_objectManager->get(Resolver::class);
$storeResolver->emulate($secondStore->getId());
$this->assertEquals('pt_BR', $storeResolver->getLocale());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public function testExecute()
{
$content = include __DIR__ . '/../../../_files/validContent.php';

CacheCleaner::cleanAll();
$this->contentProviderMock->expects($this->any())
->method('getContent')
->willReturn($content);
Expand All @@ -62,7 +61,6 @@ public function testExecute()

public function testExecuteEmptyContent()
{
CacheCleaner::cleanAll();
$this->contentProviderMock->expects($this->any())
->method('getContent')
->willReturn('[]');
Expand All @@ -77,7 +75,6 @@ public function testExecuteEmptyContent()

public function testExecuteFalseContent()
{
CacheCleaner::cleanAll();
$this->contentProviderMock->expects($this->any())
->method('getContent')
->willReturn(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public function testGetStoreData()
$storeResolver = $this->objectManager->get(\Magento\Store\Model\StoreResolver::class);

$storesDataRead = $methodReadStoresData->invoke($storeResolver);
CacheCleaner::cleanAll();
$storesData = $methodGetStoresData->invoke($storeResolver);
$storesDataCached = $methodGetStoresData->invoke($storeResolver);
$this->assertEquals($storesDataRead, $storesData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ protected function setUp(): void
$this->themeProviderOne = $objectManager->create(ThemeProvider::class);
$this->themeProviderTwo = clone $this->themeProviderOne;
$this->themeCollection = $objectManager->create(ThemeCollection::class);
CacheCleaner::clean();
}

public function testGetThemeById()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ protected function tearDown(): void
*/
public function testProcess(string $content, string $translation)
{
CacheCleaner::cleanAll();
$this->assertEquals($translation, $this->model->translate($content));
}

Expand Down

0 comments on commit be7872a

Please sign in to comment.