diff options
Diffstat (limited to 'vendor/phpunit/php-token-stream/tests')
27 files changed, 1007 insertions, 0 deletions
diff --git a/vendor/phpunit/php-token-stream/tests/Token/ClassTest.php b/vendor/phpunit/php-token-stream/tests/Token/ClassTest.php new file mode 100644 index 0000000..265a656 --- /dev/null +++ b/vendor/phpunit/php-token-stream/tests/Token/ClassTest.php @@ -0,0 +1,169 @@ +<?php +/* + * This file is part of php-token-stream. + * + * (c) Sebastian Bergmann <sebastian@phpunit.de> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use PHPUnit\Framework\TestCase; + +class PHP_Token_ClassTest extends TestCase +{ + /** + * @var PHP_Token_CLASS + */ + private $class; + + /** + * @var PHP_Token_FUNCTION + */ + private $function; + + protected function setUp() + { + $ts = new PHP_Token_Stream(TEST_FILES_PATH . 'source2.php'); + + foreach ($ts as $token) { + if ($token instanceof PHP_Token_CLASS) { + $this->class = $token; + } + + if ($token instanceof PHP_Token_FUNCTION) { + $this->function = $token; + break; + } + } + } + + /** + * @covers PHP_Token_CLASS::getKeywords + */ + public function testGetClassKeywords() + { + $this->assertEquals('abstract', $this->class->getKeywords()); + } + + /** + * @covers PHP_Token_FUNCTION::getKeywords + */ + public function testGetFunctionKeywords() + { + $this->assertEquals('abstract,static', $this->function->getKeywords()); + } + + /** + * @covers PHP_Token_FUNCTION::getVisibility + */ + public function testGetFunctionVisibility() + { + $this->assertEquals('public', $this->function->getVisibility()); + } + + public function testIssue19() + { + $ts = new PHP_Token_Stream(TEST_FILES_PATH . 'issue19.php'); + + foreach ($ts as $token) { + if ($token instanceof PHP_Token_CLASS) { + $this->assertFalse($token->hasInterfaces()); + } + } + } + + public function testIssue30() + { + $ts = new PHP_Token_Stream(TEST_FILES_PATH . 'issue30.php'); + $this->assertCount(1, $ts->getClasses()); + } + + public function testAnonymousClassesAreHandledCorrectly() + { + $ts = new PHP_Token_Stream(TEST_FILES_PATH . 'class_with_method_that_declares_anonymous_class.php'); + + $classes = $ts->getClasses(); + + $this->assertEquals( + [ + 'class_with_method_that_declares_anonymous_class', + 'AnonymousClass:9#31', + 'AnonymousClass:10#55', + 'AnonymousClass:11#75', + 'AnonymousClass:12#91', + 'AnonymousClass:13#107' + ], + array_keys($classes) + ); + } + + /** + * @ticket https://github.com/sebastianbergmann/php-token-stream/issues/52 + */ + public function testAnonymousClassesAreHandledCorrectly2() + { + $ts = new PHP_Token_Stream(TEST_FILES_PATH . 'class_with_method_that_declares_anonymous_class2.php'); + + $classes = $ts->getClasses(); + + $this->assertEquals(['Test', 'AnonymousClass:4#23'], array_keys($classes)); + $this->assertEquals(['methodOne', 'methodTwo'], array_keys($classes['Test']['methods'])); + + $this->assertEmpty($ts->getFunctions()); + } + + public function testImportedFunctionsAreHandledCorrectly() + { + $ts = new PHP_Token_Stream(TEST_FILES_PATH . 'classUsesNamespacedFunction.php'); + + $this->assertEmpty($ts->getFunctions()); + $this->assertCount(1, $ts->getClasses()); + } + + /** + * @ticket https://github.com/sebastianbergmann/php-code-coverage/issues/543 + */ + public function testClassWithMultipleAnonymousClassesAndFunctionsIsHandledCorrectly() + { + $ts = new PHP_Token_Stream(TEST_FILES_PATH . 'class_with_multiple_anonymous_classes_and_functions.php'); + + $classes = $ts->getClasses(); + + $this->assertArrayHasKey('class_with_multiple_anonymous_classes_and_functions', $classes); + $this->assertArrayHasKey('AnonymousClass:6#23', $classes); + $this->assertArrayHasKey('AnonymousClass:12#53', $classes); + $this->assertArrayHasKey('m', $classes['class_with_multiple_anonymous_classes_and_functions']['methods']); + $this->assertArrayHasKey('anonymousFunction:18#81', $classes['class_with_multiple_anonymous_classes_and_functions']['methods']); + $this->assertArrayHasKey('anonymousFunction:22#108', $classes['class_with_multiple_anonymous_classes_and_functions']['methods']); + } + + /** + * @ticket https://github.com/sebastianbergmann/php-token-stream/issues/68 + */ + public function testClassWithMethodNamedEmptyIsHandledCorrectly() + { + $ts = new PHP_Token_Stream(TEST_FILES_PATH . 'class_with_method_named_empty.php'); + + $classes = $ts->getClasses(); + + $this->assertArrayHasKey('class_with_method_named_empty', $classes); + $this->assertArrayHasKey('empty', $classes['class_with_method_named_empty']['methods']); + } + + /** + * @ticket https://github.com/sebastianbergmann/php-code-coverage/issues/424 + */ + public function testSomething() + { + $ts = new PHP_Token_Stream(TEST_FILES_PATH . 'php-code-coverage-issue-424.php'); + + $classes = $ts->getClasses(); + + $this->assertSame(5, $classes['Example']['methods']['even']['startLine']); + $this->assertSame(12, $classes['Example']['methods']['even']['endLine']); + + $this->assertSame(7, $classes['Example']['methods']['anonymousFunction:7#28']['startLine']); + $this->assertSame(9, $classes['Example']['methods']['anonymousFunction:7#28']['endLine']); + } +} diff --git a/vendor/phpunit/php-token-stream/tests/Token/ClosureTest.php b/vendor/phpunit/php-token-stream/tests/Token/ClosureTest.php new file mode 100644 index 0000000..b4a6735 --- /dev/null +++ b/vendor/phpunit/php-token-stream/tests/Token/ClosureTest.php @@ -0,0 +1,78 @@ +<?php +/* + * This file is part of php-token-stream. + * + * (c) Sebastian Bergmann <sebastian@phpunit.de> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use PHPUnit\Framework\TestCase; + +class PHP_Token_ClosureTest extends TestCase +{ + /** + * @var PHP_Token_FUNCTION[] + */ + private $functions; + + protected function setUp() + { + $ts = new PHP_Token_Stream(TEST_FILES_PATH . 'closure.php'); + + foreach ($ts as $token) { + if ($token instanceof PHP_Token_FUNCTION) { + $this->functions[] = $token; + } + } + } + + /** + * @covers PHP_Token_FUNCTION::getArguments + */ + public function testGetArguments() + { + $this->assertEquals(['$foo' => null, '$bar' => null], $this->functions[0]->getArguments()); + $this->assertEquals(['$foo' => 'Foo', '$bar' => null], $this->functions[1]->getArguments()); + $this->assertEquals(['$foo' => null, '$bar' => null, '$baz' => null], $this->functions[2]->getArguments()); + $this->assertEquals(['$foo' => 'Foo', '$bar' => null, '$baz' => null], $this->functions[3]->getArguments()); + $this->assertEquals([], $this->functions[4]->getArguments()); + $this->assertEquals([], $this->functions[5]->getArguments()); + } + + /** + * @covers PHP_Token_FUNCTION::getName + */ + public function testGetName() + { + $this->assertEquals('anonymousFunction:2#5', $this->functions[0]->getName()); + $this->assertEquals('anonymousFunction:3#27', $this->functions[1]->getName()); + $this->assertEquals('anonymousFunction:4#51', $this->functions[2]->getName()); + $this->assertEquals('anonymousFunction:5#71', $this->functions[3]->getName()); + $this->assertEquals('anonymousFunction:6#93', $this->functions[4]->getName()); + $this->assertEquals('anonymousFunction:7#106', $this->functions[5]->getName()); + } + + /** + * @covers PHP_Token::getLine + */ + public function testGetLine() + { + $this->assertEquals(2, $this->functions[0]->getLine()); + $this->assertEquals(3, $this->functions[1]->getLine()); + $this->assertEquals(4, $this->functions[2]->getLine()); + $this->assertEquals(5, $this->functions[3]->getLine()); + } + + /** + * @covers PHP_TokenWithScope::getEndLine + */ + public function testGetEndLine() + { + $this->assertEquals(2, $this->functions[0]->getLine()); + $this->assertEquals(3, $this->functions[1]->getLine()); + $this->assertEquals(4, $this->functions[2]->getLine()); + $this->assertEquals(5, $this->functions[3]->getLine()); + } +} diff --git a/vendor/phpunit/php-token-stream/tests/Token/FunctionTest.php b/vendor/phpunit/php-token-stream/tests/Token/FunctionTest.php new file mode 100644 index 0000000..539f827 --- /dev/null +++ b/vendor/phpunit/php-token-stream/tests/Token/FunctionTest.php @@ -0,0 +1,139 @@ +<?php +/* + * This file is part of php-token-stream. + * + * (c) Sebastian Bergmann <sebastian@phpunit.de> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use PHPUnit\Framework\TestCase; + +class PHP_Token_FunctionTest extends TestCase +{ + /** + * @var PHP_Token_FUNCTION[] + */ + private $functions; + + protected function setUp() + { + $ts = new PHP_Token_Stream(TEST_FILES_PATH . 'source.php'); + + foreach ($ts as $token) { + if ($token instanceof PHP_Token_FUNCTION) { + $this->functions[] = $token; + } + } + } + + /** + * @covers PHP_Token_FUNCTION::getArguments + */ + public function testGetArguments() + { + $this->assertEquals([], $this->functions[0]->getArguments()); + + $this->assertEquals( + ['$baz' => 'Baz'], $this->functions[1]->getArguments() + ); + + $this->assertEquals( + ['$foobar' => 'Foobar'], $this->functions[2]->getArguments() + ); + + $this->assertEquals( + ['$barfoo' => 'Barfoo'], $this->functions[3]->getArguments() + ); + + $this->assertEquals([], $this->functions[4]->getArguments()); + + $this->assertEquals(['$x' => null, '$y' => null], $this->functions[5]->getArguments()); + } + + /** + * @covers PHP_Token_FUNCTION::getName + */ + public function testGetName() + { + $this->assertEquals('foo', $this->functions[0]->getName()); + $this->assertEquals('bar', $this->functions[1]->getName()); + $this->assertEquals('foobar', $this->functions[2]->getName()); + $this->assertEquals('barfoo', $this->functions[3]->getName()); + $this->assertEquals('baz', $this->functions[4]->getName()); + } + + /** + * @covers PHP_Token::getLine + */ + public function testGetLine() + { + $this->assertEquals(5, $this->functions[0]->getLine()); + $this->assertEquals(10, $this->functions[1]->getLine()); + $this->assertEquals(17, $this->functions[2]->getLine()); + $this->assertEquals(21, $this->functions[3]->getLine()); + $this->assertEquals(29, $this->functions[4]->getLine()); + } + + /** + * @covers PHP_TokenWithScope::getEndLine + */ + public function testGetEndLine() + { + $this->assertEquals(5, $this->functions[0]->getEndLine()); + $this->assertEquals(12, $this->functions[1]->getEndLine()); + $this->assertEquals(19, $this->functions[2]->getEndLine()); + $this->assertEquals(23, $this->functions[3]->getEndLine()); + $this->assertEquals(31, $this->functions[4]->getEndLine()); + } + + /** + * @covers PHP_Token_FUNCTION::getDocblock + */ + public function testGetDocblock() + { + $this->assertNull($this->functions[0]->getDocblock()); + + $this->assertEquals( + "/**\n * @param Baz \$baz\n */", + $this->functions[1]->getDocblock() + ); + + $this->assertEquals( + "/**\n * @param Foobar \$foobar\n */", + $this->functions[2]->getDocblock() + ); + + $this->assertNull($this->functions[3]->getDocblock()); + $this->assertNull($this->functions[4]->getDocblock()); + } + + public function testSignature() + { + $ts = new PHP_Token_Stream(TEST_FILES_PATH . 'source5.php'); + $f = $ts->getFunctions(); + $c = $ts->getClasses(); + $i = $ts->getInterfaces(); + + $this->assertEquals( + 'foo($a, array $b, array $c = array())', + $f['foo']['signature'] + ); + + $this->assertEquals( + 'm($a, array $b, array $c = array())', + $c['c']['methods']['m']['signature'] + ); + + $this->assertEquals( + 'm($a, array $b, array $c = array())', + $c['a']['methods']['m']['signature'] + ); + + $this->assertEquals( + 'm($a, array $b, array $c = array())', + $i['i']['methods']['m']['signature'] + ); + } +} diff --git a/vendor/phpunit/php-token-stream/tests/Token/IncludeTest.php b/vendor/phpunit/php-token-stream/tests/Token/IncludeTest.php new file mode 100644 index 0000000..2056d12 --- /dev/null +++ b/vendor/phpunit/php-token-stream/tests/Token/IncludeTest.php @@ -0,0 +1,65 @@ +<?php +/* + * This file is part of php-token-stream. + * + * (c) Sebastian Bergmann <sebastian@phpunit.de> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use PHPUnit\Framework\TestCase; + +class PHP_Token_IncludeTest extends TestCase +{ + /** + * @var PHP_Token_Stream + */ + private $ts; + + protected function setUp() + { + $this->ts = new PHP_Token_Stream(TEST_FILES_PATH . 'source3.php'); + } + + /** + * @covers PHP_Token_Includes::getName + * @covers PHP_Token_Includes::getType + */ + public function testGetIncludes() + { + $this->assertSame( + ['test4.php', 'test3.php', 'test2.php', 'test1.php'], + $this->ts->getIncludes() + ); + } + + /** + * @covers PHP_Token_Includes::getName + * @covers PHP_Token_Includes::getType + */ + public function testGetIncludesCategorized() + { + $this->assertSame( + [ + 'require_once' => ['test4.php'], + 'require' => ['test3.php'], + 'include_once' => ['test2.php'], + 'include' => ['test1.php'] + ], + $this->ts->getIncludes(true) + ); + } + + /** + * @covers PHP_Token_Includes::getName + * @covers PHP_Token_Includes::getType + */ + public function testGetIncludesCategory() + { + $this->assertSame( + ['test4.php'], + $this->ts->getIncludes(true, 'require_once') + ); + } +} diff --git a/vendor/phpunit/php-token-stream/tests/Token/InterfaceTest.php b/vendor/phpunit/php-token-stream/tests/Token/InterfaceTest.php new file mode 100644 index 0000000..9e8cb24 --- /dev/null +++ b/vendor/phpunit/php-token-stream/tests/Token/InterfaceTest.php @@ -0,0 +1,195 @@ +<?php +/* + * This file is part of php-token-stream. + * + * (c) Sebastian Bergmann <sebastian@phpunit.de> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use PHPUnit\Framework\TestCase; + +class PHP_Token_InterfaceTest extends TestCase +{ + /** + * @var PHP_Token_CLASS + */ + private $class; + + /** + * @var PHP_Token_INTERFACE[] + */ + private $interfaces; + + protected function setUp() + { + $ts = new PHP_Token_Stream(TEST_FILES_PATH . 'source4.php'); + $i = 0; + + foreach ($ts as $token) { + if ($token instanceof PHP_Token_CLASS) { + $this->class = $token; + } elseif ($token instanceof PHP_Token_INTERFACE) { + $this->interfaces[$i] = $token; + $i++; + } + } + } + + /** + * @covers PHP_Token_INTERFACE::getName + */ + public function testGetName() + { + $this->assertEquals( + 'iTemplate', $this->interfaces[0]->getName() + ); + } + + /** + * @covers PHP_Token_INTERFACE::getParent + */ + public function testGetParentNotExists() + { + $this->assertFalse( + $this->interfaces[0]->getParent() + ); + } + + /** + * @covers PHP_Token_INTERFACE::hasParent + */ + public function testHasParentNotExists() + { + $this->assertFalse( + $this->interfaces[0]->hasParent() + ); + } + + /** + * @covers PHP_Token_INTERFACE::getParent + */ + public function testGetParentExists() + { + $this->assertEquals( + 'a', $this->interfaces[2]->getParent() + ); + } + + /** + * @covers PHP_Token_INTERFACE::hasParent + */ + public function testHasParentExists() + { + $this->assertTrue( + $this->interfaces[2]->hasParent() + ); + } + + /** + * @covers PHP_Token_INTERFACE::getInterfaces + */ + public function testGetInterfacesExists() + { + $this->assertEquals( + ['b'], + $this->class->getInterfaces() + ); + } + + /** + * @covers PHP_Token_INTERFACE::hasInterfaces + */ + public function testHasInterfacesExists() + { + $this->assertTrue( + $this->class->hasInterfaces() + ); + } + + /** + * @covers PHP_Token_INTERFACE::getPackage + */ + public function testGetPackageNamespace() + { + $tokenStream = new PHP_Token_Stream(TEST_FILES_PATH . 'classInNamespace.php'); + foreach ($tokenStream as $token) { + if ($token instanceof PHP_Token_INTERFACE) { + $package = $token->getPackage(); + $this->assertSame('Foo\\Bar', $package['namespace']); + } + } + } + + + public function provideFilesWithClassesWithinMultipleNamespaces() + { + return [ + [TEST_FILES_PATH . 'multipleNamespacesWithOneClassUsingBraces.php'], + [TEST_FILES_PATH . 'multipleNamespacesWithOneClassUsingNonBraceSyntax.php'], + ]; + } + + /** + * @dataProvider provideFilesWithClassesWithinMultipleNamespaces + * @covers PHP_Token_INTERFACE::getPackage + */ + public function testGetPackageNamespaceForFileWithMultipleNamespaces($filepath) + { + $tokenStream = new PHP_Token_Stream($filepath); + $firstClassFound = false; + foreach ($tokenStream as $token) { + if ($firstClassFound === false && $token instanceof PHP_Token_INTERFACE) { + $package = $token->getPackage(); + $this->assertSame('TestClassInBar', $token->getName()); + $this->assertSame('Foo\\Bar', $package['namespace']); + $firstClassFound = true; + continue; + } + // Secound class + if ($token instanceof PHP_Token_INTERFACE) { + $package = $token->getPackage(); + $this->assertSame('TestClassInBaz', $token->getName()); + $this->assertSame('Foo\\Baz', $package['namespace']); + + return; + } + } + $this->fail('Seachring for 2 classes failed'); + } + + public function testGetPackageNamespaceIsEmptyForInterfacesThatAreNotWithinNamespaces() + { + foreach ($this->interfaces as $token) { + $package = $token->getPackage(); + $this->assertSame('', $package['namespace']); + } + } + + /** + * @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'); + } +} diff --git a/vendor/phpunit/php-token-stream/tests/Token/NamespaceTest.php b/vendor/phpunit/php-token-stream/tests/Token/NamespaceTest.php new file mode 100644 index 0000000..98360cf --- /dev/null +++ b/vendor/phpunit/php-token-stream/tests/Token/NamespaceTest.php @@ -0,0 +1,69 @@ +<?php +/* + * This file is part of php-token-stream. + * + * (c) Sebastian Bergmann <sebastian@phpunit.de> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use PHPUnit\Framework\TestCase; + +class PHP_Token_NamespaceTest extends TestCase +{ + /** + * @covers PHP_Token_NAMESPACE::getName + */ + public function testGetName() + { + $tokenStream = new PHP_Token_Stream( + TEST_FILES_PATH . 'classInNamespace.php' + ); + + foreach ($tokenStream as $token) { + if ($token instanceof PHP_Token_NAMESPACE) { + $this->assertSame('Foo\\Bar', $token->getName()); + } + } + } + + public function testGetStartLineWithUnscopedNamespace() + { + $tokenStream = new PHP_Token_Stream(TEST_FILES_PATH . 'classInNamespace.php'); + foreach ($tokenStream as $token) { + if ($token instanceof PHP_Token_NAMESPACE) { + $this->assertSame(2, $token->getLine()); + } + } + } + + public function testGetEndLineWithUnscopedNamespace() + { + $tokenStream = new PHP_Token_Stream(TEST_FILES_PATH . 'classInNamespace.php'); + foreach ($tokenStream as $token) { + if ($token instanceof PHP_Token_NAMESPACE) { + $this->assertSame(2, $token->getEndLine()); + } + } + } + public function testGetStartLineWithScopedNamespace() + { + $tokenStream = new PHP_Token_Stream(TEST_FILES_PATH . 'classInScopedNamespace.php'); + foreach ($tokenStream as $token) { + if ($token instanceof PHP_Token_NAMESPACE) { + $this->assertSame(2, $token->getLine()); + } + } + } + + public function testGetEndLineWithScopedNamespace() + { + $tokenStream = new PHP_Token_Stream(TEST_FILES_PATH . 'classInScopedNamespace.php'); + foreach ($tokenStream as $token) { + if ($token instanceof PHP_Token_NAMESPACE) { + $this->assertSame(8, $token->getEndLine()); + } + } + } +} diff --git a/vendor/phpunit/php-token-stream/tests/TokenTest.php b/vendor/phpunit/php-token-stream/tests/TokenTest.php new file mode 100644 index 0000000..e4bbb80 --- /dev/null +++ b/vendor/phpunit/php-token-stream/tests/TokenTest.php @@ -0,0 +1,32 @@ +<?php +/* + * This file is part of php-token-stream. + * + * (c) Sebastian Bergmann <sebastian@phpunit.de> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use PHPUnit\Framework\TestCase; + +class PHP_TokenTest extends TestCase +{ + /** + * @covers PHP_Token::__construct + * @covers PHP_Token::__toString + */ + public function testToString() + { + $this->markTestIncomplete(); + } + + /** + * @covers PHP_Token::__construct + * @covers PHP_Token::getLine + */ + public function testGetLine() + { + $this->markTestIncomplete(); + } +} diff --git a/vendor/phpunit/php-token-stream/tests/_fixture/classExtendsNamespacedClass.php b/vendor/phpunit/php-token-stream/tests/_fixture/classExtendsNamespacedClass.php new file mode 100644 index 0000000..560eec9 --- /dev/null +++ b/vendor/phpunit/php-token-stream/tests/_fixture/classExtendsNamespacedClass.php @@ -0,0 +1,10 @@ +<?php + +namespace Foo\Bar; + +class Baz {} + +namespace Other\Space; + +class Extender extends \Foo\Bar\Baz {} + diff --git a/vendor/phpunit/php-token-stream/tests/_fixture/classInNamespace.php b/vendor/phpunit/php-token-stream/tests/_fixture/classInNamespace.php new file mode 100644 index 0000000..8ade7cd --- /dev/null +++ b/vendor/phpunit/php-token-stream/tests/_fixture/classInNamespace.php @@ -0,0 +1,6 @@ +<?php +namespace Foo\Bar; + +class TestClass +{ +} diff --git a/vendor/phpunit/php-token-stream/tests/_fixture/classInScopedNamespace.php b/vendor/phpunit/php-token-stream/tests/_fixture/classInScopedNamespace.php new file mode 100644 index 0000000..1ba475c --- /dev/null +++ b/vendor/phpunit/php-token-stream/tests/_fixture/classInScopedNamespace.php @@ -0,0 +1,9 @@ +<?php +namespace Foo\BarScoped { + + class TestClass { + + } + +} + diff --git a/vendor/phpunit/php-token-stream/tests/_fixture/classUsesNamespacedFunction.php b/vendor/phpunit/php-token-stream/tests/_fixture/classUsesNamespacedFunction.php new file mode 100644 index 0000000..5e08a12 --- /dev/null +++ b/vendor/phpunit/php-token-stream/tests/_fixture/classUsesNamespacedFunction.php @@ -0,0 +1,8 @@ +<?php +namespace foo; + +use function bar\baz; + +class Foo +{ +}
\ No newline at end of file diff --git a/vendor/phpunit/php-token-stream/tests/_fixture/class_with_method_named_empty.php b/vendor/phpunit/php-token-stream/tests/_fixture/class_with_method_named_empty.php new file mode 100644 index 0000000..1dafc18 --- /dev/null +++ b/vendor/phpunit/php-token-stream/tests/_fixture/class_with_method_named_empty.php @@ -0,0 +1,7 @@ +<?php +class class_with_method_named_empty +{ + public function empty(): void + { + } +} diff --git a/vendor/phpunit/php-token-stream/tests/_fixture/class_with_method_that_declares_anonymous_class.php b/vendor/phpunit/php-token-stream/tests/_fixture/class_with_method_that_declares_anonymous_class.php new file mode 100644 index 0000000..4a02fe1 --- /dev/null +++ b/vendor/phpunit/php-token-stream/tests/_fixture/class_with_method_that_declares_anonymous_class.php @@ -0,0 +1,15 @@ +<?php +interface foo { +} + +class class_with_method_that_declares_anonymous_class +{ + public function method() + { + $o = new class { public function foo() {} }; + $o = new class{public function foo(){}}; + $o = new class extends stdClass {}; + $o = new class extends stdClass {}; + $o = new class implements foo {}; + } +} diff --git a/vendor/phpunit/php-token-stream/tests/_fixture/class_with_method_that_declares_anonymous_class2.php b/vendor/phpunit/php-token-stream/tests/_fixture/class_with_method_that_declares_anonymous_class2.php new file mode 100644 index 0000000..9f3ee28 --- /dev/null +++ b/vendor/phpunit/php-token-stream/tests/_fixture/class_with_method_that_declares_anonymous_class2.php @@ -0,0 +1,16 @@ +<?php +class Test { + public function methodOne() { + $foo = new class { + public function method_in_anonymous_class() { + return true; + } + }; + + return $foo->method_in_anonymous_class(); + } + + public function methodTwo() { + return false; + } +} diff --git a/vendor/phpunit/php-token-stream/tests/_fixture/class_with_multiple_anonymous_classes_and_functions.php b/vendor/phpunit/php-token-stream/tests/_fixture/class_with_multiple_anonymous_classes_and_functions.php new file mode 100644 index 0000000..3267ba5 --- /dev/null +++ b/vendor/phpunit/php-token-stream/tests/_fixture/class_with_multiple_anonymous_classes_and_functions.php @@ -0,0 +1,26 @@ +<?php +class class_with_multiple_anonymous_classes_and_functions +{ + public function m() + { + $c = new class { + public function n() { + return true; + } + }; + + $d = new class { + public function o() { + return false; + } + }; + + $f = function ($a, $b) { + return $a + $b; + }; + + $g = function ($a, $b) { + return $a - $b; + }; + } +}
\ No newline at end of file diff --git a/vendor/phpunit/php-token-stream/tests/_fixture/closure.php b/vendor/phpunit/php-token-stream/tests/_fixture/closure.php new file mode 100644 index 0000000..a0e3a81 --- /dev/null +++ b/vendor/phpunit/php-token-stream/tests/_fixture/closure.php @@ -0,0 +1,7 @@ +<?php +$function1 = function($foo, $bar) use ($var) {}; +$function2 = function(Foo $foo, $bar) use ($var) {}; +$function3 = function ($foo, $bar, $baz) {}; +$function4 = function (Foo $foo, $bar, $baz) {}; +$function5 = function () {}; +$function6 = function() {}; diff --git a/vendor/phpunit/php-token-stream/tests/_fixture/issue19.php b/vendor/phpunit/php-token-stream/tests/_fixture/issue19.php new file mode 100644 index 0000000..91eeb47 --- /dev/null +++ b/vendor/phpunit/php-token-stream/tests/_fixture/issue19.php @@ -0,0 +1,3 @@ +<?php +class TestClass { +} diff --git a/vendor/phpunit/php-token-stream/tests/_fixture/issue30.php b/vendor/phpunit/php-token-stream/tests/_fixture/issue30.php new file mode 100644 index 0000000..0d1f6f3 --- /dev/null +++ b/vendor/phpunit/php-token-stream/tests/_fixture/issue30.php @@ -0,0 +1,8 @@ +<?php +class Foo +{ + public function bar() + { + return Foo::CLASS; + } +} diff --git a/vendor/phpunit/php-token-stream/tests/_fixture/multipleNamespacesWithOneClassUsingBraces.php b/vendor/phpunit/php-token-stream/tests/_fixture/multipleNamespacesWithOneClassUsingBraces.php new file mode 100644 index 0000000..d3a12e3 --- /dev/null +++ b/vendor/phpunit/php-token-stream/tests/_fixture/multipleNamespacesWithOneClassUsingBraces.php @@ -0,0 +1,12 @@ +<?php +namespace Foo\Bar; + +class TestClassInBar +{ +} + +namespace Foo\Baz; + +class TestClassInBaz +{ +} diff --git a/vendor/phpunit/php-token-stream/tests/_fixture/multipleNamespacesWithOneClassUsingNonBraceSyntax.php b/vendor/phpunit/php-token-stream/tests/_fixture/multipleNamespacesWithOneClassUsingNonBraceSyntax.php new file mode 100644 index 0000000..4ee4f24 --- /dev/null +++ b/vendor/phpunit/php-token-stream/tests/_fixture/multipleNamespacesWithOneClassUsingNonBraceSyntax.php @@ -0,0 +1,14 @@ +<?php +namespace Foo\Bar +{ + class TestClassInBar + { + } +} + +namespace Foo\Baz +{ + class TestClassInBaz + { + } +} diff --git a/vendor/phpunit/php-token-stream/tests/_fixture/php-code-coverage-issue-424.php b/vendor/phpunit/php-token-stream/tests/_fixture/php-code-coverage-issue-424.php new file mode 100644 index 0000000..457e0bb --- /dev/null +++ b/vendor/phpunit/php-token-stream/tests/_fixture/php-code-coverage-issue-424.php @@ -0,0 +1,13 @@ +<?php + +class Example +{ + public function even($numbers) + { + $numbers = array_filter($numbers, function($number) { + return $number % 2 === 0; + }); + + return array_merge($numbers); + } +}
\ No newline at end of file diff --git a/vendor/phpunit/php-token-stream/tests/_fixture/source.php b/vendor/phpunit/php-token-stream/tests/_fixture/source.php new file mode 100644 index 0000000..0c9b87f --- /dev/null +++ b/vendor/phpunit/php-token-stream/tests/_fixture/source.php @@ -0,0 +1,36 @@ +<?php +/** + * Some comment + */ +class Foo{function foo(){} + + /** + * @param Baz $baz + */ + public function bar(Baz $baz) + { + } + + /** + * @param Foobar $foobar + */ + static public function foobar(Foobar $foobar) + { + } + + public function barfoo(Barfoo $barfoo) + { + } + + /** + * This docblock does not belong to the baz function + */ + + public function baz() + { + } + + public function blaz($x, $y) + { + } +} diff --git a/vendor/phpunit/php-token-stream/tests/_fixture/source2.php b/vendor/phpunit/php-token-stream/tests/_fixture/source2.php new file mode 100644 index 0000000..b33dce1 --- /dev/null +++ b/vendor/phpunit/php-token-stream/tests/_fixture/source2.php @@ -0,0 +1,6 @@ +<?php +// short desc +abstract class A { + /* abst meth: */ + public static abstract function method(); +} diff --git a/vendor/phpunit/php-token-stream/tests/_fixture/source3.php b/vendor/phpunit/php-token-stream/tests/_fixture/source3.php new file mode 100644 index 0000000..7e42b60 --- /dev/null +++ b/vendor/phpunit/php-token-stream/tests/_fixture/source3.php @@ -0,0 +1,14 @@ +<?php +// This file is example#1 +// from http://www.php.net/manual/en/function.get-included-files.php + +include 'test1.php'; +include_once 'test2.php'; +require 'test3.php'; +require_once 'test4.php'; + +$included_files = get_included_files(); + +foreach ($included_files as $filename) { + echo "$filename\n"; +} diff --git a/vendor/phpunit/php-token-stream/tests/_fixture/source4.php b/vendor/phpunit/php-token-stream/tests/_fixture/source4.php new file mode 100644 index 0000000..6b064fc --- /dev/null +++ b/vendor/phpunit/php-token-stream/tests/_fixture/source4.php @@ -0,0 +1,30 @@ +<?php +// Declare the interface 'iTemplate' +interface iTemplate +{ + public function setVariable($name, $var); + public function + getHtml($template); +} + +interface a +{ + public function foo(); +} + +interface b extends a +{ + public function baz(Baz $baz); +} + +// short desc for class that implement a unique interface +class c implements b +{ + public function foo() + { + } + + public function baz(Baz $baz) + { + } +} diff --git a/vendor/phpunit/php-token-stream/tests/_fixture/source5.php b/vendor/phpunit/php-token-stream/tests/_fixture/source5.php new file mode 100644 index 0000000..ef7d474 --- /dev/null +++ b/vendor/phpunit/php-token-stream/tests/_fixture/source5.php @@ -0,0 +1,5 @@ +<?php +function foo($a, array $b, array $c = array()) {} +interface i { public function m($a, array $b, array $c = array()); } +abstract class a { abstract public function m($a, array $b, array $c = array()); } +class c { public function m($a, array $b, array $c = array()) {} } diff --git a/vendor/phpunit/php-token-stream/tests/bootstrap.php b/vendor/phpunit/php-token-stream/tests/bootstrap.php new file mode 100644 index 0000000..bcd0f64 --- /dev/null +++ b/vendor/phpunit/php-token-stream/tests/bootstrap.php @@ -0,0 +1,15 @@ +<?php +/* + * This file is part of php-token-stream. + * + * (c) Sebastian Bergmann <sebastian@phpunit.de> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +require __DIR__ . '/../vendor/autoload.php'; + +define( + 'TEST_FILES_PATH', + __DIR__ . DIRECTORY_SEPARATOR . '_fixture' . DIRECTORY_SEPARATOR +); |