Skip to content

Commit a34c18f

Browse files
author
Sergey Shvets
committed
MAGETWO-62582: [GITHUB] ClassGenerator generates class with empty namespace #7893 #7894
added test
1 parent 0f58576 commit a34c18f

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

lib/internal/Magento/Framework/Code/Test/Unit/Generator/ClassGeneratorTest.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,4 +299,32 @@ public function testAddPropertyFromGenerator()
299299
$invalidProperty = new \Zend\Code\Generator\PropertyGenerator();
300300
$this->_model->addPropertyFromGenerator($invalidProperty);
301301
}
302+
303+
/**
304+
* @dataProvider providerNamespaces
305+
* @param string $actualNamespace
306+
* @param string $expectedNamespace
307+
*/
308+
public function testNamespaceName($actualNamespace, $expectedNamespace)
309+
{
310+
$this->assertEquals(
311+
$expectedNamespace,
312+
$this->_model->setNamespaceName($actualNamespace)
313+
->getNamespaceName()
314+
);
315+
}
316+
317+
/**
318+
* DataProvider for testNamespaceName
319+
* @return array
320+
*/
321+
public function providerNamespaces()
322+
{
323+
return [
324+
['Zend', 'Zend'],
325+
['\Zend', 'Zend'],
326+
['\Zend\SomeClass', 'Zend\SomeClass'],
327+
['', null],
328+
];
329+
}
302330
}

0 commit comments

Comments
 (0)