• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP emptyArray函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中emptyArray函数的典型用法代码示例。如果您正苦于以下问题:PHP emptyArray函数的具体用法?PHP emptyArray怎么用?PHP emptyArray使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了emptyArray函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: testTruncateCategoryAnalytics

 public function testTruncateCategoryAnalytics()
 {
     Factory::create('Giftertipster\\Entity\\Eloquent\\Analytic\\CategoryAnalytic');
     assertThat(CategoryAnalytic::get()->toArray(), not(emptyArray()));
     $this->repo->truncateCategoryAnalytics();
     assertThat(CategoryAnalytic::get()->toArray(), emptyArray());
 }
开发者ID:ryanrobertsname,项目名称:giftertipster.com,代码行数:7,代码来源:EloquentAnalyticsRepositoryTest.php


示例2: testCallChunkedWithNoValues

 public function testCallChunkedWithNoValues()
 {
     $values = array();
     assertThat(ArrayOperation::callChunked(function ($values) {
         return array(count($values));
     }, $values, 2), is(emptyArray()));
 }
开发者ID:DanielDobre,项目名称:fossology,代码行数:7,代码来源:ArrayOperationTest.php


示例3: testDeleteWhenIdIsProvided

 public function testDeleteWhenIdIsProvided()
 {
     $product = Factory::create('Giftertipster\\Entity\\Eloquent\\Product');
     $keyword_profile = Factory::make('Giftertipster\\Entity\\Eloquent\\KeywordProfile');
     $product->keywordProfile()->save($keyword_profile);
     $this->repo->delete(1);
     assertThat(KeywordProfile::get()->toArray(), emptyArray());
 }
开发者ID:ryanrobertsname,项目名称:giftertipster.com,代码行数:8,代码来源:EloquentKeywordProfileRepositoryTest.php


示例4: testArraySeparateWithUndefinedIndexes

 public function testArraySeparateWithUndefinedIndexes()
 {
     $array = [1 => 'January', 2 => 'February', 3 => 'March', 4 => 'April'];
     $keys = [5, 6];
     $result = array_separate($array, $keys);
     assertThat($result, is(emptyArray()));
     assertThat(count($array), is(equalTo(4)));
 }
开发者ID:estebanmatias92,项目名称:pull-automatically-galleries,代码行数:8,代码来源:helpersTest.php


示例5: testDelete

 public function testDelete()
 {
     $this->client->delete();
     $msgs = [];
     $this->client->receive(function ($msg) use(&$msgs) {
         $msgs[] = $msg;
     }, null);
     assertThat($msgs, is(emptyArray()));
 }
开发者ID:traxo,项目名称:queue,代码行数:9,代码来源:ArrayIntegrationTest.php


示例6: testGetNonArtifactDescendantsWithoutMaterialize

 public function testGetNonArtifactDescendantsWithoutMaterialize()
 {
     $uploadTreeProxy = new UploadTreeProxy($uploadId = 1, $options = array(), $uploadTreeTableName = 'uploadtree_a');
     $artifact = new ItemTreeBounds(2, 'uploadtree_a', $uploadId, 2, 3);
     $artifactDescendants = $uploadTreeProxy->getNonArtifactDescendants($artifact);
     assertThat($artifactDescendants, emptyArray());
     $zip = new ItemTreeBounds(1, 'uploadtree_a', $uploadId, 1, 24);
     $zipDescendants = $uploadTreeProxy->getNonArtifactDescendants($zip);
     assertThat(array_keys($zipDescendants), arrayContainingInAnyOrder(array(6, 7, 8, 10, 11, 12)));
 }
开发者ID:DanielDobre,项目名称:fossology,代码行数:10,代码来源:UploadTreeProxyTest.php


示例7: testDelete

 public function testDelete()
 {
     $seed_product1 = Factory::create('Giftertipster\\Entity\\Eloquent\\Product');
     $seed_product2 = Factory::create('Giftertipster\\Entity\\Eloquent\\Product');
     $update_attributes = ['binding' => 'binding update test'];
     $product_repo = $this->app->make('Giftertipster\\Repository\\Product\\EloquentProductRepository');
     $product_repo->delete(2);
     $product = $this->eloquent_product->all()->toArray();
     assertThat($product, not(emptyArray()));
     assertThat($product[0], hasKeyValuePair('id', 1));
     assertThat($product[0], not(hasKeyValuePair('id', 2)));
 }
开发者ID:ryanrobertsname,项目名称:giftertipster.com,代码行数:12,代码来源:EloquentProductRepositoryTest.php


