Skip to content

Commit 9244835

Browse files
committed
[#.x] - phpcs
1 parent d26a743 commit 9244835

File tree

6 files changed

+46
-48
lines changed

6 files changed

+46
-48
lines changed

src/Domain/DataSource/User/UserTransport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
*/
2727
final class UserTransport
2828
{
29-
/** @var TUserTransport */
29+
/** @var TUserTransport */
3030
private array $store;
3131

3232
/**

src/Domain/DataSource/User/UserTypes.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
namespace Phalcon\Api\Domain\DataSource\User;
1515

16-
1716
/**
1817
* @phpstan-type TUserRecord array{}|array{
1918
* usr_id: int,

src/Domain/Hello/HelloService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function __invoke(array $input): Payload
3737
DomainStatus::SUCCESS,
3838
[
3939
'results' => [
40-
"Hello World!!! - " . date(Dates::DATE_TIME_FORMAT)
40+
"Hello World!!! - " . date(Dates::DATE_TIME_FORMAT),
4141
],
4242
]
4343
);

src/Domain/Services/Container.php

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -44,22 +44,12 @@ class Container extends Di
4444
public const EVENTS_MANAGER = 'eventsManager';
4545
/** @var string */
4646
public const FILTER = 'filter';
47-
/** @var string */
48-
public const LOGGER = 'logger';
49-
/** @var string */
50-
public const REQUEST = 'request';
51-
/** @var string */
52-
public const RESPONSE = 'response';
53-
/** @var string */
54-
public const ROUTER = 'router';
55-
/** @var string */
56-
public const TIME = 'time';
57-
5847
/**
5948
* Services
6049
*/
6150
public const HELLO_SERVICE = HelloService::class;
62-
public const USER_GET_SERVICE = 'service.user.get';
51+
/** @var string */
52+
public const LOGGER = 'logger';
6353
/**
6454
* Middleware
6555
*/
@@ -70,10 +60,19 @@ class Container extends Di
7060
* Repositories
7161
*/
7262
public const REPOSITORY_USER = 'repository.user';
63+
/** @var string */
64+
public const REQUEST = 'request';
7365
/**
7466
* Responders
7567
*/
7668
public const RESPONDER_JSON = JsonResponder::class;
69+
/** @var string */
70+
public const RESPONSE = 'response';
71+
/** @var string */
72+
public const ROUTER = 'router';
73+
/** @var string */
74+
public const TIME = 'time';
75+
public const USER_GET_SERVICE = 'service.user.get';
7776

7877
public function __construct()
7978
{
@@ -101,18 +100,18 @@ private function getServiceConnection(): Service
101100
return new Service(
102101
function () {
103102
/** @var string $dbName */
104-
$dbName = EnvManager::get('DB_NAME','phalcon');
103+
$dbName = EnvManager::get('DB_NAME', 'phalcon');
105104
/** @var string $host */
106-
$host = EnvManager::get('DB_HOST','rest-db');
105+
$host = EnvManager::get('DB_HOST', 'rest-db');
107106
/** @var string $password */
108-
$password = EnvManager::get('DB_PASS','secret');
109-
$port = (int)EnvManager::get('DB_PORT',3306);
107+
$password = EnvManager::get('DB_PASS', 'secret');
108+
$port = (int)EnvManager::get('DB_PORT', 3306);
110109
/** @var string $username */
111-
$username = EnvManager::get('DB_USER','root');
110+
$username = EnvManager::get('DB_USER', 'root');
112111
/** @var string $encoding */
113-
$encoding = EnvManager::get('DB_CHARSET','utf8');
112+
$encoding = EnvManager::get('DB_CHARSET', 'utf8');
114113
$queries = ['SET NAMES utf8mb4'];
115-
$dsn = sprintf(
114+
$dsn = sprintf(
116115
'mysql:host=%s;port=%s;dbname=%s;charset=%s',
117116
$host,
118117
$port,

tests/Fixtures/Domain/Migrations/UsersMigration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function insert(
2525
?string $username = null,
2626
?string $password = null,
2727
) {
28-
$id = $id ?: 'null';
28+
$id = $id ?: 'null';
2929
$sql = <<<SQL
3030
INSERT INTO {$this->table} (
3131
usr_id, usr_status_flag, usr_username, usr_password

tests/Unit/Domain/User/UserServiceTest.php

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -76,30 +76,6 @@ public function testServiceEmptyUserId(): void
7676
$this->assertStringContainsString($expected, $actual);
7777
}
7878

79-
public function testServiceWrongUserId(): void
80-
{
81-
$container = new Container();
82-
/** @var UserGetService $service */
83-
$service = $container->get(Container::USER_GET_SERVICE);
84-
85-
$payload = $service->__invoke(
86-
[
87-
'userId' => 999999
88-
]
89-
);
90-
91-
$expected = DomainStatus::NOT_FOUND;
92-
$actual = $payload->getStatus();
93-
$this->assertSame($expected, $actual);
94-
95-
$actual = $payload->getResult();
96-
$this->assertArrayHasKey('results', $actual);
97-
98-
$expected = 'Record(s) not found';
99-
$actual = $actual['results'][0];
100-
$this->assertStringContainsString($expected, $actual);
101-
}
102-
10379
public function testServiceWithUserId(): void
10480
{
10581
$container = new Container();
@@ -115,7 +91,7 @@ public function testServiceWithUserId(): void
11591

11692
$payload = $service->__invoke(
11793
[
118-
'userId' => $userId
94+
'userId' => $userId,
11995
]
12096
);
12197

@@ -146,4 +122,28 @@ public function testServiceWithUserId(): void
146122
$actual = $user['password'];
147123
$this->assertSame($expected, $actual);
148124
}
125+
126+
public function testServiceWrongUserId(): void
127+
{
128+
$container = new Container();
129+
/** @var UserGetService $service */
130+
$service = $container->get(Container::USER_GET_SERVICE);
131+
132+
$payload = $service->__invoke(
133+
[
134+
'userId' => 999999,
135+
]
136+
);
137+
138+
$expected = DomainStatus::NOT_FOUND;
139+
$actual = $payload->getStatus();
140+
$this->assertSame($expected, $actual);
141+
142+
$actual = $payload->getResult();
143+
$this->assertArrayHasKey('results', $actual);
144+
145+
$expected = 'Record(s) not found';
146+
$actual = $actual['results'][0];
147+
$this->assertStringContainsString($expected, $actual);
148+
}
149149
}

0 commit comments

Comments
 (0)