本文整理汇总了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);
}