本文整理匯總了PHP中Illuminate\Translation\Translator::expects方法的典型用法代碼示例。如果您正苦於以下問題:PHP Translator::expects方法的具體用法?PHP Translator::expects怎麽用?PHP Translator::expects使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Illuminate\Translation\Translator
的用法示例。
在下文中一共展示了Translator::expects方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testLookUp
public function testLookUp()
{
$this->appMock->expects($this->any())->method('make')->will($this->returnCallback(function ($make) {
switch ($make) {
case 'translator':
return $this->tranlator;
default:
var_dump($make);
die('testLookUp');
}
}));
$this->tranlator->expects($this->any())->method('trans')->will($this->returnCallback(function ($trans) {
switch ($trans) {
case 'validation.attributes.login':
return 'Login';
case 'validation.attributes.not_existent':
return $trans;
}
}));
$this->assertSame('Login', $this->testInstance->login);
$this->assertSame('not_existent', $this->testInstance->not_existent);
}
示例2: testLang
public function testLang()
{
$this->translatorMock->expects($this->once())->method('trans')->with('someValue');
$this->getApplicationMock()->expects($this->once())->method('make')->will($this->returnValue($this->translatorMock));
$this->testInstance->l('someValue');
}