本文整理汇总了PHP中Illuminate\Support\Facades\Lang::shouldReceive方法的典型用法代码示例。如果您正苦于以下问题:PHP Lang::shouldReceive方法的具体用法?PHP Lang::shouldReceive怎么用?PHP Lang::shouldReceive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\Lang
的用法示例。
在下文中一共展示了Lang::shouldReceive方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testTranslateReturnsTranslation
public function testTranslateReturnsTranslation()
{
$button = $this->getButton();
$translation = 'Test button text';
Lang::shouldReceive('has')->with('boomcms::buttons.test')->andReturn(true);
Lang::shouldReceive('get')->with('boomcms::buttons.test')->andReturn($translation);
$this->assertEquals($translation, $button->translate('test'));
}
示例2: testGetPlaceholderTextReturnsDefaultForType
public function testGetPlaceholderTextReturnsDefaultForType()
{
Lang::shouldReceive('has')->once()->with('boomcms::chunks.text.test')->andReturn(false);
Lang::shouldReceive('get')->once()->with('boomcms::chunks.text.default')->andReturn('some text');
$chunk = $this->getMockBuilder(BaseChunk::class)->setMethods(['show', 'showDefault', 'hasContent', 'getType'])->setConstructorArgs([new Page(), [], 'test', true])->getMock();
$chunk->expects($this->any())->method('getType')->will($this->returnValue('text'));
$this->assertEquals('some text', $chunk->getPlaceholderText());
}
示例3: test_get_key_with_section
public function test_get_key_with_section()
{
$registrationKey = 'mypackage';
IlluminateLang::shouldReceive('get')->once()->with("{$registrationKey}::section.key")->andReturn('another key value');
$service = new Lang($registrationKey);
$config = $service->get('key', 'section');
$this->assertEquals('another key value', $config);
}
示例4: test_l_helper
public function test_l_helper()
{
Lang::shouldReceive('has')->once()->with('laravel.welcome')->andReturn(true);
Lang::shouldReceive('get')->once()->with('laravel.welcome', [])->andReturn("Welcome to Laravel");
$this->assertEquals('Welcome to Laravel', t('laravel.welcome', 'Welcome to Rails'));
Lang::shouldReceive('has')->once()->with('laravel.welcome')->andReturn(false);
$this->assertEquals('Welcome to Rails', t('laravel.welcome', 'Welcome to Rails'));
}
示例5: testAddInvalidQuantityWithAssemblyItem
public function testAddInvalidQuantityWithAssemblyItem()
{
$item = $this->newInventory();
$childItem = $this->newInventory(['name' => 'Child Item', 'metric_id' => $item->metric_id, 'category_id' => $item->category_id]);
Lang::shouldReceive('get')->once()->andReturn('Invalid Quantity');
$this->setExpectedException('Stevebauman\\Inventory\\Exceptions\\InvalidQuantityException');
$item->addAssemblyItem($childItem, 'invalid quantity');
}
示例6: testInventoryTransactionReleaseDefaultReason
public function testInventoryTransactionReleaseDefaultReason()
{
$transaction = $this->newTransaction();
Lang::shouldReceive('get')->twice()->andReturn('test');
$transaction->hold(5)->release(3);
$stock = $transaction->getStockRecord();
$this->assertEquals('test', $stock->reason);
}
示例7: testInventoryTransactionCancelledDefaultReason
public function testInventoryTransactionCancelledDefaultReason()
{
$transaction = $this->newTransaction();
$transaction->checkout(5);
$stock = $transaction->getStockRecord();
Lang::shouldReceive('get')->once()->andReturn('test');
$transaction->cancel();
$this->assertEquals('test', $stock->reason);
}
示例8: let
function let(AujaConfigurator $aujaConfigurator, AujaRouter $aujaRouter, Model $model)
{
$this->beConstructedWith($aujaConfigurator, $aujaRouter);
URL::shouldReceive('route');
Lang::shouldReceive('trans')->with('Add')->andReturn('Add');
Lang::shouldReceive('trans')->with('Model')->andReturn('Model');
$aujaConfigurator->getModel('Model')->willReturn($model);
$aujaConfigurator->isSearchable($model, null)->willReturn(false);
}
示例9: let
function let(AujaRouter $aujaRouter)
{
$this->aujaRouter = $aujaRouter;
$this->beConstructedWith($aujaRouter);
Url::shouldReceive('route');
Lang::shouldReceive('trans')->with('Add')->andReturn('Add');
Lang::shouldReceive('trans')->with('Username')->andReturn('Username');
Lang::shouldReceive('trans')->with('Association')->andReturn('Association');
Lang::shouldReceive('trans')->with('Associations')->andReturn('Associations');
Lang::shouldReceive('trans')->with('Password')->andReturn('Password');
}
示例10: let
function let(AujaRouter $aujaRouter, Relation $relation, Model $left, Model $right)
{
$this->beConstructedWith($aujaRouter);
$this->relation = $relation;
$relation->getLeft()->willReturn($left);
$relation->getRight()->willReturn($right);
$relation->getType()->willReturn('hasMany');
$left->getName()->willReturn('Model');
$right->getName()->willReturn('OtherModel');
URL::shouldReceive('route');
Lang::shouldReceive('trans')->with('Edit')->andReturn('Edit');
Lang::shouldReceive('trans')->with('Properties')->andReturn('Properties');
Lang::shouldReceive('trans')->with('OtherModel')->andReturn('OtherModel');
}
示例11: let
function let(AujaConfigurator $aujaConfigurator, AujaRouter $aujaRouter, Relation $relation, Model $left, Model $right)
{
$this->beConstructedWith($aujaConfigurator, $aujaRouter);
$this->relations = [$relation];
$relation->getLeft()->willReturn($left);
$relation->getRight()->willReturn($right);
$relation->getType()->willReturn('hasMany');
$left->getName()->willReturn('Model');
$right->getName()->willReturn('OtherModel');
$aujaConfigurator->getModel('Model')->willReturn($left);
$aujaConfigurator->getRelationsForModel($left)->willReturn([$relation]);
$aujaConfigurator->getDisplayField($left)->willReturn('name');
$aujaConfigurator->getIcon($left)->willReturn(null);
URL::shouldReceive('route');
Lang::shouldReceive('trans')->with('Add')->andReturn('Add');
Lang::shouldReceive('trans')->with('Model')->andReturn('Model');
}
示例12: let
function let(AujaConfigurator $aujaConfigurator, AujaRouter $aujaRouter, FormItemFactory $formItemFactory, TextFormItem $formItem, Model $model, Column $column1, Column $column2)
{
$this->beConstructedWith($aujaConfigurator, $aujaRouter, $formItemFactory);
$aujaConfigurator->getModel('MyModel')->willReturn($model);
$aujaConfigurator->getVisibleFields($model, null)->willReturn($this->visibleFields);
$formItemFactory->getFormItem($model, $column1, null)->willReturn($formItem);
$formItemFactory->getFormItem($model, $column2, null)->willReturn($formItem);
$model->getColumn('field1')->willReturn($column1);
$column1->getName()->willReturn('field1');
$column1->getType()->willReturn(Type::STRING);
$model->getColumn('field2')->willReturn($column2);
$column2->getName()->willReturn('field2');
$column2->getType()->willReturn(Type::STRING);
Lang::shouldReceive('trans')->with('field1')->andReturn('field1');
Lang::shouldReceive('trans')->with('field2')->andReturn('field2');
Lang::shouldReceive('trans')->with('Submit')->andReturn('Submit');
Lang::shouldReceive('trans')->with('Delete')->andReturn('Delete');
Lang::shouldReceive('trans')->with('Are you sure?')->andReturn('Are you sure?');
URL::shouldReceive('route');
}
示例13: delete_ModelException
/**
* @test
*/
public function delete_ModelException()
{
$this->setExpectedException(BaseModelException::class, 'Model could not be found.');
$mockService = m::mock(CrudServiceBase::class)->makePartial();
Lang::shouldReceive('get')->once()->andReturn('Model could not be found.');
$mockService->shouldReceive('read')->once()->andReturnNull();
$mockService->shouldReceive('throwException')->once()->andThrow(new BaseModelException(Lang::get('support.exceptions.model.read')));
$mockService->delete(1);
}
示例14: testGetTotalVariantStock
public function testGetTotalVariantStock()
{
$this->newCategory();
$this->newMetric();
$coke = Inventory::create(['name' => 'Coke', 'description' => 'Delicious Pop', 'metric_id' => 1, 'category_id' => 1]);
$cherryCoke = $coke->createVariant('Cherry Coke');
$cherryCoke->makeVariantOf($coke);
$vanillaCherryCoke = $cherryCoke->createVariant('Vanilla Cherry Coke');
$vanillaCherryCoke->makeVariantOf($cherryCoke);
DB::shouldReceive('beginTransaction')->once()->andReturn(true);
DB::shouldReceive('commit')->once()->andReturn(true);
Event::shouldReceive('fire')->once()->andReturn(true);
$location = $this->newLocation();
// Allow duplicate movements configuration option
Config::shouldReceive('get')->twice()->andReturn(true);
// Stock change reasons (one for create, one for put, for both items)
Lang::shouldReceive('get')->times(4)->andReturn('Default Reason');
$cherryCoke->createStockOnLocation(20, $location);
$vanillaCherryCoke->createStockOnLocation(20, $location);
$this->assertEquals(40, $coke->getTotalVariantStock());
}
示例15: testInventoryGetStockFromLocationInvalidLocation
public function testInventoryGetStockFromLocationInvalidLocation()
{
$this->newInventoryStock();
$item = Inventory::find(1);
Lang::shouldReceive('get')->once();
try {
$item->getStockFromLocation('testing');
$passes = false;
} catch (\Exception $e) {
$passes = true;
}
$this->assertTrue($passes);
}