Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ModulePathExtractorTest.php
Go to the documentation of this file.
1 <?php
8 
10 use PHPUnit\Framework\TestCase;
11 
12 class ModulePathExtractorTest extends TestCase
13 {
14  const EXTENSION_PATH = "app"
15  . DIRECTORY_SEPARATOR
16  . "code"
17  . DIRECTORY_SEPARATOR
18  . "TestExtension"
19  . DIRECTORY_SEPARATOR
20  . "[Analytics]"
21  . DIRECTORY_SEPARATOR
22  . "Test"
23  . DIRECTORY_SEPARATOR
24  . "Mftf"
25  . DIRECTORY_SEPARATOR
26  . "Test"
27  . DIRECTORY_SEPARATOR
28  . "SomeText.xml";
29 
30  const MAGENTO_PATH = "dev"
31  . DIRECTORY_SEPARATOR
32  . "tests"
33  . DIRECTORY_SEPARATOR
34  . "acceptance"
35  . DIRECTORY_SEPARATOR
36  . "tests"
37  . DIRECTORY_SEPARATOR
38  . "functional"
39  . DIRECTORY_SEPARATOR
40  . "Magento"
41  . DIRECTORY_SEPARATOR
42  . "FunctionalTest"
43  . DIRECTORY_SEPARATOR
44  . "[Analytics]"
45  . DIRECTORY_SEPARATOR
46  . "Test"
47  . DIRECTORY_SEPARATOR
48  . "SomeText.xml";
49 
54  public function testGetMagentoModule()
55  {
56  $modulePathExtractor = new ModulePathExtractor();
57  $this->assertEquals(
58  '[Analytics]',
59  $modulePathExtractor->extractModuleName(
60  self::MAGENTO_PATH
61  )
62  );
63  }
64 
69  public function testGetExtensionModule()
70  {
71  $modulePathExtractor = new ModulePathExtractor();
72  $this->assertEquals(
73  '[Analytics]',
74  $modulePathExtractor->extractModuleName(
75  self::EXTENSION_PATH
76  )
77  );
78  }
79 
84  public function testMagentoModulePath()
85  {
86  $modulePathExtractor = new ModulePathExtractor();
87  $this->assertEquals(
88  'Magento',
89  $modulePathExtractor->getExtensionPath(
90  self::MAGENTO_PATH
91  )
92  );
93  }
94 
99  public function testExtensionModulePath()
100  {
101  $modulePathExtractor = new ModulePathExtractor();
102  $this->assertEquals(
103  'TestExtension',
104  $modulePathExtractor->getExtensionPath(
105  self::EXTENSION_PATH
106  )
107  );
108  }
109 }