Skip to content

Added new endpoint, fix and added tests. #41

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

Conversation

SanaviaNicolas
Copy link
Contributor

WORKSPACES

  • Added new endpoint with its methods(See official bitbucket API documentation):
    • list();
    • all();
    • show();
  • Added tests
  • Added Workspaces/Repositories with its method: show()

PROJECTS

  • Added all() method
  • Fix create() and update() methods
  • Fix buildProjectPath() method, use workspaces

REPOSITORIES

  • Added workspaces() method
  • Added Repositories/Workspaces class with its methods:
    • createRepository();
    • showRepository();
    • buildRepositoriesPath();
  • Added all() method on Team/Repositories

TESTS

  • Added mockup API features in order to test all endpoints

@GrahamCampbell
Copy link
Member

This PR seems to still be based off of 2.1 and not 3.0.

@GrahamCampbell GrahamCampbell marked this pull request as draft June 29, 2020 16:49
@GrahamCampbell
Copy link
Member

I've added some examples to the README now, including how to use the paginator, which is why those all methods aren't needed: https://github.com/BitbucketAPI/Client/tree/6b8785635eeae87de7edd682968a0e305e5ab406#example-3.

@Giacomo92
Copy link
Contributor

@GrahamCampbell thank you for all the feedbacks. We will fix them soon. What do you think about test system? Can we add more test (like we have already did in this PR)?

@GrahamCampbell
Copy link
Member

The tests are great. In fact, I might take over the src changes, since there are quite a lot of other changes not covered by this PR that I'd like to make. After I'm finished, if you rebase this PR, we should be just left with the tests.

@GrahamCampbell
Copy link
Member

Ok, I've finished rigorously replacing teams/users stuff with workspaces: 2.1...3.0. I've also removed any deprecated endpoints. I just have left to go through the repositories endpoints to see if there's anything new they've added we don't yet support.

If you could rebase this PR, just providing the tests, that would be great. I'll then given them a review and we hopefully can merge this PR. :)

Giacomo Fabbian added 5 commits June 30, 2020 00:24
…rkspace

# Conflicts:
#	src/Api/Repositories.php
#	src/Api/Repositories/Workspaces.php
#	src/Api/Repositories/Workspaces/AbstractWorkspacesApi.php
#	src/Api/Teams/Repositories.php
#	src/Api/Workspaces.php
@GrahamCampbell
Copy link
Member

Thanks for the PR. I'll finish off here, and merge locally. :)

*
* @author Graham Campbell <graham@alt-three.com>
*/
class Repositories extends AbstractWorkspacesApi
Copy link
Member

Choose a reason for hiding this comment

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

Please delete this. There is no such API.

*
* @return array
*/
public function list(array $params = [])
Copy link
Member

Choose a reason for hiding this comment

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

Please delete this. This is already implemented on the "CurrentUser" API.

@@ -71,7 +71,7 @@ public function show(string $project, array $params = [])
*
* @return array
*/
public function update(string $project, array $params = [])
Copy link
Member

Choose a reason for hiding this comment

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

Please don't change this. We have params like this out of convention. If we want to review that, we'd want to do it for all cases, not just one, and not in this PR.

@@ -104,6 +104,6 @@ public function remove(string $project, array $params = [])
*/
protected function buildProjectsPath(string ...$parts)
{
return static::buildPath('workspaces', $this->username, 'projects', ...$parts);
Copy link
Member

Choose a reason for hiding this comment

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

This typo, and a few others are already fixed on 3.0.

use Http\Message\ResponseFactory;
use Psr\Http\Message\ResponseInterface;

class ProjectsAllResponse extends BaseResponse implements ResponseFactory
Copy link
Member

Choose a reason for hiding this comment

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

Wrong to implement this interface, when you then disregard the parameters.

GrahamCampbell added a commit that referenced this pull request Jun 30, 2020
Replaces #41.

Co-Authored-By: Giacomo Fabbian <info@giacomofabbian.it>
Co-Authored-By: SanaviaNicolas <sanavianicolas@users.noreply.github.com>
@Giacomo92
Copy link
Contributor

Hi @GrahamCampbell , I have just seen the new PR. Good job!
Do you need an hand in to increase code coverage?

@GrahamCampbell
Copy link
Member

I don't think getting 100% code coverage with that style of test is really going to add much value. It was certainly good to have a small number of those tests though, like you added, so thanks for that.

Those sorts of tests don't catch mistakes URLs generated by the code, which is the most common error, I think.

@Giacomo92
Copy link
Contributor

Can you give me an example of "mistakes URLs generated by the code"?

@GrahamCampbell
Copy link
Member

#15

@GrahamCampbell
Copy link
Member

GrahamCampbell commented Jun 30, 2020

The only way to catch those sorts of errors, is to actually hit the API, like in https://github.com/BitbucketAPI/Client/blob/46bf30101114dae032ed381642e91c2ba1e1a51a/tests/ClientTest.php#L35-L47. But, obviously our tests are going to be quite slow if we do this for all the endpoints. Anyway, I don't think we should. I think we have enough coverage from people using the code and letting us know.

One place where I think we could have better test coverage is the http plugins, however.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants