$application =
new Application();
$application->
add(new \
FooCommand());
$application->
add(new \
Foo1Command());
$this->
assertEquals(['foo'
],
$application->
getNamespaces(), '->getNamespaces() returns an array of unique used namespaces'
);
} public function testFindNamespace() { $application =
new Application();
$application->
add(new \
FooCommand());
$this->
assertEquals('foo',
$application->
findNamespace('foo'
), '->findNamespace() returns the given namespace if it exists'
);
$this->
assertEquals('foo',
$application->
findNamespace('f'
), '->findNamespace() finds a namespace given an abbreviation'
);
$application->
add(new \
Foo2Command());
$this->
assertEquals('foo',
$application->
findNamespace('foo'
), '->findNamespace() returns the given namespace if it exists'
);
} public function testFindNamespaceWithSubnamespaces() { $application =
new Application();
$application->
add(new \
FooSubnamespaced1Command());
$application->
add(new \
FooSubnamespaced2Command());
$this->
assertEquals('foo',
$application->
findNamespace('foo'
), '->findNamespace() returns commands even if the commands are only contained in subnamespaces'
);
}