Skip to content

Added missing api methods for the integrations installation api #527

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 21, 2017

Conversation

acrobat
Copy link
Collaborator

@acrobat acrobat commented Feb 13, 2017

Missing methds for the integrations installation api. See https://developer.github.com/v3/integrations/installations/#installations

And added the findInstallations api method. Closes #516

Copy link
Collaborator

@Nyholm Nyholm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. Really good PR. I like that you added tests and docs.

I just had some minor comments. Also, you should add a link in the Integration class header to https://developer.github.com/v3/integrations/installations/


/**
* Find all installations for the authenticated integration.
*
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add @link https://developer.github.com/v3/integrations/#find-installations

*
* @return array
*/
public function listRepositories($userId)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$userId should be optional, right?

Copy link
Collaborator Author

@acrobat acrobat Feb 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No if you call the api without the userId you just get a 403 error irc. The repositories are also always checked for the current installation and the repo's the user has access to. I guess github will change this api route in the future so the userId is part of the uri.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okey. Good. I guess I misunderstood the docs.


/**
* List repositories that are accessible to the authenticated installation.
*
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


/**
* Add a single repository to an installation.
*
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


/**
* Remove a single repository from an installation.
*
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

->method('get')
->with('/integration/installations');

$api->findInstallations();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

->method('get')
->with('/installation/repositories');

$api->listRepositories('1234');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test that the parameter is used. Also make a second test where you not using any $userId

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$userIdis required so this test should do. But can you give me some example or info on how to test the parameters content? I've thought about this test but I couldn't find on how to retrieve the passed parameters and check if $params['user_id'] was equal to the passed value

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try something like:

$api->expects($this->once())
->method('get')
->with('/installation/repositories', ['user_id'=>'1234']);

@acrobat acrobat force-pushed the integration-installation-api branch from 1e8d95a to 4e5449b Compare February 14, 2017 12:09
@acrobat
Copy link
Collaborator Author

acrobat commented Feb 14, 2017

I've added the links to the docblocks. I will extend the tests tonight!

@acrobat acrobat force-pushed the integration-installation-api branch from 4e5449b to 6f89e35 Compare February 14, 2017 18:37
@acrobat
Copy link
Collaborator Author

acrobat commented Feb 14, 2017

@Nyholm I've extended the tests and other comments should be fixed!

@acrobat
Copy link
Collaborator Author

acrobat commented Feb 21, 2017

@Nyholm any more work needed here?

@Nyholm
Copy link
Collaborator

Nyholm commented Feb 21, 2017

Sorry for the delay. I will review this PR shortly

Copy link
Collaborator

@Nyholm Nyholm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent. Thank you

@Nyholm Nyholm merged commit 6a78d56 into KnpLabs:master Feb 21, 2017
@acrobat
Copy link
Collaborator Author

acrobat commented Feb 21, 2017

Thanks a lot @Nyholm!

@acrobat acrobat deleted the integration-installation-api branch February 21, 2017 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants