当前位置: 首页>>代码示例>>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;未经允许,请勿转载。