• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tempestphp / tempest-framework / 14049246919

24 Mar 2025 09:42PM UTC coverage: 79.353% (-0.04%) from 79.391%
14049246919

push

github

web-flow
feat(support): support array parameters in string manipulations (#1073)

48 of 48 new or added lines in 2 files covered. (100.0%)

735 existing lines in 126 files now uncovered.

10492 of 13222 relevant lines covered (79.35%)

90.78 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

96.88
/src/Tempest/Database/src/Connection/PDOConnection.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Tempest\Database\Connection;
6

7
use PDO;
8
use PDOStatement;
9
use Tempest\Database\Config\DatabaseConfig;
10
use Tempest\Database\Exceptions\ConnectionClosed;
11

12
final class PDOConnection implements Connection
13
{
14
    private ?PDO $pdo = null;
15

16
    public function __construct(
15✔
17
        private readonly DatabaseConfig $config,
18
    ) {}
15✔
19

20
    public function beginTransaction(): bool
9✔
21
    {
22
        if ($this->pdo === null) {
9✔
23
            throw new ConnectionClosed();
2✔
24
        }
25

26
        return $this->pdo->beginTransaction();
7✔
27
    }
28

29
    public function commit(): bool
6✔
30
    {
31
        if ($this->pdo === null) {
6✔
32
            throw new ConnectionClosed();
2✔
33
        }
34

35
        return $this->pdo->commit();
4✔
36
    }
37

38
    public function rollback(): bool
6✔
39
    {
40
        if ($this->pdo === null) {
6✔
41
            throw new ConnectionClosed();
2✔
42
        }
43

44
        return $this->pdo->rollBack();
4✔
45
    }
46

47
    public function lastInsertId(): false|string
661✔
48
    {
49
        if ($this->pdo === null) {
661✔
50
            throw new ConnectionClosed();
2✔
51
        }
52

53
        return $this->pdo->lastInsertId();
659✔
54
    }
55

56
    public function prepare(string $sql): false|PDOStatement
661✔
57
    {
58
        if ($this->pdo === null) {
661✔
59
            throw new ConnectionClosed();
2✔
60
        }
61

62
        return $this->pdo->prepare($sql);
659✔
63
    }
64

65
    public function close(): void
9✔
66
    {
67
        $this->pdo = null;
9✔
68
    }
69

70
    public function connect(): void
14✔
71
    {
72
        if ($this->pdo !== null) {
14✔
UNCOV
73
            return;
×
74
        }
75

76
        $this->pdo = new PDO(
14✔
77
            $this->config->dsn,
14✔
78
            $this->config->username,
14✔
79
            $this->config->password,
14✔
80
        );
14✔
81
    }
82
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc