当前位置: 首页>>代码示例>>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;未经允许,请勿转载。