55 */
66namespace Magento \TestFramework ;
77
8- use Magento \Framework \Autoload \AutoloaderInterface ;
9- use Magento \Framework \App \Filesystem \DirectoryList ;
108use Magento \Framework \App \DeploymentConfig ;
11- use Magento \Framework \Config \ConfigOptionsListConstants ;
129use Magento \Framework \App \DeploymentConfig \Reader ;
10+ use Magento \Framework \App \Filesystem \DirectoryList ;
11+ use Magento \Framework \Autoload \AutoloaderInterface ;
12+ use Magento \Framework \Config \ConfigOptionsListConstants ;
1313use Magento \Framework \Filesystem \Glob ;
14+ use Magento \Framework \Mail ;
15+ use Magento \TestFramework ;
16+ use Psr \Log \LoggerInterface ;
1417
1518/**
1619 * Encapsulates application installation, initialization and uninstall.
@@ -28,7 +31,7 @@ class Application
2831 /**
2932 * DB vendor adapter instance.
3033 *
31- * @var \Magento\ TestFramework\Db\AbstractDb
34+ * @var TestFramework\Db\AbstractDb
3235 */
3336 protected $ _db ;
3437
@@ -105,14 +108,14 @@ class Application
105108 /**
106109 * Object manager factory.
107110 *
108- * @var \Magento\ TestFramework\ObjectManagerFactory
111+ * @var TestFramework\ObjectManagerFactory
109112 */
110113 protected $ _factory ;
111114
112115 /**
113116 * Directory list.
114117 *
115- * @var \Magento\Framework\App\Filesystem\ DirectoryList
118+ * @var DirectoryList
116119 */
117120 protected $ dirList ;
118121
@@ -180,7 +183,7 @@ public function __construct(
180183 $ this ->loadTestExtensionAttributes = $ loadTestExtensionAttributes ;
181184
182185 $ customDirs = $ this ->getCustomDirs ();
183- $ this ->dirList = new \ Magento \ Framework \ App \ Filesystem \ DirectoryList (BP , $ customDirs );
186+ $ this ->dirList = new DirectoryList (BP , $ customDirs );
184187 \Magento \Framework \Autoload \Populator::populateMappings (
185188 $ autoloadWrapper ,
186189 $ this ->dirList
@@ -189,9 +192,9 @@ public function __construct(
189192 \Magento \Framework \App \Bootstrap::INIT_PARAM_FILESYSTEM_DIR_PATHS => $ customDirs ,
190193 \Magento \Framework \App \State::PARAM_MODE => $ appMode
191194 ];
192- $ driverPool = new \Magento \Framework \Filesystem \DriverPool ;
193- $ configFilePool = new \Magento \Framework \Config \File \ConfigFilePool ;
194- $ this ->_factory = new \ Magento \ TestFramework \ObjectManagerFactory ($ this ->dirList , $ driverPool , $ configFilePool );
195+ $ driverPool = new \Magento \Framework \Filesystem \DriverPool () ;
196+ $ configFilePool = new \Magento \Framework \Config \File \ConfigFilePool () ;
197+ $ this ->_factory = new TestFramework \ObjectManagerFactory ($ this ->dirList , $ driverPool , $ configFilePool );
195198
196199 $ this ->_configDir = $ this ->dirList ->getPath (DirectoryList::CONFIG );
197200 $ this ->globalConfigFile = $ globalConfigFile ;
@@ -200,7 +203,7 @@ public function __construct(
200203 /**
201204 * Retrieve the database adapter instance.
202205 *
203- * @return \Magento\ TestFramework\Db\AbstractDb
206+ * @return TestFramework\Db\AbstractDb
204207 */
205208 public function getDbInstance ()
206209 {
@@ -310,7 +313,7 @@ private function initLogger()
310313 $ objectManager = Helper \Bootstrap::getObjectManager ();
311314 /** @var \Psr\Log\LoggerInterface $logger */
312315 $ logger = $ objectManager ->create (
313- \ Magento \ TestFramework \ErrorLog \Logger::class,
316+ TestFramework \ErrorLog \Logger::class,
314317 [
315318 'name ' => 'integration-tests ' ,
316319 'handlers ' => [
@@ -331,9 +334,8 @@ private function initLogger()
331334 ]
332335 ]
333336 );
334-
335- $ objectManager ->removeSharedInstance (\Magento \Framework \Logger \Monolog::class);
336- $ objectManager ->addSharedInstance ($ logger , \Magento \Framework \Logger \Monolog::class);
337+ $ objectManager ->removeSharedInstance (LoggerInterface::class, true );
338+ $ objectManager ->addSharedInstance ($ logger , LoggerInterface::class, true );
337339 return $ logger ;
338340 }
339341
@@ -351,31 +353,35 @@ public function initialize($overriddenParams = [])
351353 ? $ overriddenParams [\Magento \Framework \App \Bootstrap::INIT_PARAM_FILESYSTEM_DIR_PATHS ]
352354 : [];
353355 $ directoryList = new DirectoryList (BP , $ directories );
354- /** @var \Magento\ TestFramework\ObjectManager $objectManager */
356+ /** @var TestFramework\ObjectManager $objectManager */
355357 $ objectManager = Helper \Bootstrap::getObjectManager ();
356358 if (!$ objectManager ) {
357359 $ objectManager = $ this ->_factory ->create ($ overriddenParams );
358- $ objectManager ->addSharedInstance ($ directoryList , \Magento \Framework \App \Filesystem \DirectoryList::class);
359- $ objectManager ->addSharedInstance ($ directoryList , \Magento \Framework \Filesystem \DirectoryList::class);
360+ $ objectManager ->addSharedInstance (
361+ $ directoryList ,
362+ DirectoryList::class
363+ );
364+ $ objectManager ->addSharedInstance (
365+ $ directoryList ,
366+ \Magento \Framework \Filesystem \DirectoryList::class
367+ );
360368 } else {
361369 $ objectManager = $ this ->_factory ->restore ($ objectManager , $ directoryList , $ overriddenParams );
362370 }
363- /** @var \Magento\ TestFramework\App\Filesystem $filesystem */
364- $ filesystem = $ objectManager ->get (\ Magento \ TestFramework \App \Filesystem::class);
371+ /** @var TestFramework\App\Filesystem $filesystem */
372+ $ filesystem = $ objectManager ->get (TestFramework \App \Filesystem::class);
365373 $ objectManager ->removeSharedInstance (\Magento \Framework \Filesystem::class);
366374 $ objectManager ->addSharedInstance ($ filesystem , \Magento \Framework \Filesystem::class);
367375 Helper \Bootstrap::setObjectManager ($ objectManager );
368376 $ this ->initLogger ();
369- $ sequenceBuilder = $ objectManager ->get (\ Magento \ TestFramework \Db \Sequence \Builder::class);
377+ $ sequenceBuilder = $ objectManager ->get (TestFramework \Db \Sequence \Builder::class);
370378 $ objectManager ->addSharedInstance ($ sequenceBuilder , \Magento \SalesSequence \Model \Builder::class);
371379
372380 $ objectManagerConfiguration = [
373381 'preferences ' => [
374- \Magento \Framework \App \State::class => \Magento \TestFramework \App \State::class,
375- \Magento \Framework \Mail \TransportInterface::class =>
376- \Magento \TestFramework \Mail \TransportInterfaceMock::class,
377- \Magento \Framework \Mail \Template \TransportBuilder::class
378- => \Magento \TestFramework \Mail \Template \TransportBuilderMock::class,
382+ \Magento \Framework \App \State::class => TestFramework \App \State::class,
383+ Mail \TransportInterface::class => TestFramework \Mail \TransportInterfaceMock::class,
384+ Mail \Template \TransportBuilder::class => TestFramework \Mail \Template \TransportBuilderMock::class,
379385 ]
380386 ];
381387 if ($ this ->loadTestExtensionAttributes ) {
@@ -385,7 +391,7 @@ public function initialize($overriddenParams = [])
385391 \Magento \Framework \Api \ExtensionAttribute \Config \Reader::class => [
386392 'arguments ' => [
387393 'fileResolver ' => [
388- 'instance ' => \ Magento \ TestFramework \Api \Config \Reader \FileResolver::class
394+ 'instance ' => TestFramework \Api \Config \Reader \FileResolver::class
389395 ],
390396 ],
391397 ],
@@ -400,26 +406,26 @@ public function initialize($overriddenParams = [])
400406 [
401407 'core_app_init_current_store_after ' => [
402408 'integration_tests ' => [
403- 'instance ' => \ Magento \ TestFramework \Event \Magento::class,
409+ 'instance ' => TestFramework \Event \Magento::class,
404410 'name ' => 'integration_tests '
405411 ]
406412 ]
407413 ]
408414 );
409415
410416 if ($ this ->canLoadArea ) {
411- $ this ->loadArea (\ Magento \ TestFramework \Application::DEFAULT_APP_AREA );
417+ $ this ->loadArea (TestFramework \Application::DEFAULT_APP_AREA );
412418 }
413419
414- \ Magento \ TestFramework \Helper \Bootstrap::getObjectManager ()->configure (
420+ TestFramework \Helper \Bootstrap::getObjectManager ()->configure (
415421 $ objectManager ->get (\Magento \Framework \ObjectManager \DynamicConfigInterface::class)->getConfiguration ()
416422 );
417423 \Magento \Framework \Phrase::setRenderer (
418424 $ objectManager ->get (\Magento \Framework \Phrase \Renderer \Placeholder::class)
419425 );
420426
421427 if ($ this ->canInstallSequence ) {
422- /** @var \Magento\ TestFramework\Db\Sequence $sequence */
428+ /** @var TestFramework\Db\Sequence $sequence */
423429 $ sequence = $ objectManager ->get (\Magento \TestFramework \Db \Sequence::class);
424430 $ sequence ->generateSequences ();
425431 }
@@ -649,7 +655,7 @@ protected function _ensureDirExists($dir)
649655 // phpcs:ignore Magento2.Functions.DiscouragedFunction
650656 mkdir ($ dir , 0777 , true );
651657 umask ($ old );
652- // phpcs:ignore Magento2.Functions.DiscouragedFunction
658+ // phpcs:ignore Magento2.Functions.DiscouragedFunction
653659 } elseif (!is_dir ($ dir )) {
654660 throw new \Magento \Framework \Exception \LocalizedException (__ ("'%1' is not a directory. " , $ dir ));
655661 }
0 commit comments