public function it_will_create_remote_repo_value_object(PullRequestPayload $pullRequestPayload) { $data = ['id' => 'githubId', 'name' => 'name', 'full_name' => 'owner/name', 'owner' => ['login' => 'owner'], 'html_url' => 'https://github.com/owner/name', 'description' => 'Description', 'fork' => false, 'default_branch' => 'master', 'private' => false, 'git_url' => 'git://github.com/owner/name.git', 'ssh_url' => 'git@github.com:owner/name.git', 'created_at' => '2015-10-17T15:53:45Z', 'updated_at' => '2015-10-17T15:53:45Z', 'pushed_at' => '2015-10-17T15:53:45Z']; $pullRequestPayload->getRepositoryDetails()->willReturn($data); $this->create($pullRequestPayload)->shouldReturnAnInstanceOf('DevBoard\\GithubRemote\\ValueObject\\Repo\\Repo'); }
/** * @param PullRequestPayload $pullRequestPayload * * @return Repo */ public function create(PullRequestPayload $pullRequestPayload) { $data = $pullRequestPayload->getRepositoryDetails(); return new Repo($data['id'], $data['owner']['login'], $data['name'], $data['full_name'], $data['html_url'], $data['description'], $data['fork'], $data['default_branch'], $data['private'], $data['git_url'], $data['ssh_url'], new DateTime($data['created_at']), new DateTime($data['updated_at']), new DateTime($data['pushed_at'])); }