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


PHP Log::shouldReceive方法代码示例

本文整理汇总了PHP中Log::shouldReceive方法的典型用法代码示例。如果您正苦于以下问题:PHP Log::shouldReceive方法的具体用法?PHP Log::shouldReceive怎么用?PHP Log::shouldReceive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Log的用法示例。


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

示例1: testCommandWhenAmzRepoResponseCannotBeObtainedForOneAsin

 public function testCommandWhenAmzRepoResponseCannotBeObtainedForOneAsin()
 {
     $prod_repo_mock = Mockery::mock('Giftertipster\\Repository\\Product\\ProductRepositoryInterface');
     $prod_repo_mock->shouldReceive('getRefreshedIdRange')->once()->with(1, null, 100)->andReturn([['id' => 1, 'vendor' => 'amz', 'vendor_id' => 'a1'], ['id' => 2, 'vendor' => 'amz', 'vendor_id' => 'a2']]);
     $prod_repo_mock->shouldReceive('getRefreshedIdRange')->once()->with(3, null, 100)->andReturn(false);
     $this->app->instance('Giftertipster\\Repository\\Product\\ProductRepositoryInterface', $prod_repo_mock);
     $amz_prod_repo_mock = Mockery::mock('Giftertipster\\Repository\\AmzProduct\\AmzProductRepositoryInterface');
     $amz_prod_repo_mock->shouldReceive('detailLookup')->with('a1, a2')->once()->andReturn(false);
     $amz_prod_repo_mock->shouldReceive('detailLookup')->with('a1')->once()->andReturn(false);
     $amz_prod_repo_mock->shouldReceive('detailLookup')->with('a2')->once()->andReturn([['vendor' => 'amz', 'vendor_id' => 'a2']]);
     $amz_prod_repo_mock->shouldReceive('errors')->andReturn(['errors']);
     $this->app->instance('Giftertipster\\Repository\\AmzProduct\\AmzProductRepositoryInterface', $amz_prod_repo_mock);
     \Log::shouldReceive('error')->twice();
     $prod_suite_repo_mock = Mockery::mock('Giftertipster\\Repository\\ProductSuite\\ProductSuiteRepositoryInterface');
     $prod_suite_repo_mock->shouldreceive('disableProductOffering')->with(1)->once()->andReturn(true);
     $prod_suite_repo_mock->shouldreceive('update')->with(2, ['vendor' => 'amz', 'vendor_id' => 'a2'], true)->once()->andReturn(true);
     $this->app->instance('Giftertipster\\Repository\\ProductSuite\\ProductSuiteRepositoryInterface', $prod_suite_repo_mock);
     $job = $this->app->make('Giftertipster\\Entity\\Eloquent\\RangeCronJob');
     $job->last_id_processed = 0;
     $job->last_status = 'success';
     $cron_job_repo_mock = Mockery::mock('Giftertipster\\Repository\\RangeCronJob\\RangeCronJobRepositoryInterface');
     $cron_job_repo_mock->shouldReceive('findJob')->with('products_update')->once()->andReturn($job);
     $cron_job_repo_mock->shouldReceive('updateJob')->with($job, 'in_progress', 2)->once()->andReturn(true);
     $cron_job_repo_mock->shouldReceive('updateJob')->with($job, 'success', 2)->once()->andReturn(true);
     $this->app->instance('Giftertipster\\Repository\\RangeCronJob\\RangeCronJobRepositoryInterface', $cron_job_repo_mock);
     $tester = new CommandTester(new UpdateProducts());
     $tester->execute([]);
 }
开发者ID:ryanrobertsname,项目名称:giftertipster.com,代码行数:28,代码来源:UpdateProductsTest.php

示例2: testIsDueException

 public function testIsDueException()
 {
     Log::shouldReceive('error')->once();
     $scheduler = m::mock('Indatus\\Dispatcher\\Scheduling\\Schedulable', function ($m) {
         $m->shouldReceive('getSchedule')->once()->andReturn('asdf');
     });
     $this->assertFalse($this->scheduleService->isDue($scheduler));
 }
开发者ID:illuminate3,项目名称:league-production,代码行数:8,代码来源:TestCronScheduleService.php

示例3: testMailSending

 public function testMailSending()
 {
     $this->app['config']->set('settings.log.level', 'debug');
     Log::shouldReceive('debug')->once();
     $faker = Faker::create();
     $this->app['mailer']->raw($faker->paragraph, function ($message) use($faker) {
         $message->from($faker->email, $faker->name)->to($faker->email, $faker->name)->subject($faker->sentence);
     });
 }
