本文整理汇总了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');
}
示例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);
}
示例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);
}
示例4: testDataMapper_ExcludedFiled
public function testDataMapper_ExcludedFiled()
{
$mappedFields = \Phake::makeVisible($this->mapper)->getAllowedFields(User::clazz());
$this->assertTrue(false === array_search('meta', $mappedFields));
}
示例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');
}