當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Phake::makeVisible方法代碼示例

本文整理匯總了PHP中Phake::makeVisible方法的典型用法代碼示例。如果您正苦於以下問題:PHP Phake::makeVisible方法的具體用法?PHP Phake::makeVisible怎麽用?PHP Phake::makeVisible使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Phake的用法示例。


在下文中一共展示了Phake::makeVisible方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testXmlRendererContentTypeOveride

 /**
  * @runInSeparateProcess
  */
 public function testXmlRendererContentTypeOveride()
 {
     $content = '<xml><a>1</a><b>2</b>';
     $renderer = $this->getRendererMock('Xml');
     $renderer->setHeader('Content-Type', 'test');
     $renderer->render($content);
     $this->expectOutputString($content);
     $this->assertArrayHasKey('Content-Type', Phake::makeVisible($renderer)->getHeaders());
     $this->assertEquals(Phake::makeVisible($renderer)->getHeaders()['Content-Type'], 'text/xml');
 }
開發者ID:adzfaulkner,項目名稱:design-patterns,代碼行數:13,代碼來源:TemplateMethodTest.php

示例2: testAddIfNotPresentReferenceExistsNoMatch

 /**
  * Verify the behaviour when the reference is set to a different
  * object than the one returned by the repository.
  *
  * @expectedException \UnexpectedValueException
  * @expectedExceptionMessage New value does not match existing test-test reference value
  */
 public function testAddIfNotPresentReferenceExistsNoMatch()
 {
     $params = $this->params();
     $trait = $this->factory();
     $existingEntity = new TestEntity('test-id');
     //Make the repostiory return an object
     \Phake::when($params['repo'])->findOneBy(\Phake::anyParameters())->thenReturn($existingEntity);
     \Phake::when($trait)->hasReference('test-test')->thenReturn(true);
     \Phake::when($trait)->getReference('test-test')->thenReturn(new TestEntity('test-id'));
     $entity = new TestEntity('test-id');
     $criteria = array('name' => 'test');
     $prefix = 'test';
     $result = \Phake::makeVisible($trait)->_addIfNotPresent($entity, $criteria, $prefix, $params['object_manager']);
     \Phake::verify($trait, \Phake::times(0))->addReference('test-test', $entity);
     \Phake::verify($params['object_manager'], \Phake::times(0))->persist($entity);
     $this->assertNotSame($entity, $result);
     $this->assertSame($existingEntity, $result);
 }
開發者ID:51systems,項目名稱:doctrine-extensions-module,代碼行數:25,代碼來源:AddIfNotPresentTraitTest.php

示例3: testCallingProtectedMethods

 public function testCallingProtectedMethods()
 {
     $mock = Phake::mock('PhakeTest_MockedClass');
     Phake::when($mock)->innerFunc()->thenCallParent();
     $returned = Phake::makeVisible($mock)->innerFunc();
     Phake::verify($mock)->innerFunc();
     $this->assertSame('test', $returned);
 }
開發者ID:kore,項目名稱:Phake,代碼行數:8,代碼來源:PhakeTest.php

示例4: testDataMapper_ExcludedFiled

 public function testDataMapper_ExcludedFiled()
 {
     $mappedFields = \Phake::makeVisible($this->mapper)->getAllowedFields(User::clazz());
     $this->assertTrue(false === array_search('meta', $mappedFields));
 }
開發者ID:modera,項目名稱:foundation,代碼行數:5,代碼來源:UserDataMapperTest.php

示例5: testGetConfiguredService_NoContainerService

 /**
  * @expectedException \Modera\ServerCrudBundle\Exceptions\BadConfigException
  * @expectedExceptionMessage An error occurred while getting a service for configuration property "entity_validator" using DI service with ID "nonExistingServiceId" - You have requested a non-existent service "nonexistingserviceid".
  */
 public function testGetConfiguredService_NoContainerService()
 {
     $config = array('entity_validator' => 'nonExistingServiceId');
     /** @var ContainerBuilder $container */
     $container = \Phake::partialMock('Symfony\\Component\\DependencyInjection\\ContainerBuilder');
     $container->setParameter(ModeraServerCrudExtension::CONFIG_KEY, $config);
     $container->compile();
     /** @var AbstractCrudController $controller */
     $controller = \Phake::partialMock('Modera\\ServerCrudBundle\\Controller\\AbstractCrudController');
     $controller->setContainer($container);
     \Phake::makeVisible($controller)->getConfiguredService('entity_validator');
 }
開發者ID:modera,項目名稱:foundation,代碼行數:16,代碼來源:AbstractCrudControllerTest.php


注:本文中的Phake::makeVisible方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。