开发者ID:hughfletcher,项目名称:nuticket,代码行数:9,代码来源:EventServiceProviderTest.php

示例4: testConfigConfigsApaioWithDefaultUserAndLogsErrorWhenSpecifiedUserDoesNotExist

 public function testConfigConfigsApaioWithDefaultUserAndLogsErrorWhenSpecifiedUserDoesNotExist()
 {
     $this->ConfigMock->shouldReceive('setCountry')->once()->with(Config::get('api.amz_product_api.giftertipster-20.country'))->andReturn($this->ConfigMock);
     $this->ConfigMock->shouldReceive('setAccessKey')->once()->with(Config::get('api.amz_product_api.giftertipster-20.access_key'))->andReturn($this->ConfigMock);
     $this->ConfigMock->shouldReceive('setSecretKey')->once()->with(Config::get('api.amz_product_api.giftertipster-20.secret_key'))->andReturn($this->ConfigMock);
     $this->ConfigMock->shouldReceive('setAssociateTag')->once()->with('giftertipster-20')->andReturn($this->ConfigMock);
     \Log::shouldReceive('error')->once();
     $this->app->instance('ApaiIO\\Configuration\\GenericConfiguration', $this->ConfigMock);
     $this->app->instance('ApaiIO\\ApaiIO', $this->ApaiIOMock);
     $api = $this->app->make('Giftertipster\\Service\\Api\\AmzProductApi\\ApaiIO\\ApaiIOAmzProductApi');
     $api->setUser('roobar user that does not exist');
 }
开发者ID:ryanrobertsname,项目名称:giftertipster.com,代码行数:12,代码来源:ApaiIOAmzProductApiTest.php

示例5: testHandle

 /**
  * Test handle WorkerCommand
  *
  * @return void
  */
 public function testHandle()
 {
     $jobFaker = factory(JobInspect::class)->create();
     $job = Mockery::mock(JobInspect::class);
     $reader = Mockery::mock(ResultReader::class);
     $worker = Mockery::mock(WorkerCommand::class . '[updateJob, runCommand]', [$job, $reader]);
     $job->shouldReceive('getUnhandledJob->first')->andReturn($jobFaker);
     $reader->shouldReceive('setJob');
     $reader->shouldReceive('run')->andReturn(true);
     $worker->shouldReceive('updateJob')->twice();
     $worker->shouldReceive('runCommand')->andReturn('process died');
     \Log::shouldReceive('error');
     $worker->handle();
 }
开发者ID:suitmedia,项目名称:suitcoda,代码行数:19,代码来源:WorkerCommandTest.php

示例6: testMessagesThrowException

 public function testMessagesThrowException()
 {
     $email = factory(App\Email::class)->make(['mail_ssl' => true]);
     $server = m::mock('Fetch\\Server[getMessages]', [$email->mail_host]);
     $server->shouldReceive('getMessages')->once()->andThrow('ErrorException', 'Can not connect to imap server.');
     Log::shouldReceive('notice');
     $imap = m::mock('App\\Services\\Piper\\Imap\\ImapServer[newServer]', [$email, $this->app]);
     $imap->shouldReceive('newServer')->once()->andReturn($server);
     try {
         $return = $imap->messages();
         $this->assertEquals(0, $return->count());
     } catch (ErrorException $e) {
         $this->assertEquals('Can not connect to imap server.', $e->getMessage());
     }
 }
开发者ID:hughfletcher,项目名称:nuticket,代码行数:15,代码来源:ImapServerTest.php

