当前位置: 首页>>代码示例>>PHP>>正文


PHP Shell::hasCode方法代码示例

本文整理汇总了PHP中Psy\Shell::hasCode方法的典型用法代码示例。如果您正苦于以下问题:PHP Shell::hasCode方法的具体用法?PHP Shell::hasCode怎么用?PHP Shell::hasCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Psy\Shell的用法示例。


在下文中一共展示了Shell::hasCode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testKeepCodeBufferOpen

 public function testKeepCodeBufferOpen()
 {
     $shell = new Shell($this->getConfig());
     $shell->addCode('1 \\');
     $this->assertNull($shell->flushCode());
     $this->assertTrue($shell->hasCode());
     $shell->addCode('+ 1 \\');
     $this->assertNull($shell->flushCode());
     $this->assertTrue($shell->hasCode());
     $shell->addCode('+ 1');
     $code = $shell->flushCode();
     $this->assertFalse($shell->hasCode());
     $code = preg_replace('/\\s+/', ' ', $code);
     $this->assertNotNull($code);
     $this->assertEquals('return 1 + 1 + 1;', $code);
 }
开发者ID:EnmanuelCode,项目名称:backend-laravel,代码行数:16,代码来源:ShellTest.php

示例2: testCodeBuffer

 public function testCodeBuffer()
 {
     $shell = new Shell();
     $shell->addCode('class');
     $this->assertNull($shell->flushCode());
     $this->assertTrue($shell->hasCode());
     $shell->addCode('a');
     $this->assertNull($shell->flushCode());
     $this->assertTrue($shell->hasCode());
     $shell->addCode('{}');
     $code = $shell->flushCode();
     $this->assertFalse($shell->hasCode());
     $code = preg_replace('/\\s+/', ' ', $code);
     $this->assertNotNull($code);
     $this->assertEquals('class a { }', $code);
 }
开发者ID:fulore,项目名称:psysh,代码行数:16,代码来源:ShellTest.php


注:本文中的Psy\Shell::hasCode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。