Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Merge 5eec1af into 1eadc83
Browse files Browse the repository at this point in the history
  • Loading branch information
qRoC committed Jun 28, 2016
2 parents 1eadc83 + 5eec1af commit 83cfc09
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Generator/ClassGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -1018,6 +1018,7 @@ private function validateConstantValue($value)
*/
private function generateShortOrCompleteClassname($fqnClassName)
{
$fqnClassName = ltrim($fqnClassName, '\\');
$parts = explode('\\', $fqnClassName);
$className = array_pop($parts);
$classNamespace = implode('\\', $parts);
Expand Down
17 changes: 17 additions & 0 deletions test/Generator/ClassGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1107,6 +1107,23 @@ public function testCorrectExtendNames()
$this->assertContains('class ClassName extends DateTime', $classGenerator->generate());
}

/**
* @group 75
*/
public function testCorrectExtendNamesFromGlobalNamespace()
{
$classGenerator = new ClassGenerator();
$classGenerator->setName('ClassName');
$classGenerator->setNamespaceName('SomeNamespace');
$classGenerator->setExtendedClass('\DateTime');
$this->assertContains('class ClassName extends \DateTime', $classGenerator->generate());

$classGenerator = new ClassGenerator();
$classGenerator->setName('ClassName');
$classGenerator->setExtendedClass('\DateTime');
$this->assertContains('class ClassName extends DateTime', $classGenerator->generate());
}

public function testCorrectImplementNames()
{
$classGenerator = new ClassGenerator();
Expand Down

0 comments on commit 83cfc09

Please sign in to comment.