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

mpyw / laravel-cached-database-stickiness / 13644536682

04 Mar 2025 01:54AM UTC coverage: 100.0%. Remained the same
13644536682

push

github

web-flow
Update phpunit.xml

148 of 148 relevant lines covered (100.0%)

93.62 hits per line

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

100.0
/src/ConnectionServiceProvider.php
1
<?php
2

3
namespace Mpyw\LaravelCachedDatabaseStickiness;
4

5
use Closure;
6
use Illuminate\Database\Connection;
7
use Illuminate\Support\ServiceProvider;
8
use Mpyw\LaravelCachedDatabaseStickiness\Connections\MySqlConnection;
9
use Mpyw\LaravelCachedDatabaseStickiness\Connections\PostgresConnection;
10
use Mpyw\LaravelCachedDatabaseStickiness\Connections\SQLiteConnection;
11
use Mpyw\LaravelCachedDatabaseStickiness\Connections\SqlServerConnection;
12

13
class ConnectionServiceProvider extends ServiceProvider
14
{
15
    /**
16
     * {@inheritdoc}
17
     */
18
    public function register(): void
19
    {
20
        Connection::resolverFor('mysql', $this->resolverFor(MySqlConnection::class));
136✔
21
        Connection::resolverFor('pgsql', $this->resolverFor(PostgresConnection::class));
136✔
22
        Connection::resolverFor('sqlite', $this->resolverFor(SQLiteConnection::class));
136✔
23
        Connection::resolverFor('sqlsrv', $this->resolverFor(SqlServerConnection::class));
136✔
24
    }
25

26
    /**
27
     * Create resolver for the connection.
28
     *
29
     * @param  string   $class
30
     * @return \Closure
31
     */
32
    protected function resolverFor(string $class): Closure
33
    {
34
        return static function (...$args) use ($class) {
136✔
35
            return new $class(...$args);
136✔
36
        };
136✔
37
    }
38
}
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