Skip to content

Move Body, HttpError exceptions, BatchRequest, HttpMethods to utility #59

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 10 commits into from
Oct 21, 2015
Merged
22 changes: 22 additions & 0 deletions CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Contributor Code of Conduct

As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.

We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality.

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery
* Personal attacks
* Trolling or insulting/derogatory comments
* Public or private harassment
* Publishing other's private information, such as physical or electronic addresses, without explicit permission
* Other unethical or unprofessional conduct.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team.

This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community.

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.

This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/)
28 changes: 22 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ please be as precise as possible. Here is a little list of required information:

## Security issues

If you discover any security related issues, please contact us at [security@php-http.org](mailto:security@php-http.org) instead of submitting an issue on Github. This allows us to fix the issue and release a security hotfix without publicly disclosing the vulnerability.
If you discover any security related issues, please contact us at [security@php-http.org](mailto:security@php-http.org)
instead of submitting an issue on Github.
This allows us to fix the issue and release a security hotfix without publicly disclosing the vulnerability.


## Feature requests
Expand All @@ -28,7 +30,8 @@ easily understood/implement it.

## Sending a Pull Request

If you're here, you are going to fix a bug or implement a feature and you're the best! To do it, first fork the repository, clone it and create a new branch with the following commands:
If you're here, you are going to fix a bug or implement a feature and you're the best!
To do it, first fork the repository, clone it and create a new branch with the following commands:

``` bash
$ git clone git@github.com:your-name/repo-name.git
Expand All @@ -41,7 +44,8 @@ Then install the dependencies through [Composer](https://getcomposer.org/):
$ composer install
```

Write code and tests. When you are ready, run the tests. (This is usually [PHPUnit](http://phpunit.de/) or [PHPSpec](http://phpspec.net/))
Write code and tests. When you are ready, run the tests.
(This is usually [PHPUnit](http://phpunit.de/) or [PHPSpec](http://phpspec.net/))

``` bash
$ composer test
Expand All @@ -54,11 +58,15 @@ $ git commit -m "Feature or bug fix description"
$ git push origin feature-or-bug-fix-description
```

**Note:** Please write your commit messages in the imperative and follow the [guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) for clear and concise messages.
**Note:** Please write your commit messages in the imperative and follow the
[guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) for clear and concise messages.

Then [create a pull request](https://help.github.com/articles/creating-a-pull-request/) on GitHub.

Please make sure that each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please squash them before submitting with the following commands (here, we assume you would like to squash 3 commits in a single one):
Please make sure that each individual commit in your pull request is meaningful.
If you had to make multiple intermediate commits while developing,
please squash them before submitting with the following commands
(here, we assume you would like to squash 3 commits in a single one):

``` bash
$ git rebase -i HEAD~3
Expand All @@ -81,4 +89,12 @@ you must follow these rules.

## Semver

We are trying to follow [semver](http://semver.org/). When you are making BC breaking changes, please let us know why you think it is important. In this case, your patch can only be included in the next major version.
We are trying to follow [semver](http://semver.org/). When you are making BC breaking changes,
please let us know why you think it is important.
In this case, your patch can only be included in the next major version.


## Code of Conduct

This project is released with a [Contributor Code of Conduct](CONDUCT.md).
By participating in this project you agree to abide by its terms.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ $ composer require php-http/httplug

## Intro

This is the contract package for HTTP Client. Use it to create HTTP Clients which are interoperable and compatible with [PSR-7](http://www.php-fig.org/psr/psr-7/).
This is the contract package for HTTP Client.
Use it to create HTTP Clients which are interoperable and compatible with [PSR-7](http://www.php-fig.org/psr/psr-7/).


## Documentation
Expand All @@ -40,7 +41,7 @@ $ composer test

## Contributing

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.


## Security
Expand Down
44 changes: 0 additions & 44 deletions spec/BatchResultSpec.php

This file was deleted.

44 changes: 0 additions & 44 deletions spec/Body/CombinedMultipartSpec.php

This file was deleted.

44 changes: 0 additions & 44 deletions spec/Body/FilesSpec.php

This file was deleted.

40 changes: 0 additions & 40 deletions spec/Body/MultipartDataSpec.php

This file was deleted.

33 changes: 0 additions & 33 deletions spec/Body/UrlencodedDataSpec.php

This file was deleted.

45 changes: 6 additions & 39 deletions spec/Exception/BatchExceptionSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@

class BatchExceptionSpec extends ObjectBehavior
{
function let(BatchResult $batchResult)
{
$this->beConstructedWith($batchResult);
}

function it_is_initializable()
{
$this->shouldHaveType('Http\Client\Exception\BatchException');
Expand All @@ -24,46 +29,8 @@ function it_is_an_exception()
$this->shouldImplement('Http\Client\Exception');
}

function it_has_a_result()
{
$this->setResult($result = new BatchResult());
$this->getResult()->shouldReturn($result);
}

function it_throws_an_exception_if_the_result_is_already_set()
function it_has_a_batch_result()
{
$this->getResult()->shouldHaveType('Http\Client\BatchResult');
$this->shouldThrow('Http\Client\Exception\InvalidArgumentException')->duringSetResult(new BatchResult());
}

function it_has_an_exception_for_a_request(RequestInterface $request, Exception $exception)
{
$this->shouldThrow('Http\Client\Exception\UnexpectedValueException')->duringGetExceptionFor($request);
$this->hasExceptionFor($request)->shouldReturn(false);

$this->addException($request, $exception);

$this->getExceptionFor($request)->shouldReturn($exception);
$this->hasExceptionFor($request)->shouldReturn(true);
}

function it_has_exceptions(RequestInterface $request, Exception $exception)
{
$this->getExceptions()->shouldReturn([]);

$this->addException($request, $exception);

$this->getExceptions()->shouldReturn([$exception]);
}

function it_checks_if_a_request_failed(RequestInterface $request, Exception $exception)
{
$this->isSuccessful($request)->shouldReturn(false);
$this->isFailed($request)->shouldReturn(false);

$this->addException($request, $exception);

$this->isSuccessful($request)->shouldReturn(false);
$this->isFailed($request)->shouldReturn(true);
}
}
Loading