public function PHP_Token_InterfaceTest::testGetPackageNamespaceWhenExtentingFromNamespaceClass in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/phpunit/php-token-stream/tests/Token/InterfaceTest.php \PHP_Token_InterfaceTest::testGetPackageNamespaceWhenExtentingFromNamespaceClass()
@covers PHP_Token_INTERFACE::getPackage
File
- vendor/
phpunit/ php-token-stream/ tests/ Token/ InterfaceTest.php, line 171
Class
- PHP_Token_InterfaceTest
- Tests for the PHP_Token_INTERFACE class.
Code
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");
}