Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Member Functions
DeployTest Class Reference
Inheritance diagram for DeployTest:

Public Member Functions

 testDeploy ()
 

Protected Member Functions

 setUp ()
 
 tearDown ()
 

Detailed Description

Class DeployTest

@SuppressWarnings(PHPMD.CouplingBetweenObjects)

Definition at line 26 of file DeployTest.php.

Member Function Documentation

◆ setUp()

setUp ( )
protected

Definition at line 92 of file DeployTest.php.

93  {
95  $this->prevMode = $objectManager->get(State::class)->getMode();
96  $objectManager->get(State::class)->setMode(State::MODE_PRODUCTION);
97 
98  $this->filesystem = $objectManager->get(Filesystem::class);
99  $this->staticDir = $this->filesystem->getDirectoryWrite(DirectoryList::STATIC_VIEW);
100  $this->rootDir = $this->filesystem->getDirectoryRead(DirectoryList::ROOT);
101 
102  $logger = $objectManager->get(\Psr\Log\LoggerInterface::class);
103  $this->deployService = $objectManager->create(DeployStaticContent::class, [
104  'logger' => $logger
105  ]);
106 
107  $this->bundleConfig = $objectManager->create(BundleConfig::class);
108  $this->config = $objectManager->create(View::class);
109 
110  $this->staticContentService = $objectManager->create(DeployStaticContent::class);
111 
112  $this->filesystem->getDirectoryWrite(DirectoryList::PUB)->delete(DirectoryList::STATIC_VIEW);
113  $this->filesystem->getDirectoryWrite(DirectoryList::VAR_DIR)->delete(DirectoryList::TMP_MATERIALIZATION_DIR);
114  }
$objectManager
Definition: bootstrap.php:17
$logger

◆ tearDown()

tearDown ( )
protected

Definition at line 116 of file DeployTest.php.

117  {
119  $objectManager->get(State::class)->setMode($this->prevMode);
120  $this->filesystem = $objectManager->get(Filesystem::class);
121  $this->filesystem->getDirectoryWrite(DirectoryList::PUB)->delete(DirectoryList::STATIC_VIEW);
122  $this->staticDir = $this->filesystem->getDirectoryWrite(DirectoryList::STATIC_VIEW);
123  $this->staticDir->getDriver()->createDirectory($this->staticDir->getAbsolutePath());
124 
125  parent::tearDown();
126  }
$objectManager
Definition: bootstrap.php:17

◆ testDeploy()

testDeploy ( )

@magentoDataFixture Magento/Deploy/_files/theme.php

Definition at line 131 of file DeployTest.php.

132  {
133  $this->deployService->deploy($this->options);
134 
135  $this->assertFileExists($this->staticDir->getAbsolutePath('frontend/Magento/zoom1/default/css/root.css'));
136  $this->assertFileExists($this->staticDir->getAbsolutePath('frontend/Magento/zoom2/default/css/root.css'));
137  $this->assertFileExists($this->staticDir->getAbsolutePath('frontend/Magento/zoom3/default/css/root.css'));
138  $this->assertFileExists($this->staticDir->getAbsolutePath('frontend/Magento/zoom3/default/css/local.css'));
139 
140  $this->assertFileExistsIsGenerated('requirejs-config.js');
141  $this->assertFileExistsIsGenerated('requirejs-map.js');
142  $this->assertFileExistsIsGenerated('map.json');
143  $this->assertFileExistsIsGenerated('js-translation.json');
144  $this->assertFileExistsIsGenerated('result_map.json');
145 
146  $actualFileContent = $this->staticDir->readFile('frontend/Magento/zoom3/default/css/root.css');
147  $this->assertLessPreProcessor($actualFileContent);
148  $this->assertCssUrlFixerPostProcessor($actualFileContent);
149 
150  foreach (['Magento/zoom1', 'Magento/zoom2', 'Magento/zoom3'] as $theme) {
151  $this->assertBundleSize($theme);
152  $this->assertExcluded($theme, $this->config->getExcludedFiles());
153  $this->assertExcluded($theme, $this->config->getExcludedDir());
154  }
155  }
$theme

The documentation for this class was generated from the following file: