Skip to content

Commit

Permalink
Merge pull request #144 from MarcinOrlowski/dev
Browse files Browse the repository at this point in the history
Release v7.1.1
  • Loading branch information
MarcinOrlowski committed Jul 12, 2020
2 parents b30b827 + 00ef6eb commit ed908d8
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 35 deletions.
14 changes: 7 additions & 7 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ assignees: ''

---

**Describe the bug**
**What's wrong?**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
**Steps to reproduce the behavior:**
1.
2.
3.
4.

**Expected behavior**
A clear and concise description of what you expected to happen.
A clear and concise description of what you expected to happen
instead of currently observed behaviour..

**Environemnt:**Desktop (please complete the following information):**
**Runtime environment**
- Name and version of OS: [i.e. Windows 10, Ubuntu 19.04, etc]
- PHP version [i.e. 7.2]
- Laravel version [e.g. 6.0.0]

**Additional context**
Add any other context about the problem here.
**Notes**
Any additional information that may be helpful diagnosing the problem.
16 changes: 8 additions & 8 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Please describe the problem**
A clear and concise description of what your request is about.

**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe the solution you'd like to see**
A clear and concise description of what you want to happen once
your request is implemented. In other words, describe desired
behaviour. If possible, consider adding pseudo-code if that would
better illustrated your request.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
**Notes**
Add any other context or screenshots about the feature request here.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ before_script:
- "sed -i 's/): void/)/' vendor/phpunit/phpunit/src/Framework/TestCase.php"

script:
- vendor/bin/phpunit --configuration phpunit.xml --coverage-clover /tmp/coverage.xml
- vendor/bin/phpunit --configuration phpunit.xml --coverage-clover /tmp/clover.xml

after_success:
# If coverage file is generated then upload it to Codacy (requires CODACY_PROJECT_TOKEN= env var set).
- vendor/bin/codacycoverage clover /tmp/coverage.xml
- bash <(wget -q -O - https://coverage.codacy.com/get.sh) report -l PHP -r /tmp/clover.xml
# Scrutinizer-CI
- wget --output-document=/tmp/ocular.phar https://scrutinizer-ci.com/ocular.phar && php /tmp/ocular.phar code-coverage:upload --format=php-clover /tmp/coverage.xml
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ See [compatibility docs](docs/compatibility.md) for details about backward compa

## CHANGE LOG ##

* v7.1.1 (2020-07-11)
* Added more tests.
* Updated dependencies.
* Switched away from deprecated Codacy coverage package.

* v7.1.0 (2020-03-04)
* Added support for Laravel v7

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,6 @@

## License ##

* Written and copyrighted &copy;2016-2020qq by Marcin Orlowski <mail (#) marcinorlowski (.) com>
* Written and copyrighted &copy;2016-2020 by Marcin Orlowski <mail (#) marcinorlowski (.) com>
* ResponseBuilder is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)

5 changes: 2 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "marcin-orlowski/laravel-api-response-builder",
"description": "Helps building nice, normalized and easy to consume Laravel REST API.",
"homepage": "https://github.com/MarcinOrlowski/laravel-api-response-builder",
"version": "7.1.0",
"version": "7.1.1",
"keywords": [
"laravel",
"json",
Expand Down Expand Up @@ -46,11 +46,10 @@
},
"require-dev": {
"marcin-orlowski/coding-standard": "^1.3",
"marcin-orlowski/phpunit-extra-asserts": "^1.0",
"marcin-orlowski/phpunit-extra-asserts": "^1.1",
"orchestra/testbench": "^4.0",
"phpunit/phpunit": "^8.0",
"phpunit/php-code-coverage": "^7.0",
"codacy/coverage": "^1.0",
"friendsofphp/php-cs-fixer": "^2.15"
}
}
52 changes: 38 additions & 14 deletions tests/tests/ResponseBuilder/SuccessTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,46 @@

use MarcinOrlowski\ResponseBuilder\BaseApiCodes;
use MarcinOrlowski\ResponseBuilder\ResponseBuilder;
use Symfony\Component\HttpFoundation\Response as HttpResponse;


class SuccessTest extends TestCase
{
/**
* Check plain success() invocation
*
* @return void
*/
public function testSuccess(): void
{
$this->response = ResponseBuilder::success();
$j = $this->getResponseSuccessObject(BaseApiCodes::OK());

$this->assertNull($j->data);
$this->assertEquals(\Lang::get(BaseApiCodes::getCodeMessageKey(BaseApiCodes::OK())), $j->message);
}
/**
* Check plain success() invocation
*
* @return void
*/
public function testSuccess(): void
{
$this->response = ResponseBuilder::success();
$j = $this->getResponseSuccessObject(BaseApiCodes::OK());

$this->assertNull($j->data);
$this->assertEquals(\Lang::get(BaseApiCodes::getCodeMessageKey(BaseApiCodes::OK())), $j->message);
}

public function testSuccessWithExplicitNull(): void
{
$this->response = ResponseBuilder::success(null);
$j = $this->getResponseSuccessObject(BaseApiCodes::OK());

$this->assertNull($j->data);
$this->assertEquals(\Lang::get(BaseApiCodes::getCodeMessageKey(BaseApiCodes::OK())), $j->message);
}

public function testSuccessWithArrayPayload(): void
{
$payload = [];
for ($i = 0; $i < 10; $i++) {
$payload[] = $this->getRandomString("item${i}");
}

$this->response = ResponseBuilder::success($payload);
$j = $this->getResponseSuccessObject(BaseApiCodes::OK());

$this->assertNotNull($j->data);
$this->assertArraysEquals($payload, (array)$j->data);
$this->assertEquals(\Lang::get(BaseApiCodes::getCodeMessageKey(BaseApiCodes::OK())), $j->message);
}

}

0 comments on commit ed908d8

Please sign in to comment.