Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
NameBuilderTest.php
Go to the documentation of this file.
1 <?php
7 
8 class NameBuilderTest extends \PHPUnit\Framework\TestCase
9 {
13  protected $nameBuilder;
14 
15  protected function setUp()
16  {
17  $nelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
18  $this->nameBuilder = $nelper->getObject(\Magento\Framework\Code\NameBuilder::class);
19  }
20 
27  public function testBuildClassName($parts, $expected)
28  {
29  $this->assertEquals($expected, $this->nameBuilder->buildClassName($parts));
30  }
31 
35  public function buildClassNameDataProvider()
36  {
37  return [
38  [['Checkout', 'Controller', 'Index'], 'Checkout\Controller\Index'],
39  [['checkout', 'controller', 'index'], 'Checkout\Controller\Index'],
40  [
41  ['magento_backend', 'block', 'system', 'store', 'edit'], \Magento\Backend\Block\System\Store\Edit::class
42  ],
43  [['MyNamespace', 'MyModule'], 'MyNamespace\MyModule'],
44  [['uc', 'words', 'test'], 'Uc\Words\Test'],
45  [['ALL', 'CAPS', 'TEST'], 'ALL\CAPS\TEST'],
46  ];
47  }
48 }