本文整理汇总了PHP中anything函数的典型用法代码示例。如果您正苦于以下问题:PHP anything函数的具体用法?PHP anything怎么用?PHP anything使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了anything函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: testOnKernelController
public function testOnKernelController()
{
$request = ShortifyPunit::mock('Symfony\\Component\\HttpFoundation\\Request');
$requestStack = ShortifyPunit::mock('Symfony\\Component\\HttpFoundation\\RequestStack');
$sandboxResponseManager = ShortifyPunit::mock('danrevah\\SandboxBundle\\Managers\\SandboxResponseManager');
$event = ShortifyPunit::mock('Symfony\\Component\\HttpKernel\\Event\\FilterControllerEvent');
$parameterBag = ShortifyPunit::mock('Symfony\\Component\\HttpFoundation\\ParameterBag');
ShortifyPunit::when($request)->getContent()->returns('');
$request->query = $parameterBag;
$request->request = $parameterBag;
ShortifyPunit::when($requestStack)->getCurrentRequest()->returns($request);
ShortifyPunit::when($event)->getController()->returns([0, 1]);
ShortifyPunit::when($event)->setController(anything())->returns(1);
$sandboxListener = new SandboxListener($requestStack, $sandboxResponseManager);
$sandboxListener->onKernelController($event);
$this->assertTrue(ShortifyPunit::verify($event)->setController(anything())->atLeastOnce());
$response = [false, 0, 0, 0];
ShortifyPunit::when($sandboxResponseManager)->getResponseController(anything(), anything(), anything(), anything(), anything())->returns($response);
$event2 = ShortifyPunit::mock('Symfony\\Component\\HttpKernel\\Event\\FilterControllerEvent');
ShortifyPunit::when($event2)->setController(anything())->returns('');
ShortifyPunit::when($event2)->getController(anything())->returns([0, 1]);
$sandboxListener = new SandboxListener($requestStack, $sandboxResponseManager);
$sandboxListener->onKernelController($event2);
$this->assertTrue(ShortifyPunit::verify($event2)->setController(anything())->neverCalled());
}
示例3: testDelegatesMatchingToAnotherMatcher
public function testDelegatesMatchingToAnotherMatcher()
{
$m1 = describedAs('irrelevant', anything());
$m2 = describedAs('irrelevant', not(anything()));
$this->assertTrue($m1->matches(new \stdClass()));
$this->assertFalse($m2->matches('hi'));
}
示例4: prepareShowFolderTree
protected function prepareShowFolderTree($parentFolderId = 'parentFolderId')
{
$this->folderDao->shouldReceive('getFolderTreeCte')->with($parentFolderId)->andReturn($parentFolderId . 'Cte');
$this->dbManager->shouldReceive('prepare')->withArgs(array(anything(), startsWith($parentFolderId . 'Cte')));
$this->dbManager->shouldReceive('execute')->withArgs(array(anything(), array($parentFolderId)))->andReturn($res = $parentFolderId . 'Res');
$this->dbManager->shouldReceive('freeResult')->with($res);
return $res;
}
示例5: it_when_a_user_forgets_their_password_it_reset_and_they_are_notified
/**
* @test
*/
function it_when_a_user_forgets_their_password_it_reset_and_they_are_notified()
{
$gateway = m::mock('OceanCrest\\UserGateway');
$gateway->shouldReceive('getUserByEmail')->with('forgot@mypassword.com')->andReturn(5)->once();
$gateway->shouldReceive('updatePassword')->with(5, anything())->andReturn(true)->once();
$transaction = new UserTransactions($gateway);
$result = $transaction->resetPassword('forgot@mypassword.com');
$this->assertTrue($result);
$this->assertCount(0, $transaction->getErrors());
}
示例6: testDoesAutoCommitOnEvery100StashedTranslations
public function testDoesAutoCommitOnEvery100StashedTranslations()
{
$connection = m::mock('Doctrine\\CouchDB\\HTTP\\Client');
$connection->shouldReceive('request')->with('POST', '/fake_db_name/_design/main/_view/find?', anything())->andReturn(new Response(200, array(), array('rows' => array()), true));
$connection->shouldReceive('request')->with('POST', '/fake_db_name/_bulk_docs', m::any())->twice();
$storage = self::storage(m::mock(self::couchDb($connection), array('getAllDatabases' => array('fake_db_name'))));
for ($i = 0; $i < 201; $i++) {
$storage->ensurePresence(self::yesString());
}
}
示例7: solutionPart2
/**
* @test
* @runInSeparateProcess
* @preserveGlobalState disabled
* @covers ::part2
* @covers ::getCircuit
*/
public function solutionPart2()
{
$wireA = \Mockery::mock('\\Hamdrew\\AdventOfCode\\Day7\\Wire')->shouldReceive('getSignal')->andReturn(123)->getMock();
$wireB = \Mockery::mock('\\Hamdrew\\AdventOfCode\\Day7\\Wire')->shouldReceive('getSignal')->getMock();
$wireB->shouldReceive('setSource');
$this->container->set(InputProvider::class, \Mockery::mock('alias:\\Hamdrew\\AdventOfCode\\InputProvider')->shouldReceive('getInputFromFileForDay')->with(7)->once()->getMock());
\Mockery::mock('alias:\\Hamdrew\\AdventOfCode\\Day7\\CircuitInstructionParser')->shouldReceive('parse');
$searchService = \Mockery::mock('alias:\\Hamdrew\\AdventOfCode\\Day7\\CircuitSearchService')->shouldReceive('findWireByName')->with(anything(), 'b')->andReturn($wireB)->getMock();
$searchService->shouldReceive('findWireByName')->with(anything(), 'a')->andReturn($wireA);
$this->assertSame('123', $this->container->get(SolutionDay7::class)->part2());
}
示例8: setUp
public function setUp()
{
parent::setUp();
Injector::nest();
// Check dependencies
if (!class_exists('Phockito')) {
$this->skipTest = true;
return $this->markTestSkipped("These tests need the Phockito module installed to run");
}
// Mock link checker
$checker = Phockito::mock('LinkChecker');
Phockito::when($checker)->checkLink('http://www.working.com')->return(200);
Phockito::when($checker)->checkLink('http://www.broken.com/url/thing')->return(404);
Phockito::when($checker)->checkLink('http://www.broken.com')->return(403);
Phockito::when($checker)->checkLink('http://www.nodomain.com')->return(0);
Phockito::when($checker)->checkLink('/internal/link')->return(null);
Phockito::when($checker)->checkLink('[sitetree_link,id=9999]')->return(null);
Phockito::when($checker)->checkLink('home')->return(null);
Phockito::when($checker)->checkLink('broken-internal')->return(null);
Phockito::when($checker)->checkLink('[sitetree_link,id=1]')->return(null);
Phockito::when($checker)->checkLink(anything())->return(404);
Injector::inst()->registerService($checker, 'LinkChecker');
}
示例9: testHandleCsv
public function testHandleCsv()
{
$dbManager = M::mock(DbManager::classname());
$licenseCsvImport = new LicenseCsvImport($dbManager);
Reflectory::invokeObjectsMethodnameWith($licenseCsvImport, 'handleCsv', array(array('shortname', 'foo', 'text', 'fullname', 'notes')));
assertThat(Reflectory::getObjectsProperty($licenseCsvImport, 'headrow'), is(notNullValue()));
$dbManager->shouldReceive('getSingleRow')->with('SELECT rf_shortname,rf_source,rf_pk,rf_risk FROM license_ref WHERE rf_md5=md5($1)', anything())->andReturn(false);
$dbManager->shouldReceive('prepare');
$dbManager->shouldReceive('execute');
$dbManager->shouldReceive('freeResult');
$dbManager->shouldReceive('fetchArray')->andReturn(array('rf_pk' => 101, 'rf_risk' => 1));
Reflectory::setObjectsProperty($licenseCsvImport, 'nkMap', array('licA' => false));
Reflectory::invokeObjectsMethodnameWith($licenseCsvImport, 'handleCsv', array(array('licA', 'bar', 'txA', 'liceA', 'noteA')));
assertThat(Reflectory::getObjectsProperty($licenseCsvImport, 'nkMap'), is(array('licA' => 101)));
}
示例10: testCanStubTypeHintedMethodsByPassingOnlyMockIntoWhen
function testCanStubTypeHintedMethodsByPassingOnlyMockIntoWhen()
{
$mock = Phockito::mock('PhockitoHamcrestTest_MockMe');
Phockito::when($mock)->Baz(anything())->return('PassMe');
$this->assertEquals($mock->Baz(new PhockitoHamcrestTest_PassMe()), 'PassMe');
}
示例11: testHighlightQueryOnBoost
function testHighlightQueryOnBoost()
{
$serviceMock = $this->getServiceMock();
Phockito::when($serviceMock)->search(anything(), anything(), anything(), anything(), anything())->return($this->getFakeRawSolrResponse());
$index = new SolrIndexTest_FakeIndex();
$index->setService($serviceMock);
// Search without highlighting
$query = new SearchQuery();
$query->search('term', null, array('Field1' => 1.5, 'HasOneObject_Field1' => 3));
$index->search($query);
Phockito::verify($serviceMock)->search('+(Field1:term^1.5 OR HasOneObject_Field1:term^3)', anything(), anything(), not(hasKeyInArray('hl.q')), anything());
// Search with highlighting
$query = new SearchQuery();
$query->search('term', null, array('Field1' => 1.5, 'HasOneObject_Field1' => 3));
$index->search($query, -1, -1, array('hl' => true));
Phockito::verify($serviceMock)->search('+(Field1:term^1.5 OR HasOneObject_Field1:term^3)', anything(), anything(), hasKeyInArray('hl.q'), anything());
}
示例12: testMagicOperationsReturnResult
/**
* Executing service description defined operations returns the result
* @group unit
*/
public function testMagicOperationsReturnResult()
{
$responseData = array("this" => "that");
Phockito::when($this->mockResponse->getStatusCode())->return(200);
Phockito::when($this->mockResponse->json())->return($this->testDescription);
Phockito::when($this->mockRequest->send())->return($this->mockResponse);
Phockito::when($this->client)->get(anything())->return($this->mockRequest);
Phockito::when($this->client)->callParent(anything(), anything())->return($responseData);
$result = $this->client->SomeOperation(array());
$this->assertEquals($result, $responseData);
}
示例13: createMatcher
protected function createMatcher()
{
return \Hamcrest\Core\DescribedAs::describedAs('irrelevant', anything());
}
示例14: testHamcrestEnabled
public function testHamcrestEnabled()
{
$this->assertTrue(anything() instanceof \Hamcrest_Matcher);
}
示例15: testRunAllGroups
/**
* Test that running all groups covers the entire range of dataobject IDs
*/
public function testRunAllGroups()
{
$this->createDummyData(120);
$logger = new SolrReindexTest_RecordingLogger();
// Test that running all groups covers the complete set of ids
$state = array('SolrReindexTest_Variant' => '1');
for ($i = 0; $i < 6; $i++) {
// See testReindexSegmentsGroups for test that each of these states is invoked during a full reindex
$this->getHandler()->runGroup($logger, $this->index, $state, 'SolrReindexTest_Item', 6, $i);
}
// Count all ids updated
$ids = array();
foreach ($logger->filterMessages('Updated ') as $message) {
$this->assertNotEmpty(preg_match('/^Updated (?<ids>[,\\d]+)/', $message, $matches));
$ids = array_unique(array_merge($ids, explode(',', $matches['ids'])));
}
// Check ids
$this->assertEquals(120, count($ids));
Phockito::verify($this->service, 6)->deleteByQuery(anything());
Phockito::verify($this->service, 1)->deleteByQuery('+(ClassHierarchy:SolrReindexTest_Item) +_query_:"{!frange l=0 u=0}mod(ID, 6)" +(_testvariant:"1")');
Phockito::verify($this->service, 1)->deleteByQuery('+(ClassHierarchy:SolrReindexTest_Item) +_query_:"{!frange l=1 u=1}mod(ID, 6)" +(_testvariant:"1")');
Phockito::verify($this->service, 1)->deleteByQuery('+(ClassHierarchy:SolrReindexTest_Item) +_query_:"{!frange l=2 u=2}mod(ID, 6)" +(_testvariant:"1")');
Phockito::verify($this->service, 1)->deleteByQuery('+(ClassHierarchy:SolrReindexTest_Item) +_query_:"{!frange l=3 u=3}mod(ID, 6)" +(_testvariant:"1")');
Phockito::verify($this->service, 1)->deleteByQuery('+(ClassHierarchy:SolrReindexTest_Item) +_query_:"{!frange l=4 u=4}mod(ID, 6)" +(_testvariant:"1")');
Phockito::verify($this->service, 1)->deleteByQuery('+(ClassHierarchy:SolrReindexTest_Item) +_query_:"{!frange l=5 u=5}mod(ID, 6)" +(_testvariant:"1")');
}