Skip to content

Commit

Permalink
Merge pull request #4 from msmakouz/fix-exists-method
Browse files Browse the repository at this point in the history
Adding `*` if id is empty in exists method
  • Loading branch information
msmakouz authored Jul 25, 2023
2 parents 4b9b98a + 52a2e4a commit 6ad625b
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ on:
pull_request: null
push:
branches:
- master
- '*.*'

name: phpunit

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/psalm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ on:
pull_request: null
push:
branches:
- master
- '*.*'

name: static analysis

Expand Down
5 changes: 1 addition & 4 deletions src/Lock.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,7 @@ public function exists(string $resource, ?string $id = null): bool
{
$request = new Request();
$request->setResource($resource);

if ($id !== null) {
$request->setId($id);
}
$request->setId($id ?? '*');

$response = $this->call('lock.Exists', $request);

Expand Down
2 changes: 1 addition & 1 deletion tests/src/LockTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function testExists(bool $result): void
->withArgs(function (string $method, Request $request, string $response): bool {
return $method === 'lock.Exists'
&& $request->getResource() === 'resource'
&& $request->getId() === ''
&& $request->getId() === '*'
&& $response === Response::class;
})
->andReturn(new Response(['ok' => $result]));
Expand Down

0 comments on commit 6ad625b

Please sign in to comment.