示例7: testParse

 public function testParse()
 {
     //stubs
     $blog_post = '<!--product 32 image--> <!--test that this is ignored--> <a href="<!--pRoduct 323 link-->">invalid link</a> <!--product 323 liNk--> here is a really cool <!--product 32 link--> blog post <a href="<!--product 32 link-->">product link</a>';
     $expected_blog_post = '<image stub> <!--test that this is ignored--> invalid link <p><em>This product link is no longer available</em></p> here is a really cool <p><a href="http://www.amazon.com/testfoobardude12345678901234567890" target="_blank">http://www.amazon.com/testfoobardude12345678901234...</a></p> blog post <a href="http://www.amazon.com/testfoobardude12345678901234567890" target="_blank">product link</a>';
     $product = ['detail_url' => 'http://testlink', 'images' => 'stub image set'];
     $sales_agent_modified = 'http://www.amazon.com/testfoobardude12345678901234567890';
     $author_email = 'author@email.com';
     //mocks
     $product_suite_repo_mock = \Mockery::mock('Giftertipster\\Repository\\ProductSuite\\ProductSuiteRepositoryInterface');
     $product_suite_repo_mock->shouldReceive('find')->with(32)->once()->andReturn($product);
     $product_suite_repo_mock->shouldReceive('find')->with(323)->once()->andThrow(new \InvalidArgumentException());
     $this->app->instance('Giftertipster\\Repository\\ProductSuite\\ProductSuiteRepositoryInterface', $product_suite_repo_mock);
     $sales_agent_mgr_mock = \Mockery::mock('Giftertipster\\Service\\SalesAgent\\SalesAgentMgrInterface');
     $sales_agent_mgr_mock->shouldReceive('setSalesAgentByEmail')->with($author_email)->once();
     $sales_agent_mgr_mock->shouldReceive('updateSalesAgentInString')->with($product['detail_url'])->twice()->andReturn($sales_agent_modified);
     $this->app->instance('Giftertipster\\Service\\SalesAgent\\SalesAgentMgrInterface', $sales_agent_mgr_mock);
     \HTML::shouldReceive('makeImage')->with($product['images'], 'primary', 350, 350, [], [])->andReturn('<image stub>');
     \Log::shouldReceive('error')->once();
     //action
     $response = $this->service()->parse($blog_post, $author_email);
     //assertions
     assertThat($response, identicalTo($expected_blog_post));
 }
开发者ID:ryanrobertsname,项目名称:giftertipster.com,代码行数:24,代码来源:BlogPostParserTest.php

示例8: testServerStarts

 public function testServerStarts()
 {
     Log::shouldReceive('info')->once()->with('[NanoFTPd] Server starting...');
     $this->app['nanoftpd']->shouldRun = false;
     $this->app['nanoftpd']->run();
 }
开发者ID:adamdburton,项目名称:nanoftpd,代码行数:6,代码来源:NanoFTPdTest.php

示例9: testCompileWithError

 public function testCompileWithError()
 {
     GCCompiler::cleanup();
     \App::instance('gcc.compiler', Mockery::mock('\\Closure\\RemoteCompiler')->shouldReceive('setMode')->once()->shouldReceive('addLocalFile')->once()->shouldReceive('compile')->once()->shouldReceive('getCompilerResponse')->once()->andReturn(Mockery::mock('\\Closure\\CompilerInterface')->shouldReceive('hasErrors')->once()->andReturn(true)->shouldReceive('getErrors')->once()->andReturn('error')->shouldReceive('getCompiledCode')->once()->andReturn('')->mock())->mock());
     \Log::shouldReceive('error')->once();
     $gcc = new GCCompiler($this->app['config']);
     $result = $gcc->compile('file1.js');
     $this->assertEquals($result, false);
     $compiled = \File::glob(GCCompiler::storagePath(DIRECTORY_SEPARATOR . '*'));
     $this->assertEquals(1, count($compiled));
 }
开发者ID:jboysen,项目名称:laravel-gcc,代码行数:11,代码来源:TestGCCompiler.php

示例10: testSetSalesAgentByEmailDoesntDoAnythingAndReturnFalseWhenTheSalesAgentIsNotValid

 public function testSetSalesAgentByEmailDoesntDoAnythingAndReturnFalseWhenTheSalesAgentIsNotValid()
 {
     //mocks
     $user_repo_mock = \Mockery::mock('Giftertipster\\Repository\\User\\UserRepositoryInterface');
     $user_repo_mock->shouldReceive('getUsersSalesAgentIdByEmail')->once()->with('user@email.com')->andReturn('invalid sales agent');
     $this->app->instance('Giftertipster\\Repository\\User\\UserRepositoryInterface', $user_repo_mock);
     \Log::shouldReceive('warning');
     $this->salesAgentMgr()->setSalesAgentByEmail('user@email.com');
     assertThat($this->salesAgentMgr()->getSalesAgent(), identicalTo('giftertipster-20'));
 }
开发者ID:ryanrobertsname,项目名称:giftertipster.com,代码行数:10,代码来源:SalesAgentMgrTest.php

