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


PHP factory::build方法代碼示例

本文整理匯總了PHP中factory::build方法的典型用法代碼示例。如果您正苦於以下問題:PHP factory::build方法的具體用法?PHP factory::build怎麽用?PHP factory::build使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在factory的用法示例。


在下文中一共展示了factory::build方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: test_Should_WorkAndSendNotification_When_DeployerIsNormalEndAndEmailNotificationRecipientIsSet

 public function test_Should_WorkAndSendNotification_When_DeployerIsNormalEndAndEmailNotificationRecipientIsSet()
 {
     $deployment = Factory::build('App\\Models\\Deployment', ['id' => 1, 'project_id' => 1, 'number' => 1, 'task' => 'deploy', 'user_id' => 1, 'created_at' => new \Carbon\Carbon(), 'updated_at' => new \Carbon\Carbon(), 'user' => new \App\Models\User()]);
     $updatedDeployment = Factory::build('App\\Models\\Deployment', ['id' => 1, 'project_id' => 1, 'number' => 1, 'task' => 'deploy', 'user_id' => 1, 'created_at' => new \Carbon\Carbon(), 'updated_at' => new \Carbon\Carbon(), 'user' => new \App\Models\User(), 'status' => 0]);
     $recipe = factory::build('app\\models\\recipe', ['id' => 1, 'name' => 'recipe 1', 'desctiption' => '', 'body' => '']);
     $project = $this->mockProjectModel->shouldReceive('updateDeployment')->once()->shouldReceive('getDeploymentByNumber')->once()->andReturn($updatedDeployment)->mock();
     $project = $this->mockProjectModel->shouldReceive('getRecipes')->once()->andReturn([$recipe])->mock();
     $project->email_notification_recipient = 'webloyer@example.com';
     $this->mockProjectRepository->shouldReceive('byId')->once()->andReturn($project);
     $this->mockServerRepository->shouldReceive('byId')->once()->andReturn($this->mockServerModel);
     $mockDeployerFile = $this->mock('App\\Services\\Deployment\\DeployerFile')->shouldReceive('getFullPath')->once()->mock();
     $this->mockDeployerFileDirector->shouldReceive('construct')->andReturn($mockDeployerFile)->times(3);
     $this->mockProcess->shouldReceive('run')->once();
     $this->mockProcess->shouldReceive('isSuccessful')->twice()->andReturn(true);
     $this->mockProcess->shouldReceive('getOutput')->once();
     $this->mockProcess->shouldReceive('getExitCode')->once();
     $this->mockProcessBuilder->shouldReceive('add')->times(7)->andReturn($this->mockProcessBuilder);
     $this->mockProcessBuilder->shouldReceive('getProcess')->once()->andReturn($this->mockProcess);
     $this->mockNotifier->shouldReceive('to')->once()->andReturn($this->mockNotifier);
     $this->mockNotifier->shouldReceive('notify')->once();
     $this->mockMailSettingEntity->shouldReceive('getDriver')->once()->shouldReceive('getFrom')->twice()->shouldReceive('getSmtpHost')->once()->shouldReceive('getSmtpPort')->once()->shouldReceive('getSmtpEncryption')->once()->shouldReceive('getSmtpUsername')->once()->shouldReceive('getSmtpPassword')->once()->shouldReceive('getSendmailPath')->once();
     $this->mockSettingModel->shouldReceive('getAttribute')->with('attributes')->andReturn($this->mockMailSettingEntity);
     $this->mockSettingRepositroy->shouldReceive('byType')->once()->andReturn($this->mockSettingModel);
     $this->mockServerListFileBuilder->shouldReceive('setServer')->once()->andReturn($this->mockServerListFileBuilder);
     $this->mockServerListFileBuilder->shouldReceive('setProject')->once()->andReturn($this->mockServerListFileBuilder);
     $this->mockRecipeFileBuilder->shouldReceive('setRecipe')->once();
     $this->mockDeploymentFileBuilder->shouldReceive('setProject')->once()->andReturn($this->mockDeploymentFileBuilder);
     $this->mockDeploymentFileBuilder->shouldReceive('setServerListFile')->once()->andReturn($this->mockDeploymentFileBuilder);
     $this->mockDeploymentFileBuilder->shouldReceive('setRecipeFile')->once()->andReturn($this->mockDeploymentFileBuilder);
     $job = new Rollback($deployment);
     $job->handle($this->mockProjectRepository, $this->mockServerRepository, $this->mockProcessBuilder, $this->mockNotifier, $this->mockSettingRepositroy);
 }
開發者ID:ngmy,項目名稱:webloyer,代碼行數:32,代碼來源:RollbackTest.php


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