本文整理汇总了PHP中PHPUnit_Framework_Assert::assertInstanceOf方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_Assert::assertInstanceOf方法的具体用法?PHP PHPUnit_Framework_Assert::assertInstanceOf怎么用?PHP PHPUnit_Framework_Assert::assertInstanceOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Framework_Assert
的用法示例。
在下文中一共展示了PHPUnit_Framework_Assert::assertInstanceOf方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: assertLockDiscoveryPropertyCorrect
public function assertLockDiscoveryPropertyCorrect(ezcWebdavMemoryBackend $backend)
{
$prop = $backend->getProperty('/collection/newcollection', 'lockdiscovery');
PHPUnit_Framework_Assert::assertNotNull($prop, 'Lock discovery property not set.');
PHPUnit_Framework_Assert::assertInstanceOf('ezcWebdavLockDiscoveryProperty', $prop, 'Lock discovery property has incorrect type.');
PHPUnit_Framework_Assert::assertEquals(1, count($prop->activeLock), 'Number of activeLock elements incorrect.');
PHPUnit_Framework_Assert::assertEquals(new ezcWebdavPotentialUriContent('http://example.com/some/user', true), $prop->activeLock[0]->owner, 'Lock owner not correct.');
}
示例2: thereAreActivityForQuestions
/**
* @Given /^There are activity for questions$/
*/
public function thereAreActivityForQuestions(TableNode $table)
{
/* @var $em EntityManager */
$em = $this->getEm();
/* @var $activityService \Civix\CoreBundle\Service\ActivityUpdate */
$activityService = $this->getMainContext()->getContainer()->get('civix_core.activity_update');
$hash = $table->getHash();
$diffSec = 0;
foreach ($hash as $row) {
/* @var $question Question */
$diffSec++;
$question = $em->getRepository(Question::class)->findOneBySubject($row['question']);
$activity = $activityService->publishQuestionToActivity($question);
Assert::assertInstanceOf(Activity::class, $activity);
$activity->getSentAt()->sub(new \DateInterval('PT' . (count($hash) - $diffSec) . 'S'));
$activity->setSentAt(clone $activity->getSentAt());
$em->flush($activity);
if (!empty($row['expired_interval_direction'])) {
$expired = new \DateTime();
$expired->{$row}['expired_interval_direction'](new \DateInterval($row['expired_interval_value']));
$activity->setExpireAt($expired);
$em->flush($activity);
}
}
$result = $em->getRepository(QuestionActivity::class)->findAll();
Assert::assertTrue(count($result) >= count($hash));
}
示例3: testProcess
public function testProcess()
{
if (!class_exists(TransactionMiddleware::class)) {
$this->markTestSkipped('"league/tactician-doctrine" is not installed');
}
$this->container->shouldReceive('hasParameter')->with('doctrine.entity_managers')->once()->andReturn(true);
$this->container->shouldReceive('getParameter')->with('doctrine.entity_managers')->once()->andReturn(['default' => 'doctrine.orm.default_entity_manager', 'second' => 'doctrine.orm.second_entity_manager']);
$this->container->shouldReceive('getParameter')->with('doctrine.default_entity_manager')->once()->andReturn('default');
$this->container->shouldReceive('setDefinition')->andReturnUsing(function ($name, Definition $def) {
\PHPUnit_Framework_Assert::assertEquals('tactician.middleware.doctrine.default', $name);
\PHPUnit_Framework_Assert::assertEquals(TransactionMiddleware::class, $def->getClass());
\PHPUnit_Framework_Assert::assertCount(1, $def->getArguments());
\PHPUnit_Framework_Assert::assertInstanceOf(Reference::class, $def->getArgument(0));
\PHPUnit_Framework_Assert::assertEquals('doctrine.orm.default_entity_manager', (string) $def->getArgument(0));
})->once();
$this->container->shouldReceive('setDefinition')->andReturnUsing(function ($name, Definition $def) {
\PHPUnit_Framework_Assert::assertEquals('tactician.middleware.doctrine.second', $name);
\PHPUnit_Framework_Assert::assertEquals(TransactionMiddleware::class, $def->getClass());
\PHPUnit_Framework_Assert::assertCount(1, $def->getArguments());
\PHPUnit_Framework_Assert::assertInstanceOf(Reference::class, $def->getArgument(0));
\PHPUnit_Framework_Assert::assertEquals('doctrine.orm.second_entity_manager', (string) $def->getArgument(0));
})->once();
$this->container->shouldReceive('setDefinition')->with('tactician.middleware.doctrine.second')->once();
$this->container->shouldReceive('setAlias')->once()->with('tactician.middleware.doctrine', 'tactician.middleware.doctrine.default');
$this->compiler->process($this->container);
}
示例4: theSearchHitsAreContentObjects
/**
* @Given /^the Search Hits are Content objects$/
*/
public function theSearchHitsAreContentObjects()
{
/** @var SearchHit[] $searchHits */
$searchHits = $this->getResponseObject()->result->searchHits;
foreach ($searchHits as $searchHit) {
Assertion::assertInstanceOf('eZ\\Publish\\API\\Repository\\Values\\Content\\Content', $searchHit->valueObject);
}
}
示例5: shouldCreateAnUser
/**
* @test
*/
public function shouldCreateAnUser()
{
$user = $this->mockUser();
$userToken = $this->mockUserToken();
$factory = new UserSessionFactoryDefault();
$userSession = $factory->create($user, $userToken);
\PHPUnit_Framework_Assert::assertInstanceOf(UserSessionDefault::class, $userSession);
}
示例6: shouldCreateAnUser
/**
* @test
*/
public function shouldCreateAnUser()
{
$container = $this->mockDependencyInjectionContainer();
$serializer = $this->mockSerializer();
$factory = new UserFactoryDefault($container, $serializer);
$user = $factory->create();
\PHPUnit_Framework_Assert::assertInstanceOf(User::class, $user);
}
示例7: testSendIdentitiedRequest
public function testSendIdentitiedRequest()
{
$guzzleClient = $this->getGuzzleClientMock('{}');
$client = new Client('API_KEY', $guzzleClient);
$request = new RequestById(new Id('tt3665102'));
$response = $client->send($request);
\PHPUnit_Framework_Assert::assertInstanceOf('ClearCode\\OMDB\\Response\\Response', $response);
}
示例8: assertLockDiscoveryPropertyNowhere
public function assertLockDiscoveryPropertyNowhere(ezcWebdavMemoryBackend $backend)
{
$prop = $backend->getProperty('/collection', 'lockdiscovery');
PHPUnit_Framework_Assert::assertInstanceOf('ezcWebdavLockDiscoveryProperty', $prop, 'Property has incorrect type.');
PHPUnit_Framework_Assert::assertEquals(0, count($prop->activeLock), 'Active lock element not removed correctly.');
$prop = $backend->getProperty('/collection/resource.html', 'lockdiscovery');
PHPUnit_Framework_Assert::assertNull($prop);
}
示例9: assertSourceStillThere
public function assertSourceStillThere(ezcWebdavMemoryBackend $backend)
{
PHPUnit_Framework_Assert::assertTrue($backend->nodeExists('/collection/resource.html'));
$prop = $backend->getProperty('/collection/resource.html', 'lockdiscovery');
PHPUnit_Framework_Assert::assertNotNull($prop, 'Lock discovery property removed from source.');
PHPUnit_Framework_Assert::assertInstanceOf('ezcWebdavLockDiscoveryProperty', $prop);
PHPUnit_Framework_Assert::assertEquals(1, count($prop->activeLock), 'Active lock element removed from source.');
PHPUnit_Framework_Assert::assertEquals('opaquelocktoken:1234', $prop->activeLock[0]->token->__toString(), 'Active lock token on destination parent incorrect.');
}
开发者ID:zetacomponents,项目名称:webdav,代码行数:9,代码来源:021_copy_resource_destination_not_locked_success_assertions.php
示例10: assertOperationsLinks
/**
* Checks the integrity of operations links.
*
* @param mixed[] $operations_links
*/
protected function assertOperationsLinks(array $operations_links)
{
foreach ($operations_links as $link) {
\PHPUnit_Framework_Assert::assertArrayHasKey('title', $link);
\PHPUnit_Framework_Assert::assertNotEmpty($link['title']);
\PHPUnit_Framework_Assert::assertArrayHasKey('url', $link);
\PHPUnit_Framework_Assert::assertInstanceOf(Url::class, $link['url']);
}
}
示例11: assertDestinationCorrect
public function assertDestinationCorrect(ezcWebdavMemoryBackend $backend)
{
PHPUnit_Framework_Assert::assertTrue($backend->nodeExists('/other_collection/moved_resource.html'));
$prop = $backend->getProperty('/other_collection/moved_resource.html', 'lockdiscovery');
PHPUnit_Framework_Assert::assertNotNull($prop, 'Lock discovery property not available on destination.');
PHPUnit_Framework_Assert::assertInstanceOf('ezcWebdavLockDiscoveryProperty', $prop);
PHPUnit_Framework_Assert::assertEquals(1, count($prop->activeLock), 'Active lock element not available on destination.');
PHPUnit_Framework_Assert::assertEquals('opaquelocktoken:5678', $prop->activeLock[0]->token->__toString(), 'Active lock token on destination incorrect.');
}
示例12: responseContainsOnlyUsersWithTheEmail
/**
* @Given /^response contains only the user with the email "([^"]*)"$/
*/
public function responseContainsOnlyUsersWithTheEmail($email)
{
$userList = $this->getResponseObject();
Assertion::assertGreaterThan(0, count($userList), 'UserList was expected to contain one user only');
foreach ($userList as $user) {
Assertion::assertInstanceOf('eZ\\Publish\\API\\Repository\\Values\\User\\User', $user, 'Non User found in the response');
Assertion::assertEquals($email, $user->email, "UserList was expected to contain only users with email '{$email}'");
}
}
示例13: assertRedirect
public function assertRedirect($uri, $str = null)
{
PHPUnit::assertInstanceOf('Illuminate\\Http\\RedirectResponse', $this->response);
if ($str) {
PHPUnit::assertEquals($this->app['url']->to($uri), $this->response->headers->get('Location'), 'Caller: ' . $this->getCaller() . ' ' . $str);
} else {
PHPUnit::assertEquals($this->app['url']->to($uri), $this->response->headers->get('Location'));
}
}
示例14: it_returns_new_command_with_uuid_instance
/**
* @test
*/
public function it_returns_new_command_with_uuid_instance()
{
$argumentProcessor = new ArgumentsProcessor([new UuidConverter()]);
$commandReflection = CommandReflection::fromClass(DummyCommandWithUuid::class);
$commandParameters = ['lorem ipsum', '1a67b1de-e3cb-471e-90d3-005341a29b3d'];
$command = $commandReflection->createCommand($commandParameters, $argumentProcessor);
\PHPUnit_Framework_Assert::assertInstanceOf(DummyCommandWithUuid::class, $command);
\PHPUnit_Framework_Assert::assertEquals('lorem ipsum', $command->argument1);
\PHPUnit_Framework_Assert::assertTrue(Uuid::fromString('1a67b1de-e3cb-471e-90d3-005341a29b3d')->equals($command->argument2));
}
示例15: tryList
public function tryList(FunctionalTester $I)
{
$I->wantTo("Check module list output");
$this->routeMatch->setParam('action', 'show');
$result = $this->controller->dispatch(new ConsoleRequest(array(0 => 'public/index.php', 1 => 'modules', 2 => 'list')));
/** @var Zend\Http\PhpEnvironment\Response $response */
$response = $this->controller->getResponse();
\PHPUnit_Framework_Assert::assertEquals(200, $response->getStatusCode());
\PHPUnit_Framework_Assert::assertEquals('', $result);
\PHPUnit_Framework_Assert::assertInstanceOf('ComposerLockParser\\PackagesCollection', $this->viewModel->getPackages());
\PHPUnit_Framework_Assert::assertGreaterThan(0, $this->viewModel->getPackages()->count());
\PHPUnit_Framework_Assert::assertInstanceOf('ComposerLockParser\\Package', $this->viewModel->getPackages()->getByName('t4web/modules'));
}