|
10 | 10 | use Workbench\Database\Entities\views\FooConnectionUserView;
|
11 | 11 | use Workbench\Database\Entities\views\UserView;
|
12 | 12 |
|
| 13 | +dataset('drivers', [ |
| 14 | + 'mariadb' => 'mariadb', |
| 15 | + 'mysql' => 'mysql', |
| 16 | + 'pgsql' => 'pgsql', |
| 17 | + 'sqlite' => 'sqlite', |
| 18 | + 'sqlsrv' => 'sqlsrv', |
| 19 | +]); |
| 20 | + |
13 | 21 | beforeEach(function () {
|
14 | 22 | test()->connection = test()->mock(Connection::class);
|
15 | 23 |
|
|
49 | 57 | });
|
50 | 58 |
|
51 | 59 | describe('create', function () {
|
52 |
| - it('creates an entity', function (string|SqlEntity $entity) { |
| 60 | + it('creates an entity', function (string $driver, string|SqlEntity $entity) { |
53 | 61 | test()->connection
|
54 |
| - ->shouldReceive('getDriverName')->once()->andReturn('sqlite') |
| 62 | + ->shouldReceive('getDriverName')->once()->andReturn($driver) |
55 | 63 | ->shouldReceive('statement')
|
56 | 64 | ->once()
|
57 | 65 | ->withArgs(fn ($sql) => str_contains($sql, 'CREATE VIEW'));
|
58 | 66 |
|
59 | 67 | test()->manager->create($entity);
|
60 |
| - })->with([ |
| 68 | + })->with('drivers')->with([ |
61 | 69 | 'name' => 'user_view',
|
62 | 70 | 'class' => UserView::class,
|
63 | 71 | 'entity' => new UserView(),
|
|
76 | 84 | });
|
77 | 85 |
|
78 | 86 | describe('drop', function () {
|
79 |
| - it('drops an entity', function (string|SqlEntity $entity) { |
| 87 | + it('drops an entity', function (string $driver, string|SqlEntity $entity) { |
80 | 88 | test()->connection
|
81 |
| - ->shouldReceive('getDriverName')->once()->andReturn('pgsql') |
| 89 | + ->shouldReceive('getDriverName')->once()->andReturn($driver) |
82 | 90 | ->shouldReceive('statement')
|
83 | 91 | ->once()
|
84 | 92 | ->withArgs(fn ($sql) => str_contains($sql, 'DROP VIEW'));
|
85 | 93 |
|
86 | 94 | test()->manager->drop($entity);
|
87 |
| - })->with([ |
| 95 | + })->with('drivers')->with([ |
88 | 96 | 'name' => 'user_view',
|
89 | 97 | 'class' => UserView::class,
|
90 | 98 | 'entity' => new UserView(),
|
|
0 commit comments