Skip to content

Commit

Permalink
Mock database connection
Browse files Browse the repository at this point in the history
  • Loading branch information
programarivm committed Sep 11, 2024
1 parent f6fc443 commit 6a4b535
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions tests/unit/Command/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,17 @@
use ChessServer\Command\Game\RestartCommand;
use ChessServer\Command\Game\StartCommand;
use ChessServer\Exception\ParserException;
use Dotenv\Dotenv;
use PHPUnit\Framework\TestCase;

class ParserTest extends TestCase
{
protected static $db;

protected static $parser;

public static function setUpBeforeClass(): void
public function setUp(): void
{
$dotenv = Dotenv::createImmutable(__DIR__.'/../../../');
$dotenv->load();

$db = new Db([
'driver' => $_ENV['DB_DRIVER'],
'host' => $_ENV['DB_HOST'],
'database' => $_ENV['DB_DATABASE'],
'username' => $_ENV['DB_USERNAME'],
'password' => $_ENV['DB_PASSWORD'],
]);
$db = $this->getMockBuilder(Db::class)
->disableOriginalConstructor()
->getMock();

self::$parser = new Parser(new Cli($db));
}
Expand Down

0 comments on commit 6a4b535

Please sign in to comment.