示例11: testProcessLoadProductsLogsNoticeExceptionAndDeletesProdSuiteWhenLoadProdSuiteFailsAndOpIsIdea

 public function testProcessLoadProductsLogsNoticeExceptionAndDeletesProdSuiteWhenLoadProdSuiteFailsAndOpIsIdea()
 {
     $product_model_1 = Factory::make('Giftertipster\\Entity\\Eloquent\\Product', ['id' => 1000]);
     $product_model_2 = Factory::make('Giftertipster\\Entity\\Eloquent\\Product', ['id' => 2000]);
     DB::shouldReceive('beginTransaction')->once();
     DB::shouldReceive('commit')->once();
     DB::shouldReceive('rollback')->never();
     Session::start();
     Session::put('AdminProductController.op_id', 100);
     Session::put('AdminProductController.op_type', 'Idea');
     Session::put('AdminProductController.products', [['id' => 'product suite stub 1'], ['id' => 'product suite stub 2']]);
     AuthMgr::shouldReceive('getLoggedUserId')->twice()->andReturn(2);
     Log::shouldReceive('notice')->once()->andReturn(true);
     $category_keyword_generator_mock = Mockery::mock('Giftertipster\\Service\\CategoryKeywords\\CategoryKeywordsGeneratorInterface');
     $category_keyword_generator_mock->shouldReceive('make')->twice()->with(['formatted add stub'])->andReturn(['category', 'keywords']);
     $this->app->instance('Giftertipster\\Service\\CategoryKeywords\\CategoryKeywordsGeneratorInterface', $category_keyword_generator_mock);
     $add_form_prepper_mock = Mockery::mock('Giftertipster\\Service\\Add\\AddFormPrepperInterface');
     $add_form_prepper_mock->shouldReceive('prep')->with(['admin add stub'])->once()->andReturn(['admin add stub']);
     $this->app->instance('Giftertipster\\Service\\Add\\AddFormPrepperInterface', $add_form_prepper_mock);
     $prod_suite_repo = Mockery::mock('Giftertipster\\Repository\\ProductSuite\\ProductSuiteRepositoryInterface');
     $prod_suite_repo->shouldReceive('finderCreate')->with(['id' => 'product suite stub 1', 'keyword_profile' => ['profile' => ['keywords', 'profile']], 'category_keywords' => ['category', 'keywords']], 'Idea', 100, 2, false)->andReturn($product_model_1);
     $prod_suite_repo->shouldReceive('finderCreate')->with(['id' => 'product suite stub 2', 'keyword_profile' => ['profile' => ['keywords', 'profile']], 'category_keywords' => ['category', 'keywords']], 'Idea', 100, 2, false)->andReturn(false);
     //load prod suite fails
     $prod_suite_repo->shouldReceive('delete')->with('product suite stub 2')->once();
     $prod_suite_repo->shouldReceive('errors')->twice()->andReturn(\Mockery::self());
     $prod_suite_repo->shouldReceive('get')->once()->with('sub_products_failure_product_id')->andReturn(['product suite stub 2']);
     $prod_suite_repo->shouldReceive('flushIndexing')->andReturn(true);
     $this->app->instance('Giftertipster\\Repository\\ProductSuite\\ProductSuiteRepositoryInterface', $prod_suite_repo);
     $save_adds = Mockery::mock('Giftertipster\\Service\\Add\\SaveAdminMultiAddsInterface');
     $save_adds->shouldReceive('getFormattedAdd')->twice()->with(['admin add stub'])->andReturn(['formatted add stub']);
     $save_adds->shouldReceive('save')->with(1000, 1, ['admin add stub'])->andReturn(true);
     $save_adds->shouldReceive('save')->with(2000, 1, ['admin add stub'])->andReturn(true);
     $this->app->instance('Giftertipster\\Service\\Add\\SaveAdminMultiAddsInterface', $save_adds);
     $idea_repo = Mockery::mock('Giftertipster\\Repository\\Idea\\IdeaRepositoryInterface');
     $idea_repo->shouldReceive('update')->with(100, ['is_fulfilled' => 1])->andReturn(true);
     $this->app->instance('Giftertipster\\Repository\\Idea\\IdeaRepositoryInterface', $idea_repo);
     $keyword_profile_gen = Mockery::mock('Giftertipster\\Service\\KeywordProfile\\KeywordProfileGeneratorInterface');
     $keyword_profile_gen->shouldReceive('make')->with('keywords string')->andReturn(['keywords', 'profile']);
     $this->app->instance('Giftertipster\\Service\\KeywordProfile\\KeywordProfileGeneratorInterface', $keyword_profile_gen);
     $blacklisted_product_repo = Mockery::mock('Giftertipster\\Repository\\BlacklistedProduct\\BlacklistedProductRepositoryInterface');
     $blacklisted_product_repo->shouldReceive('isProductSuiteBlacklisted')->with(['id' => 'product suite stub 1'])->andReturn(false);
     $blacklisted_product_repo->shouldReceive('isProductSuiteBlacklisted')->with(['id' => 'product suite stub 2'])->andReturn(false);
     $this->app->instance('Giftertipster\\Repository\\BlacklistedProduct\\BlacklistedProductRepositoryInterface', $blacklisted_product_repo);
     $this->call('POST', 'service-tools/load-products', ['query.keywords_profile' => 'keywords string', 'query.add_attributes' => ['admin add stub'], 'product_0-install' => 'on', 'product_1-install' => 'on']);
 }
