@covers PHP_Token_INTERFACE::getPackage
public function testGetPackageNamespaceWhenExtentingFromNamespaceClass() {
$tokenStream = new PHP_Token_Stream(TEST_FILES_PATH . 'classExtendsNamespacedClass.php');
$firstClassFound = false;
foreach ($tokenStream as $token) {
if ($firstClassFound === false && $token instanceof PHP_Token_INTERFACE) {
$package = $token
->getPackage();
$this
->assertSame('Baz', $token
->getName());
$this
->assertSame('Foo\\Bar', $package['namespace']);
$firstClassFound = true;
continue;
}
if ($token instanceof PHP_Token_INTERFACE) {
$package = $token
->getPackage();
$this
->assertSame('Extender', $token
->getName());
$this
->assertSame('Other\\Space', $package['namespace']);
return;
}
}
$this
->fail("Searching for 2 classes failed");
}