当前位置: 首页>>代码示例>>PHP>>正文


PHP emptyArray函数代码示例

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


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


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