Skip to content

Commit

Permalink
Fix credit
Browse files Browse the repository at this point in the history
  • Loading branch information
sveneld committed Mar 16, 2024
1 parent d379774 commit f2f1a8f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Credit/CreditSystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function __construct(

public function getUserCredit($userid)
{
$result = $this->db->query("SELECT credit FROM credit WHERE id = '$userid'");
$result = $this->db->query("SELECT credit FROM credit WHERE userId = '$userid'");
if ($result->rowCount() == 0) {
return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Credit/CreditSystemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function testGetUserCredit()
$db = $this->createMock(DbInterface::class);
$db->expects($this->once())
->method('query')
->with("SELECT credit FROM credit WHERE id = '$userId'")
->with("SELECT credit FROM credit WHERE userId = '$userId'")
->willReturn($dbResult);

$creditSystem = new CreditSystem(['isEnabled' => true], $db);
Expand All @@ -102,7 +102,7 @@ public function testGetUserCreditNotFoundUser()
$db = $this->createMock(DbInterface::class);
$db->expects($this->once())
->method('query')
->with("SELECT credit FROM credit WHERE id = '$userId'")
->with("SELECT credit FROM credit WHERE userId = '$userId'")
->willReturn($dbResult);

$creditSystem = new CreditSystem(['isEnabled' => true], $db);
Expand Down

0 comments on commit f2f1a8f

Please sign in to comment.