Skip to content
This repository was archived by the owner on Oct 25, 2021. It is now read-only.

Commit 1d2ca24

Browse files
authored
Merge pull request #1 from wizaplace/feature/improve-test-unit
Remove namespace in test classes + fix make unit
2 parents c1c30e8 + a9c325c commit 1d2ca24

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ test: unit ## (PHP) Launch all test tools
1919

2020
unit: vendor/bin ## (PHP) Unit tests
2121
@echo
22-
vendor/bin/phpunit
22+
vendor/bin/phpunit tests/
2323

2424
vendor/bin: ## (PHP) Install dependencies
2525
@echo

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "wizaplace/json-decoder",
3-
"description": "Enable to automatically throw an exception when json_decode() fails to decode a JSON",
3+
"description": "Throw an exception when json_decode() fails to decode a JSON",
44
"type": "library",
55
"homepage": "https://github.com/wizaplace/json-decoder",
66
"require-dev": {
@@ -25,7 +25,7 @@
2525
"Wizaplace\\Json\\": "src/"
2626
}
2727
},
28-
"autoload-dev": {
28+
"autoload-dev": {
2929
"psr-4": {
3030
"Wizaplace\\Test\\": "tests/"
3131
}

tests/Decoder/JsonDecoder.php renamed to tests/JsonDecoder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
declare(strict_types=1);
99

10-
namespace Wizaplace\Test\Decoder;
10+
namespace Wizaplace\Test;
1111

1212
use Symfony\Component\OptionsResolver\OptionsResolver;
1313
use Wizaplace\Json\Decoder\AbstractJsonDecoder;

tests/Decoder/JsonDecoderTest.php renamed to tests/JsonDecoderTest.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@
77

88
declare(strict_types=1);
99

10-
namespace Wizaplace\Test\Decoder;
10+
namespace Wizaplace\Test;
1111

1212
use PHPUnit\Framework\TestCase;
13-
use Wizaplace\Json\Exception\JsonDecodeException;
1413

1514
class JsonDecoderTest extends TestCase
1615
{
@@ -22,9 +21,9 @@ public function testDefaultConfiguration(): void
2221
);
2322
}
2423

25-
/** @expectedException \Wizaplace\Json\Exception\JsonDecodeException */
2624
public function testDepth(): void
2725
{
26+
$this->expectException(\Wizaplace\Json\Exception\JsonDecodeException::class);
2827
static::assertEquals(
2928
$this->getExpectedArray(),
3029
(new JsonDecoder())
@@ -33,9 +32,9 @@ public function testDepth(): void
3332
);
3433
}
3534

36-
/** @expectedException \Wizaplace\Json\Exception\JsonDecodeException */
3735
public function testSyntaxError(): void
3836
{
37+
$this->expectException(\Wizaplace\Json\Exception\JsonDecodeException::class);
3938
(new JsonDecoder())->decode('{');
4039
}
4140

@@ -47,16 +46,15 @@ public function testAllowNull(): void
4746
);
4847
}
4948

50-
/** @expectedException \Wizaplace\Json\Exception\JsonDecodeNullException */
5149
public function testDisallowNull(): void
5250
{
51+
$this->expectException(\Wizaplace\Json\Exception\JsonDecodeNullException::class);
5352
static::assertEquals(
5453
null,
5554
(new JsonDecoder())
5655
->setAllowNull(false)
5756
->decode('null')
5857
);
59-
$this->expectException("\Wizaplace\Json\Exception\JsonDecodeNullException");
6058
}
6159

6260
protected function createJson(): string

0 commit comments

Comments
 (0)