示例8: testAddVariableWithRegexRoute

 public function testAddVariableWithRegexRoute()
 {
     $patternBuilder = \Mockery::mock('Rootr\\PatternBuilder');
     $patternBuilder->shouldReceive('build')->andReturn(['/products/(\\d+)', ['id']]);
     $router = new Router($patternBuilder);
     $router->add('GET', '/products/{id}', function ($id) {
         return "/products/{$id}";
     });
     assertThat($router->getStaticRoutes(), emptyArray());
     assertThat($router->getVariableRoutes(), arrayWithSize(1));
     assertThat($router->getVariableRoutes(), hasKeyInArray('/products/(\\d+)'));
 }
开发者ID:eddmann,项目名称:rootr,代码行数:12,代码来源:RouterTest.php


示例9: testGetUnfulfilledRequests

 public function testGetUnfulfilledRequests()
 {
     Factory::create('Giftertipster\\Entity\\Eloquent\\User', ['permissions' => []]);
     Factory::create('Giftertipster\\Entity\\Eloquent\\Product');
     Factory::create('Giftertipster\\Entity\\Eloquent\\Product');
     $seed_request1 = Factory::create('Giftertipster\\Entity\\Eloquent\\ProductDeleteRequest', ['user_id' => 1, 'product_id' => 1, 'is_fulfilled' => 1, 'delete_type' => 'delete']);
     $seed_request2 = Factory::create('Giftertipster\\Entity\\Eloquent\\ProductDeleteRequest', ['user_id' => 1, 'product_id' => 2, 'is_fulfilled' => 0, 'delete_type' => 'delete']);
     $repo = $this->app->make('Giftertipster\\Repository\\ProductDeleteRequest\\EloquentProductDeleteRequestRepository');
     $requests = $repo->getUnfulfilledRequests();
     assertThat($requests, not(emptyArray()));
     assertThat($requests[0], hasKeyValuePair('id', 2));
     assertThat($requests[0], hasKeyValuePair('is_fulfilled', 0));
 }
开发者ID:ryanrobertsname,项目名称:giftertipster.com,代码行数:13,代码来源:EloquentProductDeleteRequestRepositoryTest.php


示例10: testSubProductForCartAddWorks

 public function testSubProductForCartAddWorks()
 {
     $sub_product = Factory::create('Giftertipster\\Entity\\Eloquent\\SubProduct', ['id' => 1, 'vendor_id' => 'asin stub', 'offer_listing_id' => 'offer listing id stub']);
     $image = Factory::make('Giftertipster\\Entity\\Eloquent\\Image', ['category' => 'variation']);
     $image2 = Factory::make('Giftertipster\\Entity\\Eloquent\\Image', ['category' => 'primary']);
     $sub_product->images()->save($image);
     $sub_product->images()->save($image2);
     $sub_product2 = Factory::create('Giftertipster\\Entity\\Eloquent\\SubProduct');
     $sub_product_repo = $this->app->make('Giftertipster\\Repository\\SubProduct\\EloquentSubProductRepository');
     $result_sub_product = $sub_product_repo->subProductDataForCartAdd(1);
     assertThat($result_sub_product, hasKeyValuePair('id', 1));
     assertThat($result_sub_product, hasKey('images'));
     assertThat($result_sub_product['images'], not(emptyArray()));
 }
开发者ID:ryanrobertsname,项目名称:giftertipster.com,代码行数:14,代码来源:EloquentSubProductRepositoryTest.php


示例11: testUploads2Jobs

 public function testUploads2Jobs()
 {
     $jobs = array(3 => 2, 4 => 3, 5 => 5, 6 => 8 % 6, 7 => 13 % 6, 8 => 21 % 6);
     foreach ($jobs as $jobId => $jobUpload) {
         $this->dbManager->insertTableRow('job', array('job_pk' => $jobId, 'job_upload_fk' => $jobUpload));
     }
     $uploadDao = M::mock('Fossology\\Lib\\Dao\\UploadDao');
     $showJobDao = new ShowJobsDao($this->dbManager, $uploadDao);
     $jobsWithoutUpload = $showJobDao->uploads2Jobs(array());
     assertThat($jobsWithoutUpload, is(emptyArray()));
     $jobsWithUploadIdOne = $showJobDao->uploads2Jobs(array(1));
     assertThat($jobsWithUploadIdOne, equalTo(array(1, 7)));
     $jobsAtAll = $showJobDao->uploads2Jobs(array(1, 2, 3, 4, 5));
     assertThat($jobsAtAll, equalTo(array(1, 7, 2, 3, 6, 4, 8, 5)));
     $jobsWithUploadFour = $showJobDao->uploads2Jobs(array(4));
     assertThat($jobsWithUploadFour, is(emptyArray()));
 }
