本文整理汇总了PHP中Queue::shouldReceive方法的典型用法代码示例。如果您正苦于以下问题:PHP Queue::shouldReceive方法的具体用法?PHP Queue::shouldReceive怎么用?PHP Queue::shouldReceive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Queue
的用法示例。
在下文中一共展示了Queue::shouldReceive方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testErrorHandlingWhenCommandValueBiggerAsJobValue
public function testErrorHandlingWhenCommandValueBiggerAsJobValue()
{
$errorHandlerMock = m::mock('Schickling\\QueueChecker\\ErrorHandlers\\ErrorHandlerInterface');
$errorHandlerMock->shouldReceive('handle');
$this->app->instance('Schickling\\QueueChecker\\ErrorHandlers\\ErrorHandlerInterface', $errorHandlerMock);
Cache::put('queue-checker-command-value', 3, 0);
Cache::put('queue-checker-job-value', 2, 0);
Queue::shouldReceive('connected')->once()->andReturn(true);
$this->tester->execute(array());
}
示例2: testOnCartAddedWhenInServiceEnvironment
public function testOnCartAddedWhenInServiceEnvironment()
{
//mocks
$add_profile_mgr_mock = \Mockery::mock('Giftertipster\\Service\\Add\\AddProfileMgrInterface');
$add_profile_mgr_mock->shouldReceive('getUserAddProfile')->never();
$this->app->instance('Giftertipster\\Service\\Add\\AddProfileMgrInterface', $add_profile_mgr_mock);
$add_profile_mgr = \App::make('Giftertipster\\Service\\Add\\AddProfileMgrInterface');
$sales_agent_mgr = \App::make('Giftertipster\\Service\\SalesAgent\\SalesAgentMgrInterface');
\App::shouldReceive('environment')->atLeast('once')->andReturn('service');
\App::shouldReceive('make')->with('Giftertipster\\Service\\Add\\AddProfileMgrInterface')->andReturn($add_profile_mgr);
\App::shouldReceive('make')->with('Giftertipster\\Service\\SalesAgent\\SalesAgentMgrInterface')->andReturn($sales_agent_mgr);
\Queue::shouldReceive('push')->never();
\Session::shouldReceive('get')->never();
\Session::shouldReceive('put')->never();
//action
$this->getEventSub()->onCartAdded(1);
}
开发者ID:ryanrobertsname,项目名称:giftertipster.com,代码行数:17,代码来源:ProductUserInteractionEventSubscriberTest.php
示例3: testQueueIndexReturnsTrueWhenHighPriorityQueueIsRequested
public function testQueueIndexReturnsTrueWhenHighPriorityQueueIsRequested()
{
$product_attributes = ['id' => 100, 'user_id' => 1, 'title' => 'foobartitle', 'binding' => 'foobar binding', 'brand' => 'foobar brand', 'manufacturer' => 'foobar manufacturer', 'model' => 'foobar model', 'group' => 'foobar group', 'size' => 'foobar size', 'clothing_size' => 'foobar clothing_size', 'min_price_amount' => 10, 'max_price_amount' => 20];
$product_model = Factory::create('Giftertipster\\Entity\\Eloquent\\Product', $product_attributes);
$suite_attributes = ['id' => 100, 'user_id' => $product_model->user_id, 'is_refreshed' => 1, 'title' => $product_model->title, 'binding' => $product_model->binding, 'brand' => $product_model->brand, 'manufacturer' => $product_model->manufacturer, 'model' => $product_model->model, 'group' => $product_model->group, 'size' => $product_model->size, 'clothing_size' => $product_model->clothing_size, 'min_price' => $product_model->min_price_amount, 'max_price' => $product_model->max_price_amount, 'features' => [['description' => 'foobar feature 1'], ['description' => 'foobar feature 2']], 'descriptions' => [['value' => 'foobar description 1'], ['value' => 'foobar description 2']], 'sub_products' => [['id' => 'fake sub product', 'features' => [['description' => 'sub product foobar feature 1'], ['description' => 'sub product foobar feature 2']], 'descriptions' => [['value' => 'sub product foobar description 1'], ['value' => 'sub product foobar description 2']]], ['id' => 'fake sub product2', 'features' => [['description' => 'sub product foobar feature 3'], ['description' => 'sub product foobar feature 4']], 'descriptions' => [['value' => 'sub product foobar description 3'], ['value' => 'sub product foobar description 4']]]], 'keyword_profile' => ['profile' => ['keyword1', 'keyword2']], 'category_keywords' => ['category', 'keywords']];
$expected_params_for_product_index_repo = ['fields' => ['_id' => 100, 'user_id' => 1, 'datetime' => $product_model->updated_at->toDateTimeString(), 'title' => $product_model->title, 'descriptions' => ['foobar description 1', 'foobar description 2', 'sub product foobar description 1', 'sub product foobar description 2', 'sub product foobar description 3', 'sub product foobar description 4'], 'features' => ['foobar feature 1', 'foobar feature 2', 'sub product foobar feature 1', 'sub product foobar feature 2', 'sub product foobar feature 3', 'sub product foobar feature 4'], 'binding' => $product_model->binding, 'brand' => $product_model->brand, 'manufacturer' => $product_model->manufacturer, 'model' => $product_model->model, 'group' => $product_model->group, 'size' => $product_model->size, 'clothing_size' => $product_model->clothing_size, 'min_price' => $product_model->min_price_amount, 'max_price' => $product_model->max_price_amount, 'keyword_profile' => ['keyword1', 'keyword2'], 'category_keywords' => ['category', 'keywords'], 'soft_delete_status' => false]];
\Queue::shouldReceive('push')->with('Giftertipster\\Service\\JobHandler\\IndexProduct\\IndexProductInterface', $expected_params_for_product_index_repo, 'high')->once()->andReturn(true);
$indexer_service = $this->app->make('Giftertipster\\Service\\ProductSuite\\ProductSuiteIndexer');
$product_suite = $suite_attributes;
$product_suite = array_merge($product_model->toArray(), $product_suite);
$response = $indexer_service->queueIndex($product_suite, true);
}
示例4: testUpdateAdminAdd
public function testUpdateAdminAdd()
{
$this->makeRelatedModels();
$add_attributes = ['add_type_id' => 1, 'product_id' => 1, 'occasion_ids' => [1], 'relation_ids' => [1], 'gender_ids' => [1], 'age_ids' => [1], 'interest_ids' => [1], 'sub_interest_ids' => [1]];
$response = $this->add_repo->create($add_attributes);
assertThat($response, equalTo(true));
$add_attributes = ['add_type_id' => 1, 'product_id' => 2, 'occasion_ids' => [1], 'relation_ids' => [1], 'gender_ids' => [1], 'age_ids' => [1], 'interest_ids' => [1], 'sub_interest_ids' => [1]];
$response = $this->add_repo->create($add_attributes);
assertThat($response, equalTo(true));
//mocks
\Queue::shouldReceive('push')->with('Giftertipster\\Service\\JobHandler\\IndexAdd\\IndexAddInterface', ['fields' => ['formatted_add_stub']], 'low');
$formatter_mock = \Mockery::mock('Giftertipster\\Service\\Add\\AddModelToIndexFormatterInterface');
$formatter_mock->shouldReceive('formatt')->with(Mockery::on(function ($add_model) {
if ($add_model['add_type_id'] == 2 && $add_model['occasion_categories'][0]['id'] == 2) {
return true;
}
return false;
}))->andReturn(['formatted_add_stub']);
$this->app->instance('Giftertipster\\Service\\Add\\AddModelToIndexFormatterInterface', $formatter_mock);
//make update
$add_attributes = ['add_type_id' => 2, 'occasion_ids' => [2], 'relation_ids' => [2], 'gender_ids' => [2], 'age_ids' => [2], 'interest_ids' => [2], 'sub_interest_ids' => [2]];
$this->add_repo = $this->app->make('Giftertipster\\Repository\\Add\\EloquentAddRepository');
$response = $this->add_repo->updateAdminAdd(2, $add_attributes);
$add = $this->eloquent_add->with($this->relations)->find(2)->toArray();
assertThat($add['add_type_id'], equalTo(2));
assertThat($add['product_id'], equalTo(2));
assertThat($add['occasion_categories'][0], hasKeyValuePair('id', 2));
assertThat($add['relation_categories'][0], hasKeyValuePair('id', 2));
assertThat($add['gender_categories'][0], hasKeyValuePair('id', 2));
assertThat($add['age_categories'][0], hasKeyValuePair('id', 2));
assertThat($add['interest_categories'][0], hasKeyValuePair('id', 2));
assertThat($add['sub_interest_categories'][0], hasKeyValuePair('id', 2));
}