Skip to content

Commit ed908d8

Browse files
Merge pull request #144 from MarcinOrlowski/dev
Release v7.1.1
2 parents b30b827 + 00ef6eb commit ed908d8

File tree

7 files changed

+63
-35
lines changed

7 files changed

+63
-35
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@ assignees: ''
77

88
---
99

10-
**Describe the bug**
10+
**What's wrong?**
1111
A clear and concise description of what the bug is.
1212

13-
**To Reproduce**
14-
Steps to reproduce the behavior:
13+
**Steps to reproduce the behavior:**
1514
1.
1615
2.
1716
3.
1817
4.
1918

2019
**Expected behavior**
21-
A clear and concise description of what you expected to happen.
20+
A clear and concise description of what you expected to happen
21+
instead of currently observed behaviour..
2222

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

28-
**Additional context**
29-
Add any other context about the problem here.
28+
**Notes**
29+
Any additional information that may be helpful diagnosing the problem.

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ assignees: ''
77

88
---
99

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

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

16-
**Describe alternatives you've considered**
17-
A clear and concise description of any alternative solutions or features you've considered.
18-
19-
**Additional context**
19+
**Notes**
2020
Add any other context or screenshots about the feature request here.

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ before_script:
4848
- "sed -i 's/): void/)/' vendor/phpunit/phpunit/src/Framework/TestCase.php"
4949

5050
script:
51-
- vendor/bin/phpunit --configuration phpunit.xml --coverage-clover /tmp/coverage.xml
51+
- vendor/bin/phpunit --configuration phpunit.xml --coverage-clover /tmp/clover.xml
5252

5353
after_success:
5454
# If coverage file is generated then upload it to Codacy (requires CODACY_PROJECT_TOKEN= env var set).
55-
- vendor/bin/codacycoverage clover /tmp/coverage.xml
55+
- bash <(wget -q -O - https://coverage.codacy.com/get.sh) report -l PHP -r /tmp/clover.xml
5656
# Scrutinizer-CI
5757
- 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

CHANGES.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ See [compatibility docs](docs/compatibility.md) for details about backward compa
66

77
## CHANGE LOG ##
88

9+
* v7.1.1 (2020-07-11)
10+
* Added more tests.
11+
* Updated dependencies.
12+
* Switched away from deprecated Codacy coverage package.
13+
914
* v7.1.0 (2020-03-04)
1015
* Added support for Laravel v7
1116

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,6 @@
108108

109109
## License ##
110110

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

composer.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "marcin-orlowski/laravel-api-response-builder",
33
"description": "Helps building nice, normalized and easy to consume Laravel REST API.",
44
"homepage": "https://github.com/MarcinOrlowski/laravel-api-response-builder",
5-
"version": "7.1.0",
5+
"version": "7.1.1",
66
"keywords": [
77
"laravel",
88
"json",
@@ -46,11 +46,10 @@
4646
},
4747
"require-dev": {
4848
"marcin-orlowski/coding-standard": "^1.3",
49-
"marcin-orlowski/phpunit-extra-asserts": "^1.0",
49+
"marcin-orlowski/phpunit-extra-asserts": "^1.1",
5050
"orchestra/testbench": "^4.0",
5151
"phpunit/phpunit": "^8.0",
5252
"phpunit/php-code-coverage": "^7.0",
53-
"codacy/coverage": "^1.0",
5453
"friendsofphp/php-cs-fixer": "^2.15"
5554
}
5655
}

tests/tests/ResponseBuilder/SuccessTest.php

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,46 @@
1515

1616
use MarcinOrlowski\ResponseBuilder\BaseApiCodes;
1717
use MarcinOrlowski\ResponseBuilder\ResponseBuilder;
18-
use Symfony\Component\HttpFoundation\Response as HttpResponse;
18+
1919

2020
class SuccessTest extends TestCase
2121
{
22-
/**
23-
* Check plain success() invocation
24-
*
25-
* @return void
26-
*/
27-
public function testSuccess(): void
28-
{
29-
$this->response = ResponseBuilder::success();
30-
$j = $this->getResponseSuccessObject(BaseApiCodes::OK());
31-
32-
$this->assertNull($j->data);
33-
$this->assertEquals(\Lang::get(BaseApiCodes::getCodeMessageKey(BaseApiCodes::OK())), $j->message);
34-
}
22+
/**
23+
* Check plain success() invocation
24+
*
25+
* @return void
26+
*/
27+
public function testSuccess(): void
28+
{
29+
$this->response = ResponseBuilder::success();
30+
$j = $this->getResponseSuccessObject(BaseApiCodes::OK());
31+
32+
$this->assertNull($j->data);
33+
$this->assertEquals(\Lang::get(BaseApiCodes::getCodeMessageKey(BaseApiCodes::OK())), $j->message);
34+
}
35+
36+
public function testSuccessWithExplicitNull(): void
37+
{
38+
$this->response = ResponseBuilder::success(null);
39+
$j = $this->getResponseSuccessObject(BaseApiCodes::OK());
40+
41+
$this->assertNull($j->data);
42+
$this->assertEquals(\Lang::get(BaseApiCodes::getCodeMessageKey(BaseApiCodes::OK())), $j->message);
43+
}
44+
45+
public function testSuccessWithArrayPayload(): void
46+
{
47+
$payload = [];
48+
for ($i = 0; $i < 10; $i++) {
49+
$payload[] = $this->getRandomString("item${i}");
50+
}
51+
52+
$this->response = ResponseBuilder::success($payload);
53+
$j = $this->getResponseSuccessObject(BaseApiCodes::OK());
54+
55+
$this->assertNotNull($j->data);
56+
$this->assertArraysEquals($payload, (array)$j->data);
57+
$this->assertEquals(\Lang::get(BaseApiCodes::getCodeMessageKey(BaseApiCodes::OK())), $j->message);
58+
}
3559

3660
}

0 commit comments

Comments
 (0)