开发者ID:DanielDobre,项目名称:fossology,代码行数:17,代码来源:ShowJobsDaoTest.php


示例12: testGetIncompleteProductLoadsWhenIdHasProduct

 public function testGetIncompleteProductLoadsWhenIdHasProduct()
 {
     $user = Factory::create('Giftertipster\\Entity\\Eloquent\\User', ['permissions' => ['test']]);
     $prod_req = Factory::create('Giftertipster\\Entity\\Eloquent\\ProductRequest', ['created_at' => Carbon::tomorrow(), 'user_id' => 1, 'product_id' => 1, 'vendor' => 'foo', 'vendor_id' => 'bar']);
     $idea = Factory::create('Giftertipster\\Entity\\Eloquent\\Idea', ['created_at' => Carbon::today(), 'user_id' => 1, 'description' => 'foobar idea', 'is_fulfilled' => 0]);
     $repo_result = $this->repo()->getIncompleteProductLoads(1);
     //since keys aren't adjusted after sorting, re apply keys:
     foreach ($repo_result as $item) {
         $result[] = $item;
     }
     assertThat($result, not(emptyArray()));
     assertThat($result[0], hasKeyValuePair('type', 'idea load'));
     assertThat($result[0], hasKey('created_at'));
     assertThat($result[0], hasKey('updated_at'));
     assertThat($result[0], hasKey('description'));
     assertThat($result[0], hasKeyValuePair('query', ['idea_description' => 'foobar idea']));
     assertThat($result[0], hasKey('human_time_diff'));
     assertThat($result, not(hasKey(1)));
 }
开发者ID:ryanrobertsname,项目名称:giftertipster.com,代码行数:19,代码来源:EloquentUserRepositoryTest.php


示例13: testGetCopyrightHighlights

 public function testGetCopyrightHighlights()
 {
     $this->testDb->createPlainTables(array(), true);
     $this->testDb->createInheritedTables();
     $uploadDao = M::mock('Fossology\\Lib\\Dao\\UploadDao');
     $uploadDao->shouldReceive('getUploadEntry')->with(1)->andReturn(array('pfile_fk' => 8));
     $uploadDao->shouldReceive('getUploadEntry')->with(2)->andReturn(array('pfile_fk' => 9));
     $copyrightDao = new CopyrightDao($this->dbManager, $uploadDao);
     $noHighlights = $copyrightDao->getHighlights($uploadTreeId = 1);
     assertThat($noHighlights, emptyArray());
     $this->testDb->insertData(array('copyright'));
     $highlights = $copyrightDao->getHighlights($uploadTreeId = 1);
     assertThat($highlights, arrayWithSize(1));
     $highlight0 = $highlights[0];
     assertThat($highlight0, anInstanceOf(Highlight::classname()));
     $this->assertInstanceOf('Fossology\\Lib\\Data\\Highlight', $highlight0);
     assertThat($highlight0->getEnd(), equalTo(201));
     $hilights = $copyrightDao->getHighlights($uploadTreeId = 2);
     assertThat($hilights, arrayWithSize(1));
     $hilight0 = $hilights[0];
     assertThat($hilight0->getStart(), equalTo(0));
 }
开发者ID:DanielDobre,项目名称:fossology,代码行数:22,代码来源:CopyrightDaoTest.php


示例14: authorize

 /**
  * Authorize filter should be attached to every route
  * Calls the gate:check method with the appropriate user and resource
  * @param Route the route
  * @param $request the request object
  * @param String $action the action mapping of the action performed for a complete list
  * @see AuthServiceProvider
  * @throws ClassNotFoundException if the $action parameter is malformed therefore there is no known Resource to
  * be retrieved
  *
  * TODO: add an after plugin action to allow plugin owners add and authorize their own resources
  */
 private function authorize(Request $request, string $action)
 {
     $user = Auth::user();
     if ($user !== NULL && $action !== '') {
         $resource = explode('-', $action);
         //echo '$resource == ';var_dump($user);
         if (FALSE !== $resource && !emptyArray($resource)) {
             $resource = $resource[1];
         }
         if (!isset($request->id)) {
             $request->id = $user->id;
         }
         if ($request->user()->can($action, $resource)) {
         }
         //            var_dump($resource);
     } elseif ($user === NULL && $action === '') {
         Log::info("Non logged in user tried to access no-action(allowed by default)");
         //   redirect('/login');
     } else {
         Log::info("Non-logged in user tried to perform {$action}");
         abort(401, "Unauthorized action");
     }
 }
