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

tempestphp / tempest-framework / 14724150077

29 Apr 2025 05:39AM UTC coverage: 80.147% (-0.1%) from 80.275%
14724150077

Pull #1120

github

web-flow
Merge 4c33421e1 into afcfb4d76
Pull Request #1120: feat(container): support dynamic tags using dynamic initializers

23 of 23 new or added lines in 7 files covered. (100.0%)

23 existing lines in 5 files now uncovered.

11849 of 14784 relevant lines covered (80.15%)

107.18 hits per line

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

0.0
/src/Tempest/Database/src/Connection/CachedConnectionInitializer.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Tempest\Database\Connection;
6

7
use Tempest\Container\Container;
8
use Tempest\Container\Initializer;
9
use Tempest\Container\Singleton;
10

11
/**
12
 * Reuses the same connection instance based on a static variable instead of the container.
13
 *
14
 * Used in testing where each test can have its own container instance.
15
 */
16
final class CachedConnectionInitializer implements Initializer
17
{
18
    private static ?Connection $instance = null;
19

UNCOV
20
    public function __construct(
×
21
        private readonly ConnectionInitializer $initializer,
UNCOV
22
    ) {}
×
23

UNCOV
24
    #[Singleton]
×
25
    public function initialize(Container $container): Connection
26
    {
UNCOV
27
        if (self::$instance !== null) {
×
UNCOV
28
            return self::$instance;
×
29
        }
30

UNCOV
31
        self::$instance = $this->initializer->initialize($container);
×
32

UNCOV
33
        return self::$instance;
×
34
    }
35
}
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

© 2025 Coveralls, Inc