当前路径:vendor/phpunit/php-token-stream/tests/Token/ClosureTest.php <?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() { foreach (new PHP_Token_Stream(TEST_FILES_PATH . 'closure.php') as $token) { if ($token instanceof PHP_Token_FUNCTION) { $this->functions[] = $token; } } } 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()); } 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()); } 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()); } 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()); } }
相关源码
- 可旋转的彩色立方体C#源代码2021-10-29
- 在线考试系统2021-10-15
- EduSoho开源网校系统源码2019-06-27
- 仿拼多多小程序商城源码2019-06-06
- PHP5网站运行监测系统源码2017-04-14
关于我们 | 顾问团队 | 发展历程 | 联系我们 | 源码上传
联系电话(Tel):4008-010-151(免长途)
地址:北京市海淀区大恒科技大厦五层 邮编:100080
Floor 5th,Daheng Building,Zhongguancun,Beijing,China,100080
51Aspx.com 版权所有 CopyRight © 2006-2023. 京ICP备09089570号 | 京公网安备11010702000869号
联系电话(Tel):4008-010-151(免长途)
地址:北京市海淀区大恒科技大厦五层 邮编:100080
Floor 5th,Daheng Building,Zhongguancun,Beijing,China,100080
51Aspx.com 版权所有 CopyRight © 2006-2023. 京ICP备09089570号 | 京公网安备11010702000869号