开发者ID:northdpole,项目名称:laravelTest,代码行数:35,代码来源:Authorize.php


示例15: handleRequestParameters

 protected function handleRequestParameters(array $requestParameters)
 {
     $queryParameters = array();
     if (isset($requestParameters['paginate'])) {
         $paginateValue = $requestParameters['paginate'];
         $pageValue = isset($requestParameters['page']) ? $requestParameters['page'] : ($requestParameters['page'] = 1);
         $paginateIntValue = $this->validateInteger($paginateValue);
         $pageIntValue = $this->validateInteger($pageValue);
         if (!is_null($paginateIntValue) && !is_null($pageIntValue)) {
             $queryParameters['pagination'] = ['paginate' => $paginateIntValue, 'page' => $pageIntValue];
         }
         unset($requestParameters['paginate']);
         unset($requestParameters['page']);
     }
     if (isset($requestParameters['take'])) {
         $takeIntValue = $this->validateInteger($requestParameters['take']);
         if (!is_null($takeIntValue)) {
             $queryParameters['take'] = $takeIntValue;
             if (isset($queryParameters['pagination'])) {
                 unset($queryParameters['pagination']);
             }
         }
         unset($requestParameters['take']);
     }
     $requestParameters = $this->validateQueryColumnExistence($requestParameters);
     $queries = array();
     foreach ($requestParameters as $key => $value) {
         $validatedQueryParameter = $this->getQueryParameters($key, $value);
         if (is_array($validatedQueryParameter)) {
             array_push($queries, $validatedQueryParameter);
         }
     }
     if (emptyArray($queries)) {
         $queryParameters['queries'] = $queries;
     }
     return $queryParameters;
 }
开发者ID:paulvl,项目名称:faztortest,代码行数:37,代码来源:QueryingRequests.php


示例16: testGetScannedLicensesWithEmptyDetails

 public function testGetScannedLicensesWithEmptyDetails()
 {
     assertThat($this->agentLicenseEventProcessor->getScannedLicenses(array()), is(emptyArray()));
 }
开发者ID:DanielDobre,项目名称:fossology,代码行数:4,代码来源:AgentLicenseEventProcessorTest.php


示例17: testAddPopularitySearchReturnsResultOnSuccess

 public function testAddPopularitySearchReturnsResultOnSuccess()
 {
     //product
     $this->client->index(['index' => $this->product_index, 'type' => $this->product_type, 'id' => 100, 'body' => ['title' => 'test product', 'min_price' => 20000, 'max_price' => 20000, 'datetime' => '2014-02-14 00:01:01', 'group' => 'testgroup1', 'soft_delete_status' => 0], 'refresh' => true]);
     //product
     $this->client->index(['index' => $this->product_index, 'type' => $this->product_type, 'id' => 200, 'body' => ['title' => 'test product2', 'min_price' => 30000, 'max_price' => 20000, 'datetime' => '2014-02-14 00:01:01', 'group' => 'testgroup2', 'soft_delete_status' => 0], 'refresh' => true]);
     //add
     $this->client->index(['index' => $this->add_index, 'type' => $this->add_type, 'id' => 1, 'parent' => 100, 'body' => ['gender_ids' => 1, 'interest_ids' => [1, 2], 'datetime' => '2014-02-14 00:01:01'], 'refresh' => true]);
     //add
     $this->client->index(['index' => $this->add_index, 'type' => $this->add_type, 'id' => 2, 'parent' => 100, 'body' => ['gender_ids' => 2, 'interest_ids' => [2], 'datetime' => '2014-02-14 00:01:01'], 'refresh' => true]);
     //add
     $this->client->index(['index' => $this->add_index, 'type' => $this->add_type, 'id' => 3, 'parent' => 200, 'body' => ['gender_ids' => 1, 'interests\\_ids' => [2], 'datetime' => '2014-02-14 00:01:01'], 'refresh' => true]);
     $result = $this->repo->AddPopularitySearch(0, 100);
     assertThat($result, hasKey('results'));
     assertThat($result['results'], not(emptyArray()));
     assertThat($result['results'][0], not(hasKey('_source')));
     assertThat($result['meta']['total_hits'], atLeast(1));
     assertThat($result, hasKey('facets'));
     assertThat($result['facets'], hasKey('price'));
     assertThat($result['facets']['price'], not(emptyArray()));
     assertThat($result['facets'], hasKey('group'));
 }
