Skip to content
This repository has been archived by the owner on Dec 26, 2021. It is now read-only.

Commit

Permalink
add namespace name accessor on dependency model
Browse files Browse the repository at this point in the history
  • Loading branch information
llaville committed Jul 22, 2014
1 parent 4605d28 commit 049e3dd
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/Bartlett/Reflect/Model/DependencyModel.php
Expand Up @@ -82,6 +82,19 @@ public function getName()
return $this->name;
}

/**
* Gets the namespace name.
*
* @return string
*/
public function getNamespaceName()
{
$parts = explode('\\', $this->getName());
$className = array_pop($parts);

return implode('\\', $parts);
}

/**
* Gets the arguments list of an internal function.
*
Expand Down
17 changes: 17 additions & 0 deletions tests/Model/DependencyModelTest.php
Expand Up @@ -143,6 +143,23 @@ public function testNameAccessor()
);
}

/**
* Tests the namespace name accessor.
*
* covers DependencyModel::getNamespaceName
* @return void
*/
public function testNamespaceNameAccessor()
{
$d = 0; // DateTime::diff

$this->assertEquals(
'',
self::$dependencies[$d]->getNamespaceName(),
self::$dependencies[$d]->getName() . ' namespace does not match.'
);
}

/**
* Tests if the dependency is a class method.
*
Expand Down

0 comments on commit 049e3dd

Please sign in to comment.