. */ namespace SP\Tests\Infrastructure\Database; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\MockObject\Exception; use SP\Infrastructure\Database\DatabaseConnectionData; use SP\Infrastructure\Database\DatabaseException; use SP\Infrastructure\Database\PDOWrapper; use SP\Tests\UnitaryTestCase; /** * Class PDOWrapperTest */ #[Group('unitary')] class PDOWrapperTest extends UnitaryTestCase { /** * @throws DatabaseException * @throws Exception */ public function testBuild() { $dsn = 'mysql:charset=utf8;host=localhost;port=3306;dbname=test'; $connectionData = $this->createMock(DatabaseConnectionData::class); $connectionData->expects($this->once()) ->method('getDbUser'); $connectionData->expects($this->once()) ->method('getDbPass'); $pdoWrapper = new PDOWrapper(); $this->expectException(DatabaseException::class); $this->expectExceptionMessage('Unable to connect to DB'); $pdoWrapper->build($dsn, $connectionData, []); } }