开发者ID:ryanrobertsname,项目名称:giftertipster.com,代码行数:22,代码来源:ESProductsIndexProductRepositoryTest.php


示例18: testPurge

 public function testPurge()
 {
     $url = $this->stubCreateQueue();
     $timeout = $this->stubQueueVisibilityTimeout($url);
     $receiveModel = m::mock('Aws\\ResultInterface');
     $receiveModel->shouldReceive('get')->once()->with('Messages')->andReturn([]);
     $this->sqsClient->shouldReceive('receiveMessage')->once()->with(['QueueUrl' => $url, 'AttributeNames' => ['All'], 'MaxNumberOfMessages' => 1, 'VisibilityTimeout' => $timeout])->andReturn($receiveModel);
     $purgeModel = m::mock('Aws\\ResultInterface');
     $this->sqsClient->shouldReceive('purgeQueue')->once()->with(['QueueUrl' => $url])->andReturn($purgeModel);
     $this->client->purge();
     $msgs = [];
     $this->client->receive(function ($msg) use(&$msgs) {
         $msgs[] = $msg;
     });
     assertThat($msgs, is(emptyArray()));
 }
开发者ID:h-bragg,项目名称:queue,代码行数:16,代码来源:SqsIntegrationTest.php


示例19: runnerDeciderScanWithForceDecision

 private function runnerDeciderScanWithForceDecision($runner)
 {
     $this->setUpTables();
     $this->setUpRepo();
     $jobId = 42;
     $licenseRef1 = $this->licenseDao->getLicenseByShortName("GPL-3.0")->getRef();
     $licenseRef2 = $this->licenseDao->getLicenseByShortName("3DFX")->getRef();
     $agentLicId = $this->licenseDao->getLicenseByShortName("Adaptec")->getRef()->getId();
     $addedLicenses = array($licenseRef1, $licenseRef2);
     assertThat($addedLicenses, not(arrayContaining(null)));
     $agentId = 5;
     $pfile = 4;
     $this->dbManager->queryOnce("INSERT INTO license_file (fl_pk,rf_fk,pfile_fk,agent_fk) VALUES(12222,{$agentLicId},{$pfile},{$agentId})");
     $itemTreeBounds = $this->uploadDao->getItemTreeBounds($itemId = 23);
     assertThat($this->agentLicenseEventProcessor->getScannerEvents($itemTreeBounds), is(not(emptyArray())));
     $eventId1 = $this->clearingDao->insertClearingEvent($itemId, $userId = 2, $groupId = 3, $licenseRef1->getId(), false);
     $eventId2 = $this->clearingDao->insertClearingEvent($itemId, 5, $groupId, $licenseRef2->getId(), true);
     $this->dbManager->queryOnce("UPDATE clearing_event SET job_fk={$jobId}");
     $addedEventIds = array($eventId1, $eventId2);
     list($success, $output, $retCode) = $runner->run($uploadId = 2, $userId, $groupId, $jobId, $args = "-k1");
     $this->assertTrue($success, 'cannot run runner');
     $this->assertEquals($retCode, 0, 'decider failed: ' . $output);
     assertThat($this->getHeartCount($output), equalTo(1));
     $uploadBounds = $this->uploadDao->getParentItemBounds($uploadId);
     $decisions = $this->clearingDao->getFileClearingsFolder($uploadBounds, $groupId);
     assertThat($decisions, is(arrayWithSize(1)));
     /** @var ClearingDecision $deciderMadeDecision */
     $deciderMadeDecision = $decisions[0];
     $eventIds = array();
     foreach ($deciderMadeDecision->getClearingEvents() as $event) {
         $eventIds[] = $event->getEventId();
     }
     assertThat($eventIds, arrayValue($addedEventIds[0]));
     assertThat($eventIds, arrayValue($addedEventIds[1]));
     assertThat($eventIds, arrayWithSize(1 + count($addedEventIds)));
     $this->rmRepo();
 }
开发者ID:DanielDobre,项目名称:fossology,代码行数:37,代码来源:schedulerTest.php


示例20: testGetCommitsOfLastDays

 public function testGetCommitsOfLastDays()
 {
     $result = $this->repositoryApi->getCommitsOfLastDays(60);
     assertThat($result, is(not(emptyArray())));
     assertThat($result[0], hasKey('sha'));
 }
开发者ID:rlintu,项目名称:fossology,代码行数:6,代码来源:RepositoryApiTest.php



注:本文中的emptyArray函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP enString函数代码示例发布时间:2022-05-15
下一篇:
PHP empresa函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap