本文整理匯總了PHP中Illuminate\Support\Facades\File::shouldReceive方法的典型用法代碼示例。如果您正苦於以下問題:PHP File::shouldReceive方法的具體用法?PHP File::shouldReceive怎麽用?PHP File::shouldReceive使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Illuminate\Support\Facades\File
的用法示例。
在下文中一共展示了File::shouldReceive方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testAssetPublishing
public function testAssetPublishing()
{
Stylist::registerPaths(Stylist::discover(__DIR__ . '/../Stubs/Themes'));
$artisan = $this->app->make('Illuminate\\Contracts\\Console\\Kernel');
File::shouldReceive('exists')->andReturn(true)->times(8);
File::shouldReceive('get')->times(6);
File::shouldReceive('copyDirectory')->times(3);
// Action
$artisan->call('stylist:publish');
// Assert
// $this->assertTrue($this->app['files']->exists(public_path('themes/child-theme')));
// $this->assertFalse($this->app['files']->exists(public_path('themes/parent-theme')));
}
示例2: testCommands
/**
* Do the Artisan commands fire?
*/
public function testCommands()
{
$self = $this;
$this->prepareSpecify();
$this->specify('Build executes', function () use($self) {
$command = $self->getCommand('BuildCommand');
Event::shouldReceive('fire')->once()->with('toolbox.build', [$command]);
$self->runCommand($command);
});
$this->prepareSpecify();
$this->specify('Controllers executes', function () use($self) {
$self->runEvent('toolbox.controllers', 'ControllersCommand');
});
$this->prepareSpecify();
$this->specify('Models executes', function () use($self) {
$self->runEvent('toolbox.models', 'ModelsCommand');
});
$this->prepareSpecify();
$this->specify('Routes executes with existing files', function () use($self) {
File::shouldReceive('exists')->with(Mockery::anyOf('app/routes.php', 'app/routes.bak.php'))->andReturn(true);
File::shouldReceive('delete')->with('app/routes.bak.php');
File::shouldReceive('move')->with('app/routes.php', 'app/routes.bak.php');
File::shouldReceive('put')->with('app/routes.php', Mockery::type('string'));
$command = $self->getCommand('RoutesCommand');
Event::shouldReceive('fire')->once()->with('toolbox.routes')->andReturn([]);
$self->runCommand($command);
});
$this->prepareSpecify();
$this->specify('Routes executes without existing files', function () use($self) {
File::shouldReceive('exists')->with(Mockery::anyOf('app/routes.php', 'app/routes.bak.php'))->andReturn(false);
File::shouldReceive('put')->with('app/routes.php', Mockery::type('string'));
$self->runEvent('toolbox.routes', 'RoutesCommand');
});
$this->prepareSpecify();
$this->specify('BuildCommand executes', function () use($self) {
$self->runEvent('toolbox.schema', 'SchemaCommand');
});
$this->prepareSpecify();
$this->specify('BuildCommand executes', function () use($self) {
$self->runEvent('toolbox.views', 'ViewsCommand');
});
}
示例3: testExecuteMethod
/**
* Specs for Generator::execute()
*/
public function testExecuteMethod()
{
$class = $this->prepareSpecify();
$this->specify('renders if one class name is passed.', function () use($class) {
View::shouldReceive('make->render')->once()->andReturn('test output');
File::shouldReceive('exists')->twice()->with('/\\.php$/')->andReturn(false);
File::shouldReceive('put')->once()->with('/\\.php$/', 'test output')->andReturn(true);
$params = ['classes' => ['test' => []]];
expect($class->execute($params))->greaterThan(0);
});
$this->specify('does not count failed views.', function () use($class) {
View::shouldReceive('make->render')->once()->andReturn('test output');
File::shouldReceive('exists')->twice()->with('/\\.php$/')->andReturn(false);
File::shouldReceive('put')->once()->with('/\\.php$/', 'test output')->andReturn(false);
$params = ['classes' => ['test' => []]];
expect($class->execute($params))->equals(0);
});
$this->specify('keeps overridden view.', function () use($class) {
View::shouldReceive('make')->once()->with('test::view', Mockery::type('array'));
View::shouldReceive('make->render')->once()->andReturn('test output');
File::shouldReceive('exists')->twice()->with('/\\.php$/')->andReturn(false);
File::shouldReceive('put')->once()->with('/\\.php$/', 'test output')->andReturn(true);
$params = ['classes' => ['test' => []]];
expect($class->execute($params))->greaterThan(0);
});
}
示例4: testWriteFile_Directory
public function testWriteFile_Directory()
{
$content = 'Hello';
$directory = 'testing';
$fileName = 'Test';
File::shouldReceive('put')->once()->andReturn(true);
$this->commandStub->setPath('/');
$this->commandStub->writeFile($content, $directory, $fileName);
}
示例5: it_should_fire_with_config_not_confirmed
/**
* @test
*/
public function it_should_fire_with_config_not_confirmed()
{
/**
* Set
*
* @var \Mockery\Mock $command
*/
$command = m::mock('Menthol\\Flexible\\Commands\\PathsCommand')->makePartial();
$command->shouldAllowMockingProtectedMethods();
File::clearResolvedInstance('files');
File::shouldReceive('exists')->once()->andReturn(false);
App::shouldReceive('make')->andReturn(true);
/**
* Expectation
*/
$command->shouldReceive('getLaravel')->once()->andReturn(true);
$command->shouldReceive('argument')->with('model')->once()->andReturn(['Husband']);
$command->shouldReceive('option')->with('dir')->once()->andReturn([__DIR__ . '/../../../Support/Stubs']);
$command->shouldReceive('option')->with('write-config')->once()->andReturn(true);
$command->shouldReceive('confirm')->once()->andReturn(false);
$command->shouldReceive('compilePaths', 'error', 'call', 'info')->andReturn(true);
/*
|------------------------------------------------------------
| Assertion
|------------------------------------------------------------
*/
$command->fire();
}
示例6: test_validate_folder_path
public function test_validate_folder_path()
{
File::shouldReceive('exists')->once()->with('vfs://root/folder')->andReturn(true);
File::shouldReceive('isDirectory')->once()->with('vfs://root/folder')->andReturn(true);
$check = $this->fs->validatePath('folder');
$this->assertTrue($check);
}