當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。