开发者ID:ryanrobertsname,项目名称:giftertipster.com,代码行数:45,代码来源:AdminProductControllerTest.php

示例12: testGetArgumentsReturnsArray

 public function testGetArgumentsReturnsArray()
 {
     Log::shouldReceive('info')->never();
     $command = L4shell::get();
     $command->setLogging(false)->setArguments(array("-a", "-l"));
     $this->assertInternalType('array', $command->getArguments());
 }
开发者ID:krunal200,项目名称:l4shell,代码行数:7,代码来源:CommandTest.php

示例13: testJobIncreaseValue

 public function testJobIncreaseValue()
 {
     $logErrorHandler = new LogErrorHandler();
     Log::shouldReceive('error')->with('Error Code: 0. Message: test message')->once();
     $logErrorHandler->handle(Errors::NOT_WORKING, 'test message');
 }
开发者ID:brucewu16899,项目名称:laravel-queue-checker,代码行数:6,代码来源:LogErrorHandlerTest.php

示例14: testFinderCreateLogsNoticeWhenSomeSubProductVariationsAttributesAreInvalid

 public function testFinderCreateLogsNoticeWhenSomeSubProductVariationsAttributesAreInvalid()
 {
     Factory::create('Giftertipster\\Entity\\Eloquent\\Idea', ['user_id' => 1, 'is_fulfilled' => 0]);
     $suite_attributes = ['vendor' => 'amazon', 'vendor_id' => 'b000000', 'binding' => 'testbinding', 'brand' => 'testbrand', 'manufacturer' => 'test manufacturer', 'model' => 'test model', 'group' => 'test group', 'type' => 'test type', 'size' => 'testsize', 'clothing_size' => 'test clothing size', 'color' => 'testcolor', 'title' => 'test title', 'department' => 'test department', 'min_price_amount' => 4000, 'min_price_currency' => 'USD', 'min_price_formatted' => '$40.00', 'max_price_amount' => 4000, 'max_price_currency' => 'USD', 'max_price_formatted' => '$40.00', 'reviews_url' => 'reviewsurl.com', 'detail_url' => 'detailurl.com'];
     $suite_attributes['images'] = [];
     $suite_attributes['features'] = [];
     $suite_attributes['descriptions'] = [];
     $suite_attributes['sub_products'][] = ['vendor' => 'amazon', 'vendor_id' => 'b000001', 'parent_vendor_id' => 'b000000', 'binding' => 'testbinding', 'brand' => 'testbrand', 'manufacturer' => 'test manufacturer', 'model' => 'test model', 'group' => 'test group', 'type' => 'test type', 'size' => 'testsize', 'clothing_size' => 'test clothing size', 'color' => 'testcolor', 'title' => 'test title', 'condition' => 'test condition', 'department' => 'test department', 'list_price_amount' => 4000, 'list_price_currency' => 'USD', 'list_price_formatted' => '$40.00', 'price_amount' => 4000, 'price_currency' => 'USD', 'price_formatted' => '$40.00', 'availability' => 'test avail', 'availability_type' => 'test avail type', 'availability_max_hours' => 'test avail max hours', 'availability_min_hours' => 'test avail min hours', 'availability_ship' => 'test avail ship', 'availability_ss_ship' => 1, 'offer_listing_id' => 'foo1', 'images' => [], 'descriptions' => [], 'features' => []];
     $suite_attributes['sub_products'][0]['variations'][] = ['type' => 'variationtype', 'value' => 'variation1'];
     $suite_attributes['sub_products'][0]['variations'][] = ['type' => '', 'value' => 'variation2'];
     $suite_attributes['keyword_profile']['profile'] = [];
     $suite_attributes['category_keywords'] = [];
     $expected_index_attributes = ['vendor' => 'amazon', 'vendor_id' => 'b000000', 'binding' => 'testbinding', 'brand' => 'testbrand', 'manufacturer' => 'test manufacturer', 'model' => 'test model', 'group' => 'test group', 'type' => 'test type', 'size' => 'testsize', 'clothing_size' => 'test clothing size', 'color' => 'testcolor', 'title' => 'test title', 'department' => 'test department', 'min_price_amount' => 4000, 'min_price_currency' => 'USD', 'min_price_formatted' => '$40.00', 'max_price_amount' => 4000, 'max_price_currency' => 'USD', 'max_price_formatted' => '$40.00', 'reviews_url' => 'reviewsurl.com', 'detail_url' => 'detailurl.com'];
     $expected_index_attributes['images'] = [];
     $expected_index_attributes['features'] = [];
     $expected_index_attributes['descriptions'] = [];
     $expected_index_attributes['sub_products'][] = ['vendor' => 'amazon', 'vendor_id' => 'b000001', 'parent_vendor_id' => 'b000000', 'binding' => 'testbinding', 'brand' => 'testbrand', 'manufacturer' => 'test manufacturer', 'model' => 'test model', 'group' => 'test group', 'type' => 'test type', 'size' => 'testsize', 'clothing_size' => 'test clothing size', 'color' => 'testcolor', 'title' => 'test title', 'condition' => 'test condition', 'department' => 'test department', 'list_price_amount' => 4000, 'list_price_currency' => 'USD', 'list_price_formatted' => '$40.00', 'price_amount' => 4000, 'price_currency' => 'USD', 'price_formatted' => '$40.00', 'availability' => 'test avail', 'availability_type' => 'test avail type', 'availability_max_hours' => 'test avail max hours', 'availability_min_hours' => 'test avail min hours', 'availability_ship' => 'test avail ship', 'availability_ss_ship' => 1, 'offer_listing_id' => 'foo1', 'images' => [], 'descriptions' => [], 'features' => []];
     $expected_index_attributes['sub_products'][0]['variations'][] = ['type' => 'variationtype', 'value' => 'variation1'];
     $expected_index_attributes['keyword_profile']['profile'] = [];
     $expected_index_attributes['category_keywords'] = [];
     \Log::shouldReceive('notice')->once();
     //mock ProductSuiteIndexer
     $expected_product_suite = $expected_index_attributes;
     $indexer = Mockery::mock('Giftertipster\\Service\\ProductSuite\\ProductSuiteIndexerInterface');
     $indexer->shouldReceive('queueIndex')->with(Mockery::on(function ($product_suite) use($expected_product_suite) {
         if (!empty($this->arrayRecursiveDiff($expected_product_suite, $product_suite))) {
             return false;
         }
         return true;
     }), false, false)->once()->andReturn(true);
     $this->app->instance('Giftertipster\\Service\\ProductSuite\\ProductSuiteIndexerInterface', $indexer);
     $repo = $this->app->make('Giftertipster\\Repository\\ProductSuite\\EloquentProductSuiteRepository');
     $response = $repo->finderCreate($suite_attributes, 'Idea', 1, 2);
     $errors = $repo->errors();
     assertThat($response, equalTo(true));
     $eloquent_product = $this->app->make('Giftertipster\\Entity\\Eloquent\\Product');
     $product = $eloquent_product->find(1);
     $eloquent_variation = $this->app->make('Giftertipster\\Entity\\Eloquent\\Variation');
     $sub_product_variation = $eloquent_variation->where('sub_product_id', '=', 1)->get()->toArray();
     assertThat($errors, nullValue());
     assertThat($product, notNullValue());
     assertThat($sub_product_variation, arrayWithSize(1));
 }
