本文整理汇总了PHP中anInstanceOf函数的典型用法代码示例。如果您正苦于以下问题:PHP anInstanceOf函数的具体用法?PHP anInstanceOf怎么用?PHP anInstanceOf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了anInstanceOf函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testBelongToGalleryRelationshipObjectReturned
public function testBelongToGalleryRelationshipObjectReturned()
{
$meta = Factory::create('PostMeta', ['post_id' => 1]);
Factory::create('Gallery');
$relationship = $meta->gallery();
assertThat($relationship, is(anInstanceOf('Illuminate\\Database\\Eloquent\\Relations\\BelongsTo')));
}
示例2: testTestHasManyMetaRetionshipObjectIsReturned
public function testTestHasManyMetaRetionshipObjectIsReturned()
{
$gallery = Factory::create('Gallery');
Factory::create('PostMeta', ['post_id' => 1]);
$relationship = $gallery->meta();
assertThat($relationship, is(anInstanceOf('Illuminate\\Database\\Eloquent\\Relations\\HasMany')));
}
示例3: testGetFileLicenseMatches
public function testGetFileLicenseMatches()
{
$this->testDb->createPlainTables(array('license_ref', 'uploadtree', 'license_file', 'agent'));
$this->testDb->insertData_license_ref();
$lic0 = $this->dbManager->getSingleRow("Select * from license_ref limit 1");
$licenseRefNumber = $lic0['rf_pk'];
$licenseFileId = 1;
$pfileId = 42;
$agentId = 23;
$matchPercent = 50;
$uploadtreeId = 512;
$uploadID = 123;
$left = 2009;
$right = 2014;
$agentName = "fake";
$agentRev = 1;
$mydate = "'2014-06-04 14:01:30.551093+02'";
$this->testDb->createViews(array('license_file_ref'));
$this->dbManager->queryOnce("INSERT INTO license_file (fl_pk, rf_fk, agent_fk, rf_match_pct, rf_timestamp, pfile_fk)\n VALUES ({$licenseFileId}, {$licenseRefNumber}, {$agentId}, {$matchPercent}, {$mydate}, {$pfileId})");
$this->dbManager->queryOnce("INSERT INTO uploadtree (uploadtree_pk, upload_fk, pfile_fk, lft, rgt)\n VALUES ({$uploadtreeId}, {$uploadID}, {$pfileId}, {$left}, {$right})");
$stmt = __METHOD__ . '.insert.agent';
$this->dbManager->prepare($stmt, "INSERT INTO agent (agent_pk, agent_name, agent_rev, agent_enabled) VALUES (\$1,\$2,\$3,\$4)");
$this->dbManager->execute($stmt, array($agentId, $agentName, $agentRev, 'true'));
$licDao = new LicenseDao($this->dbManager);
$itemTreeBounds = new ItemTreeBounds($uploadtreeId, "uploadtree", $uploadID, $left, $right);
$matches = $licDao->getAgentFileLicenseMatches($itemTreeBounds);
$licenseRef = new LicenseRef($licenseRefNumber, $lic0['rf_shortname'], $lic0['rf_fullname']);
$agentRef = new AgentRef($agentId, $agentName, $agentRev);
$expected = array(new LicenseMatch($pfileId, $licenseRef, $agentRef, $licenseFileId, $matchPercent));
assertThat($matches, equalTo($expected));
assertThat($matches[0], is(anInstanceOf(LicenseMatch::classname())));
$this->addToAssertionCount(\Hamcrest\MatcherAssert::getCount() - $this->assertCountBefore);
}
示例4: testInterface
public function testInterface()
{
assertThat($this->client, is(anInstanceOf('Graze\\Queue\\ConsumerInterface')));
assertThat($this->client, is(anInstanceOf('Graze\\Queue\\DeleterInterface')));
assertThat($this->client, is(anInstanceOf('Graze\\Queue\\ProducerInterface')));
assertThat($this->client, is(anInstanceOf('Graze\\Queue\\PurgerInterface')));
}
示例5: testSetHostToCreateNewGallery
public function testSetHostToCreateNewGallery()
{
$model = new RemoteModelStub();
$model->setHost('Flickr');
$gallery = $model->newModel();
assertThat($gallery, is(anInstanceOf('PullAutomaticallyGalleries\\RemoteApi\\RemoteApiModelInterface')));
}
示例6: testBoot
function testBoot()
{
$ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
$pm = $ioc->get(org_tubepress_api_plugin_PluginManager::_);
$expectedSystemFilters = array(array(org_tubepress_api_const_plugin_FilterPoint::OPTION_SET_PRE_VALIDATION, 'org_tubepress_impl_plugin_filters_prevalidationoptionset_YouTubePlaylistPlPrefixRemover'), array(org_tubepress_api_const_plugin_FilterPoint::OPTION_SET_PRE_VALIDATION, 'org_tubepress_impl_plugin_filters_prevalidationoptionset_StringMagic'), array(org_tubepress_api_const_plugin_FilterPoint::TEMPLATE_EMBEDDED, 'org_tubepress_impl_plugin_filters_embeddedtemplate_CoreVariables'), array(org_tubepress_api_const_plugin_FilterPoint::HTML_EMBEDDED, 'org_tubepress_impl_plugin_filters_embeddedhtml_PlayerJavaScriptApi'), array(org_tubepress_api_const_plugin_FilterPoint::HTML_GALLERY, 'org_tubepress_impl_plugin_filters_galleryhtml_GalleryJs'), array(org_tubepress_api_const_plugin_FilterPoint::JAVASCRIPT_GALLERYINIT, 'org_tubepress_impl_plugin_filters_galleryinitjs_GalleryInitJsBaseParams'), array(org_tubepress_api_const_plugin_FilterPoint::TEMPLATE_GALLERY, 'org_tubepress_impl_plugin_filters_gallerytemplate_CoreVariables'), array(org_tubepress_api_const_plugin_FilterPoint::TEMPLATE_GALLERY, 'org_tubepress_impl_plugin_filters_gallerytemplate_EmbeddedPlayerName'), array(org_tubepress_api_const_plugin_FilterPoint::TEMPLATE_GALLERY, 'org_tubepress_impl_plugin_filters_gallerytemplate_Pagination'), array(org_tubepress_api_const_plugin_FilterPoint::TEMPLATE_GALLERY, 'org_tubepress_impl_plugin_filters_gallerytemplate_Player'), array(org_tubepress_api_const_plugin_FilterPoint::TEMPLATE_GALLERY, 'org_tubepress_impl_plugin_filters_gallerytemplate_VideoMeta'), array(org_tubepress_api_const_plugin_FilterPoint::TEMPLATE_PLAYER, 'org_tubepress_impl_plugin_filters_playertemplate_CoreVariables'), array(org_tubepress_api_const_plugin_FilterPoint::PROVIDER_RESULT, 'org_tubepress_impl_plugin_filters_providerresult_ResultCountCapper'), array(org_tubepress_api_const_plugin_FilterPoint::PROVIDER_RESULT, 'org_tubepress_impl_plugin_filters_providerresult_VideoBlacklist'), array(org_tubepress_api_const_plugin_FilterPoint::PROVIDER_RESULT, 'org_tubepress_impl_plugin_filters_providerresult_PerPageSorter'), array(org_tubepress_api_const_plugin_FilterPoint::PROVIDER_RESULT, 'org_tubepress_impl_plugin_filters_providerresult_VideoPrepender'), array(org_tubepress_api_const_plugin_FilterPoint::TEMPLATE_SEARCHINPUT, 'org_tubepress_impl_plugin_filters_searchinputtemplate_CoreVariables'), array(org_tubepress_api_const_plugin_FilterPoint::TEMPLATE_SINGLEVIDEO, 'org_tubepress_impl_plugin_filters_singlevideotemplate_CoreVariables'), array(org_tubepress_api_const_plugin_FilterPoint::TEMPLATE_SINGLEVIDEO, 'org_tubepress_impl_plugin_filters_singlevideotemplate_VideoMeta'), array(org_tubepress_api_const_plugin_FilterPoint::VARIABLE_READ_FROM_EXTERNAL_INPUT, 'org_tubepress_impl_plugin_filters_variablereadfromexternalinput_StringMagic'));
foreach ($expectedSystemFilters as $filter) {
$pm->shouldReceive('registerFilter')->with($filter[0], anInstanceOf($filter[1]))->once();
}
$pm->shouldReceive('registerListener')->with(org_tubepress_api_const_plugin_EventName::BOOT, anInstanceOf('org_tubepress_impl_plugin_listeners_StorageManagerInitListener'));
$pm->shouldReceive('registerListener')->with(org_tubepress_api_const_plugin_EventName::BOOT, anInstanceOf('org_tubepress_impl_plugin_listeners_WordPressBoot'));
$pm->shouldReceive('registerListener')->with(org_tubepress_api_const_plugin_EventName::BOOT, anInstanceOf('org_tubepress_impl_plugin_listeners_SkeletonExistsListener'));
$pm->shouldReceive('notifyListeners')->with(org_tubepress_api_const_plugin_EventName::BOOT)->once();
$envD = $ioc->get(org_tubepress_api_environment_Detector::_);
$envD->shouldReceive('isWordPress')->once()->andReturn(false);
$context = $ioc->get(org_tubepress_api_exec_ExecutionContext::_);
$context->shouldReceive('get')->with(org_tubepress_api_const_options_names_Advanced::DEBUG_ON)->andReturn(false);
$fe = $ioc->get(org_tubepress_api_filesystem_Explorer::_);
$fe->shouldReceive('getDirectoriesInDirectory')->once()->with('<<user-content-dir>>/plugins', anything())->andReturn(array('fakedirectory'));
$fe->shouldReceive('getFilenamesInDirectory')->once()->with('fakedirectory', anything())->andReturn(array(dirname(__FILE__) . '/../../../resources/simplePhpFile.php'));
$th = $ioc->get(org_tubepress_api_theme_ThemeHandler::_);
$th->shouldReceive('getUserContentDirectory')->once()->andReturn('<<user-content-dir>>');
$sm = $ioc->get(org_tubepress_api_options_StorageManager::_);
$sm->shouldReceive('init')->once();
$this->_sut->boot();
}
示例7: testFormatterImplementsInterfaces
public function testFormatterImplementsInterfaces()
{
$formatter = new MockFormatter();
assertThat($formatter, is(anInstanceOf(FormatterInterface::class)));
assertThat($formatter, is(anInstanceOf(ProcessorAwareInterface::class)));
assertThat($formatter, is(anInstanceOf(FilterAwareInterface::class)));
assertThat($formatter, is(anInstanceOf(SorterAwareInterface::class)));
}
示例8: testDispatchNotFoundRoute
public function testDispatchNotFoundRoute()
{
$dispatcher = new Dispatcher($this->router);
$response = $dispatcher->dispatch('GET', '/not-found');
assertThat($response, is(anInstanceOf('Rootr\\Response')));
assertThat($this->readAttribute($response, 'status'), is(equalTo(404)));
assertThat($this->readAttribute($response, 'body'), is(equalTo('Not Found')));
}
示例9: testCreateMessageWithValidator
public function testCreateMessageWithValidator()
{
$message = $this->factory->createMessage('bar', ['validator' => function ($msg) {
return false;
}]);
assertThat($message, is(anInstanceOf('Graze\\Queue\\Message\\MessageInterface')));
assertThat($message->getBody(), is(identicalTo('bar')));
assertThat($message->isValid(), is(identicalTo(false)));
}
示例10: testCancelUsurpation
public function testCancelUsurpation()
{
$token = $this->mock('Symfony\\Component\\Security\\Core\\Authentication\\Token\\AbstractToken');
$user = new User();
$token->shouldReceive('getUser')->once()->andReturn($user);
$this->om->shouldReceive('refresh')->once()->with($user);
$this->sc->shouldReceive('setToken')->once()->with(anInstanceOf('Symfony\\Component\\Security\\Core\\Authentication\\Token\\UsernamePasswordToken'));
$this->getUpdater()->cancelUsurpation($token);
}
示例11: testShouldMonitorExecutionOfFunction
public function testShouldMonitorExecutionOfFunction()
{
$result = monitorExecution(function () {
});
assertThat($result->dateStart, anInstanceOf('Datetime'));
assertThat($result->dateFinish, anInstanceOf('Datetime'));
assertThat($result->elapsedSeconds, greaterThanOrEqualTo(0));
assertThat($result->convertSecondsToReadableString(), is('0s'));
assertThat($result->hasFailed(), is(false));
}
示例12: testDetectCircularDependencies
public function testDetectCircularDependencies()
{
$items = array('item1' => array('deps' => null, 'id' => 'item1'), 'item2' => array('deps' => null, 'id' => 'item2'), 'item3' => array('deps' => array('item2'), 'id' => 'item3'), 'item4' => array('deps' => array('item1', 'item3'), 'id' => 'item4'), 'item5' => array('deps' => array('item4', 'item6', 'item7'), 'id' => 'item5'), 'item6' => array('deps' => array('item2'), 'id' => 'item6'), 'item7' => array('deps' => array('item1', 'item4', 'item5'), 'id' => 'item7'));
$resolver = new DependencyResolver();
$resolver->register($items);
try {
$resolver->resolveAll();
} catch (\Exception $e) {
assertThat($e, is(anInstanceOf('\\RuntimeException')));
}
}
示例13: testUpdateJob
public function testUpdateJob()
{
Artisan::call('migrate');
RangeCronJob::create(['job_name' => 'foobar job', 'last_id_processed' => 1, 'last_status' => 'fooness']);
$job = $this->repo->findJob('foobar job');
assertThat($job, anInstanceOf('Giftertipster\\Entity\\Eloquent\\RangeCronJob'));
$this->repo->updateJob($job, 'test status', 0);
$updated_job = $this->repo->findJob('foobar job');
assertThat($updated_job->last_status, identicalTo('test status'));
assertThat($updated_job->last_id_processed, equalTo(0));
}
示例14: testAuthenticateSuccess
public function testAuthenticateSuccess()
{
$user = $this->mock('Claroline\\CoreBundle\\Entity\\User');
$user->shouldReceive('getSalt')->once()->andReturn('salt');
$user->shouldReceive('getPassword')->once()->andReturn('trueEncodedPw');
$user->shouldReceive('getRoles')->once()->andReturn(array());
$encoder = $this->mock('Symfony\\Component\\Security\\Core\\Encoder\\PasswordEncoderInterface');
$this->userRepo->shouldReceive('loadUserByUsername')->once()->with('name')->andReturn($user);
$this->encoderFactory->shouldReceive('getEncoder')->andReturn($encoder);
$encoder->shouldReceive('encodePassword')->once()->with('pw', 'salt')->andReturn('trueEncodedPw');
$this->sc->shouldReceive('setToken')->with(anInstanceOf('Symfony\\Component\\Security\\Core\\Authentication\\Token\\UsernamePasswordToken'));
$this->assertTrue($this->authenticator->authenticate('name', 'pw'));
}
示例15: testShouldFormatTraversableAccordingToConvertMethod
public function testShouldFormatTraversableAccordingToConvertMethod()
{
$items = ['foo', 'bar', 'baz'];
/** @var Generator **/
$result = (new MockFormatter())->formatTraversable(new ArrayIterator($items));
assertThat('The result of `formatTraversable` should be a Generator.', $result, is(anInstanceOf('Generator')));
/** @var Generator **/
$result = (new MockFormatter())->formatTraversable(new ArrayIterator($items));
assertThat('Every item in the result should be an array.', iterator_to_array($result), everyItem(is(typeOf('array'))));
/** @var Generator **/
$result = (new MockFormatter())->formatTraversable(new ArrayIterator($items));
assertThat('The result should be the same size as the number of items passed to `formatTraversable`.', $result, is(traversableWithSize(count($items))));
/** @var Generator **/
$result = (new MockFormatter())->formatTraversable(new ArrayIterator($items));
assertThat('The result should be correctly formatted.', iterator_to_array($result), is(anArray([['count' => 1], ['count' => 2], ['count' => 3]])));
}