本文整理汇总了PHP中Illuminate\Contracts\Foundation\Application::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::expects方法的具体用法?PHP Application::expects怎么用?PHP Application::expects使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Contracts\Foundation\Application
的用法示例。
在下文中一共展示了Application::expects方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetSetApplicationAndEnv
public function testGetSetApplicationAndEnv()
{
$this->assertSame($this->appMock, $this->testInstance->getApplication());
$this->appMock->expects($this->once())->method('make')->with('view')->will($this->returnValue($this->viewMock));
$this->assertSame($this->viewMock, $this->testInstance->getEnvironment());
$this->testInstance->setEnvironment($this->viewMock);
$this->assertSame($this->viewMock, $this->testInstance->getEnvironment());
}
示例2: testRegister
public function testRegister()
{
$this->appMock->expects($this->any())->method('singleton')->will($this->returnCallback(function ($bindTo, $bound) {
switch ($bindTo) {
case UtilsServiceProvider::PROVIDES_META_MANAGER:
$this->assertTrue($bound() instanceof MetaManager);
break;
}
}));
$this->testInstance->registering();
}
示例3: testLaunching
public function testLaunching()
{
$this->bladedManagerMock->expects($this->exactly(3))->method('registerCommandNamespace');
$this->appMock->expects($this->any())->method('make')->will($this->returnCallback(function ($resolvable) {
switch ($resolvable) {
case BladedServiceProvider::PROVIDES_SERVICE:
return $this->bladedManagerMock;
}
}));
$this->testInstance->launching();
}
示例4: testExtend
public function testExtend()
{
$commandMock = $this->getMockForAbstractClass(ABladedCommand::class, [$this->appMock]);
$testName = uniqid();
$methodName = uniqid('method');
$extendCallback = function () {
};
$this->appMock->expects($this->any())->method('bound')->will($this->returnValue(true));
$this->appMock->expects($this->any())->method('make')->will($this->returnValue($commandMock));
$this->testInstance->extendCommand($testName, $methodName, $extendCallback, false);
}
示例5: testRegister
public function testRegister()
{
$this->applicationMock->expects($this->any())->method('make')->will($this->returnCallback(function ($toMake) {
switch ($toMake) {
case 'request':
return $this->requestMock;
}
}));
$this->applicationMock->expects($this->atLeastOnce())->method('resolving')->with($this->callback(function ($callable) {
$callable(new ViewModel());
$callable(new RequestBag());
$callable(new FileViewModel());
return $callable instanceof \Closure;
}));
$this->requestMock->expects($this->atLeastOnce())->method('only')->will($this->returnValue([]));
$this->requestMock->expects($this->atLeastOnce())->method('all')->will($this->returnValue([]));
$this->testInstance->registering();
}
示例6: 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);
}
示例7: testRegistration
public function testRegistration()
{
$test = ['command' => '\\stdClass', 'command1' => '\\stdClass'];
$this->appMock->expects($this->any())->method('singleton')->will($this->returnCallback(function ($command, $callback) use($test) {
$commandName = str_replace($this->testInstance->getIoCRegistry() . ".", '', $command);
$this->assertArrayHasKey($commandName, $test);
$this->assertTrue($callback($this->appMock) instanceof $test[$commandName]);
}));
$this->testInstance->registerNamespaces($test);
$this->appMock->expects($this->any())->method('make')->will($this->returnValue($this));
$this->assertSame($this, $this->testInstance->getNamespace('command'));
try {
$this->testInstance->getNamespace($command = uniqid('not_existent'));
} catch (\Exception $e) {
$this->assertTrue($e instanceof \UnexpectedValueException);
$this->assertSame("Unknown blade command namespace - {$command}.", $e->getMessage());
}
}