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


PHP Test::spec方法代码示例

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


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

示例1: testSpecUndefinedClass

 public function testSpecUndefinedClass()
 {
     $class = test::spec('MyVirtualClass');
     /** @var $class ClassProxy **/
     $this->assertFalse($class->isDefined());
     $this->assertFalse($class->hasMethod('__toString'));
     $this->assertFalse($class->hasMethod('edit'));
     verify($class->interfaces())->isEmpty();
     $this->any = $class->make();
     $this->any = $class->construct();
     $this->specify('should return original class name', function () {
         $this->assertContains('Undefined', (string) $this->any);
         $this->assertContains('MyVirtualClass', (string) $this->any->__toString());
     });
     $this->specify('any method can be invoked', function () {
         $this->assertInstanceOf('AspectMock\\Proxy\\Anything', $this->any->doSmth()->withTHis()->andThatsAll()->null());
     });
     $this->specify('any property can be accessed', function () {
         $this->any->that = 'xxx';
         $this->assertInstanceOf('AspectMock\\Proxy\\Anything', $this->any->this->that->another);
     });
     $this->specify('can be used as array', function () {
         $this->any['has keys'];
         unset($this->any['this']);
         $this->any['this'] = 'that';
         $this->assertFalse(isset($this->any['that']));
         $this->assertInstanceOf('AspectMock\\Proxy\\Anything', $this->any['keys']);
     });
     $this->specify('can be iterated', function () {
         foreach ($this->any as $anything) {
         }
     });
     $this->specify('proxifies magic method calls', function () {
         $any = test::doubleProxy($this->any);
         $any->callMeMaybe();
         $any->name = 'hello world';
         $this->assertInstanceOf('AspectMock\\Proxy\\Anything', $any->name);
         verify($any->class->getClassName())->equals('AspectMock\\Proxy\\Anything');
     });
 }
开发者ID:theypsilon,项目名称:AspectMock,代码行数:40,代码来源:testDoubleTest.php

示例2: testNamespaceGuess

 public function testNamespaceGuess()
 {
     test::ns('demo');
     $this->assertFalse(test::spec('\\UserModel')->isDefined());
     $this->assertTrue(test::spec('UserModel')->isDefined());
 }
开发者ID:theypsilon,项目名称:AspectMock,代码行数:6,代码来源:NamespacesTest.php

示例3: _before

 protected function _before()
 {
     Test::spec('\\App\\Controller\\ErrorController');
     $this->request = Test::double('\\Bone\\Mvc\\Request', array('getController' => 'index', 'getAction' => 'index'))->make();
     $this->response = Test::double('\\Bone\\Mvc\\Response')->make();
 }
开发者ID:delboy1978uk,项目名称:bone,代码行数:6,代码来源:BoneMvcDispatcherTest.php


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