开发者ID:ryanrobertsname,项目名称:giftertipster.com,代码行数:43,代码来源:EloquentProductSuiteRepositoryCreateTest.php

示例15: testUpdateLogsNoticeOnSubProductUpdateFailureDueToSomeSubProductVariations

 public function testUpdateLogsNoticeOnSubProductUpdateFailureDueToSomeSubProductVariations()
 {
     $update_attributes = ['vendor' => 'amazon', 'vendor_id' => 'b000000', 'binding' => 'testbinding', 'brand' => 'testbrand', 'manufacturer' => 'test manufacturer', 'model' => 'test model', 'group' => 'test group', 'type' => 'test type', 'size' => 'testsize', 'clothing_size' => 'test clothing size', 'color' => 'testcolor', 'title' => 'updated test title', 'department' => 'test department', 'min_price_amount' => 4000, 'min_price_currency' => 'USD', 'min_price_formatted' => '$40.00', 'max_price_amount' => 4000, 'max_price_currency' => 'USD', 'max_price_formatted' => '$40.00', 'reviews_url' => 'reviewsurl.com', 'detail_url' => 'detailurl.com', 'images' => [['category' => 'image1', 'swatch_url' => 'testurl.com', 'swatch_height' => '100', 'swatch_width' => '200', 'small_url' => 'testurl.com', 'small_height' => '100', 'small_width' => '200', 'thumb_url' => 'testurl.com', 'thumb_height' => '100', 'thumb_width' => '200', 'tiny_url' => 'testurl.com', 'tiny_height' => '100', 'tiny_width' => '200', 'medium_url' => 'testurl.com', 'medium_height' => '100', 'medium_width' => '200', 'large_url' => 'testurl.com', 'large_height' => '100', 'large_width' => '200']], 'features' => [['description' => 'updated description']], 'descriptions' => [['type' => 'updated type', 'value' => 'updated value']], 'sub_products' => [['vendor' => 'amazon', 'vendor_id' => 'b000001', 'parent_vendor_id' => 'b000000', 'binding' => 'testbinding', 'brand' => 'testbrand', 'manufacturer' => 'test manufacturer', 'model' => 'test model', 'group' => 'test group', 'type' => 'test type', 'size' => 'testsize', 'clothing_size' => 'test clothing size', 'color' => 'testcolor', 'title' => 'updated sub product title', 'condition' => 'test condition', 'department' => 'test department', 'list_price_amount' => 4000, 'list_price_currency' => 'USD', 'list_price_formatted' => '$40.00', 'price_amount' => 4000, 'price_currency' => 'USD', 'price_formatted' => '$40.00', 'availability' => 'test avail', 'availability_type' => 'test avail type', 'availability_max_hours' => 'test avail max hours', 'availability_min_hours' => 'test avail min hours', 'availability_ship' => 'test avail ship', 'availability_ss_ship' => 1, 'offer_listing_id' => 'foo1', 'images' => [['category' => 'updated sub product image', 'swatch_url' => 'testurl.com', 'swatch_height' => '100', 'swatch_width' => '200', 'small_url' => 'testurl.com', 'small_height' => '100', 'small_width' => '200', 'thumb_url' => 'testurl.com', 'thumb_height' => '100', 'thumb_width' => '200', 'tiny_url' => 'testurl.com', 'tiny_height' => '100', 'tiny_width' => '200', 'medium_url' => 'testurl.com', 'medium_height' => '100', 'medium_width' => '200', 'large_url' => 'testurl.com', 'large_height' => '100', 'large_width' => '200']], 'features' => [['description' => 'updated sub product feature']], 'descriptions' => [['type' => 'updated sub product description type', 'value' => 'updated sub product description value']], 'variations' => [['type' => '', 'value' => 'updated sub product variation value'], ['type' => 'updated sub product variation type', 'value' => 'updated sub product variation value']]]]];
     $expected_index_attributes = ['vendor' => 'amazon', 'vendor_id' => 'b000000', 'binding' => 'testbinding', 'brand' => 'testbrand', 'manufacturer' => 'test manufacturer', 'model' => 'test model', 'group' => 'test group', 'type' => 'test type', 'size' => 'testsize', 'clothing_size' => 'test clothing size', 'color' => 'testcolor', 'title' => 'updated test title', 'department' => 'test department', 'min_price_amount' => 4000, 'min_price_currency' => 'USD', 'min_price_formatted' => '$40.00', 'max_price_amount' => 4000, 'max_price_currency' => 'USD', 'max_price_formatted' => '$40.00', 'reviews_url' => 'reviewsurl.com', 'detail_url' => 'detailurl.com', 'is_refreshed' => 1, 'images' => [['category' => 'image1', 'swatch_url' => 'testurl.com', 'swatch_height' => '100', 'swatch_width' => '200', 'small_url' => 'testurl.com', 'small_height' => '100', 'small_width' => '200', 'thumb_url' => 'testurl.com', 'thumb_height' => '100', 'thumb_width' => '200', 'tiny_url' => 'testurl.com', 'tiny_height' => '100', 'tiny_width' => '200', 'medium_url' => 'testurl.com', 'medium_height' => '100', 'medium_width' => '200', 'large_url' => 'testurl.com', 'large_height' => '100', 'large_width' => '200']], 'features' => [['description' => 'updated description']], 'descriptions' => [['type' => 'updated type', 'value' => 'updated value']], 'sub_products' => [['vendor' => 'amazon', 'vendor_id' => 'b000001', 'parent_vendor_id' => 'b000000', 'binding' => 'testbinding', 'brand' => 'testbrand', 'manufacturer' => 'test manufacturer', 'model' => 'test model', 'group' => 'test group', 'type' => 'test type', 'size' => 'testsize', 'clothing_size' => 'test clothing size', 'color' => 'testcolor', 'title' => 'updated sub product title', 'condition' => 'test condition', 'department' => 'test department', 'list_price_amount' => 4000, 'list_price_currency' => 'USD', 'list_price_formatted' => '$40.00', 'price_amount' => 4000, 'price_currency' => 'USD', 'price_formatted' => '$40.00', 'availability' => 'test avail', 'availability_type' => 'test avail type', 'availability_max_hours' => 'test avail max hours', 'availability_min_hours' => 'test avail min hours', 'availability_ship' => 'test avail ship', 'availability_ss_ship' => 1, 'offer_listing_id' => 'foo1', 'images' => [['category' => 'updated sub product image', 'swatch_url' => 'testurl.com', 'swatch_height' => '100', 'swatch_width' => '200', 'small_url' => 'testurl.com', 'small_height' => '100', 'small_width' => '200', 'thumb_url' => 'testurl.com', 'thumb_height' => '100', 'thumb_width' => '200', 'tiny_url' => 'testurl.com', 'tiny_height' => '100', 'tiny_width' => '200', 'medium_url' => 'testurl.com', 'medium_height' => '100', 'medium_width' => '200', 'large_url' => 'testurl.com', 'large_height' => '100', 'large_width' => '200']], 'features' => [['description' => 'updated sub product feature']], 'descriptions' => [['type' => 'updated sub product description type', 'value' => 'updated sub product description value']], 'variations' => [['type' => 'updated sub product variation type', 'value' => 'updated sub product variation value']]]], 'keyword_profile' => ['profile' => ['keyword1', 'keyword2']], 'category_keywords' => ['category', 'keywords']];
     $data_repo = $this->dataRepoSetup();
     \DB::shouldReceive('beginTransaction')->twice();
     \DB::shouldReceive('commit')->twice();
     \DB::shouldReceive('rollback')->never();
     $add_repo_mock = \Mockery::mock('Giftertipster\\Repository\\Add\\AddRepositoryInterface');
     $add_repo_mock->shouldReceive('getAdminAddCategoryKeywords')->once()->with(1)->andReturn(['category', 'keywords']);
     $this->app->instance('Giftertipster\\Repository\\Add\\AddRepositoryInterface', $add_repo_mock);
     \Log::shouldReceive('notice')->once();
     //mock ProductSuiteIndexer
     $expected_product_suite = $expected_index_attributes;
     $indexer = Mockery::mock('Giftertipster\\Service\\ProductSuite\\ProductSuiteIndexerInterface');
     $indexer->shouldReceive('queueIndex')->with(Mockery::on(function ($product_suite) use($expected_product_suite) {
         if (!empty($this->arrayRecursiveDiff($expected_product_suite, $product_suite))) {
             return false;
         }
         return true;
     }), false, false)->once()->andReturn(true);
     $this->app->instance('Giftertipster\\Service\\ProductSuite\\ProductSuiteIndexerInterface', $indexer);
     $repo = $this->app->make('Giftertipster\\Repository\\ProductSuite\\EloquentProductSuiteRepository');
     $response = $repo->update(1, $update_attributes);
     $this->getDataRepoData();
     assertThat($response, equalTo(true));
 }
开发者ID:ryanrobertsname,项目名称:giftertipster.com,代码行数:27,代码来源:EloquentProductSuiteRepositoryUpdateTest.php


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