當前位置: 首頁>>代碼示例>>PHP>>正文


PHP File::shouldReceive方法代碼示例

本文整理匯總了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')));
 }
開發者ID:gmonte,項目名稱:midig-cms,代碼行數:13,代碼來源:PublishAssetsCommandTest.php

示例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');
     });
 }
開發者ID:impleri,項目名稱:laravel-toolbox,代碼行數:45,代碼來源:ToolboxCommandsTest.php

示例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);
     });
 }
開發者ID:impleri,項目名稱:laravel-resource,代碼行數:29,代碼來源:GeneratorTest.php

示例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);
 }
開發者ID:iolson,項目名稱:support,代碼行數:9,代碼來源:CommandTraitTest.php

示例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();
 }
開發者ID:menthol,項目名稱:Flexible,代碼行數:31,代碼來源:PathsCommandTest.php

示例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);
 }
開發者ID:spescina,項目名稱:mediabrowser,代碼行數:7,代碼來源:FilesystemTest.php


注:本文中的Illuminate\Support\Facades\File::shouldReceive方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。