Skip to content

Commit 414863a

Browse files
authored
chore: 🤖 Bump version (#4)
1 parent 5c27545 commit 414863a

File tree

6 files changed

+53
-95
lines changed

6 files changed

+53
-95
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ jobs:
88

99
strategy:
1010
matrix:
11-
php: ['8.0', 8.1, 8.2]
11+
php: [8.2, 8.3, 8.4]
1212
lib:
13-
- { laravel: ^11.0 }
14-
- { laravel: ^10.0 }
15-
- { laravel: ^9.0 }
13+
- laravel: ^13.0.x-dev
14+
- laravel: ^12.0
15+
- laravel: ^11.0
1616
exclude:
17-
- { php: 8.0, lib: { laravel: ^10.0 } }
18-
- { php: 8.0, lib: { laravel: ^11.0 } }
19-
- { php: 8.1, lib: { laravel: ^11.0 } }
17+
- php: 8.2
18+
lib:
19+
laravel: ^13.0.x-dev
2020

2121
steps:
2222
- uses: actions/checkout@v3

.scrutinizer.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Laravel Database Mock [![Build Status](https://github.com/mpyw/laravel-database-mock/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/mpyw/laravel-database-mock/actions) [![Coverage Status](https://coveralls.io/repos/github/mpyw/laravel-database-mock/badge.svg?branch=master)](https://coveralls.io/github/mpyw/laravel-database-mock?branch=master) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/mpyw/laravel-database-mock/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/mpyw/laravel-database-mock/?branch=master)
1+
# Laravel Database Mock [![Build Status](https://github.com/mpyw/laravel-database-mock/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/mpyw/laravel-database-mock/actions) [![Coverage Status](https://coveralls.io/repos/github/mpyw/laravel-database-mock/badge.svg?branch=master)](https://coveralls.io/github/mpyw/laravel-database-mock?branch=master)
22

33
> [!WARNING]
44
> **Experimental**
@@ -7,9 +7,9 @@ Database Mocking Library which mocks `PDO` underlying Laravel Connection classes
77

88
## Requirements
99

10-
- PHP: `^8.0`
11-
- Laravel: `^9.0 || ^10.0`
12-
- Mockery: `^1.3.3 || ^1.4.2`
10+
- PHP: `^8.2`
11+
- Laravel: `^11.0 || ^12.0`
12+
- Mockery: `^1.6.12`
1313
- [mpyw/mockery-pdo](https://github.com/mpyw/mockery-pdo): `alpha`
1414

1515
## Installing

composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@
2121
}
2222
},
2323
"require": {
24-
"php": "^7.3 || ^8.0",
24+
"php": "^8.2",
2525
"ext-pdo": "*",
26-
"illuminate/database": "^9.0 || ^10.0 || ^11.0",
27-
"illuminate/support": "^9.0 || ^10.0 || ^11.0",
28-
"mpyw/mockery-pdo": "0.0.1-alpha7@alpha"
26+
"illuminate/database": "^11.0 || ^12.0 || ^13.0",
27+
"illuminate/support": "^11.0 || ^12.0 || ^13.0",
28+
"mpyw/mockery-pdo": "0.0.1-alpha8@alpha"
2929
},
3030
"require-dev": {
3131
"orchestra/testbench": "*",
32-
"orchestra/testbench-core": ">=7.0",
33-
"phpunit/phpunit": ">=9.5",
32+
"orchestra/testbench-core": ">=9.0",
33+
"phpunit/phpunit": ">=11.0",
3434
"nilportugues/sql-query-formatter": "^1.2.2"
3535
},
3636
"extra": {

phpunit.xml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
3-
<coverage>
2+
<phpunit backupGlobals="false"
3+
bootstrap="vendor/autoload.php"
4+
colors="true"
5+
processIsolation="false"
6+
stopOnFailure="false"
7+
cacheDirectory=".phpunit.cache"
8+
backupStaticProperties="false">
9+
10+
<source>
411
<include>
5-
<directory suffix=".php">src</directory>
12+
<directory>./src</directory>
613
</include>
7-
</coverage>
14+
</source>
15+
16+
<coverage/>
17+
818
<testsuites>
919
<testsuite name="Package Test Suite">
10-
<directory suffix="Test.php">./tests/</directory>
20+
<directory suffix="Test.php">./tests</directory>
1121
</testsuite>
1222
</testsuites>
1323
</phpunit>

tests/Test.php

Lines changed: 21 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,10 @@ public function getPackageProviders($app)
1616
return [DatabaseMockServiceProvider::class];
1717
}
1818

19-
/**
20-
* For testing both Laravel 7.x+ and 6.x-
21-
*
22-
* @param string $date
23-
* @return string
24-
*/
25-
protected function formatDate(string $date): string
26-
{
27-
return version_compare($this->app->version(), '7', '<')
28-
? Carbon::parse($date)->format('Y-m-d H:i:s')
29-
: $date;
30-
}
31-
3219
public function testSelectToFetchAll(): void
3320
{
3421
$pdo = DBMock::mockPdo();
35-
$pdo->shouldSelect('select * from `users`')
22+
$pdo->shouldSelect('select * from "users"')
3623
->shouldFetchAllReturns([[
3724
'id' => 1,
3825
'name' => 'John',
@@ -45,8 +32,8 @@ public function testSelectToFetchAll(): void
4532
'id' => 1,
4633
'name' => 'John',
4734
'email' => 'john@example.com',
48-
'created_at' => $this->formatDate('2020-01-01T00:00:00.000000Z'),
49-
'updated_at' => $this->formatDate('2020-01-01T00:00:00.000000Z'),
35+
'created_at' => '2020-01-01T00:00:00.000000Z',
36+
'updated_at' => '2020-01-01T00:00:00.000000Z',
5037
]], User::all()->toArray());
5138
}
5239

@@ -56,7 +43,7 @@ public function testInsert(): void
5643

5744
$pdo = DBMock::mockPdo();
5845
$pdo->shouldInsert(
59-
'insert into `users` (`name`, `email`, `updated_at`, `created_at`) values (?, ?, ?, ?)',
46+
'insert into "users" ("name", "email", "updated_at", "created_at") values (?, ?, ?, ?)',
6047
['John', 'john@example.com', '2020-01-01 00:00:00', '2020-01-01 00:00:00']
6148
);
6249
$pdo->expects('lastInsertId')->andReturn(2);
@@ -67,8 +54,8 @@ public function testInsert(): void
6754
'id' => 2,
6855
'name' => 'John',
6956
'email' => 'john@example.com',
70-
'created_at' => $this->formatDate('2020-01-01T00:00:00.000000Z'),
71-
'updated_at' => $this->formatDate('2020-01-01T00:00:00.000000Z'),
57+
'created_at' => '2020-01-01T00:00:00.000000Z',
58+
'updated_at' => '2020-01-01T00:00:00.000000Z',
7259
], $user->toArray());
7360
}
7461

@@ -79,7 +66,7 @@ public function testInsertUsingCallbackMatcher(): void
7966
$pdo = DBMock::mockPdo();
8067
$pdo->shouldInsert(
8168
Mockery::on(function (string $sql) {
82-
$this->assertSame('insert into `users` (`name`, `email`, `updated_at`, `created_at`) values (?, ?, ?, ?)', $sql);
69+
$this->assertSame('insert into "users" ("name", "email", "updated_at", "created_at") values (?, ?, ?, ?)', $sql);
8370
return true;
8471
}),
8572
['John', 'john@example.com', '2020-01-01 00:00:00', '2020-01-01 00:00:00']
@@ -92,8 +79,8 @@ public function testInsertUsingCallbackMatcher(): void
9279
'id' => 2,
9380
'name' => 'John',
9481
'email' => 'john@example.com',
95-
'created_at' => $this->formatDate('2020-01-01T00:00:00.000000Z'),
96-
'updated_at' => $this->formatDate('2020-01-01T00:00:00.000000Z'),
82+
'created_at' => '2020-01-01T00:00:00.000000Z',
83+
'updated_at' => '2020-01-01T00:00:00.000000Z',
9784
], $user->toArray());
9885
}
9986

@@ -102,7 +89,7 @@ public function testUpdate(): void
10289
Carbon::setTestNow('2020-01-02 00:00:00');
10390

10491
$pdo = DBMock::mockPdo();
105-
$pdo->shouldSelect('select * from `users` where `email` = ? limit 1', ['john@example.com'])
92+
$pdo->shouldSelect('select * from "users" where "email" = ? limit 1', ['john@example.com'])
10693
->shouldFetchAllReturns([[
10794
'id' => 2,
10895
'name' => 'John',
@@ -111,9 +98,7 @@ public function testUpdate(): void
11198
'updated_at' => '2020-01-01 00:00:00',
11299
]]);
113100
$pdo->shouldUpdateOne(
114-
version_compare($this->app->version(), '5.8', '<')
115-
? 'update `users` set `email` = ?, `updated_at` = ? where `id` = ?'
116-
: 'update `users` set `email` = ?, `users`.`updated_at` = ? where `id` = ?',
101+
'update "users" set "email" = ?, "updated_at" = ? where "id" = ?',
117102
['john-01@example.com', '2020-01-02 00:00:00', 2]
118103
);
119104

@@ -123,8 +108,8 @@ public function testUpdate(): void
123108
'id' => 2,
124109
'name' => 'John',
125110
'email' => 'john-01@example.com',
126-
'created_at' => $this->formatDate('2020-01-01T00:00:00.000000Z'),
127-
'updated_at' => $this->formatDate('2020-01-02T00:00:00.000000Z'),
111+
'created_at' => '2020-01-01T00:00:00.000000Z',
112+
'updated_at' => '2020-01-02T00:00:00.000000Z',
128113
], $user->toArray());
129114
}
130115

@@ -134,7 +119,7 @@ public function testUpdateWithReadReplica(): void
134119

135120
$pdos = DBMock::mockEachPdo();
136121
$pdos->reader()
137-
->shouldSelect('select * from `users` where `email` = ? limit 1', ['john@example.com'])
122+
->shouldSelect('select * from "users" where "email" = ? limit 1', ['john@example.com'])
138123
->shouldFetchAllReturns([[
139124
'id' => 2,
140125
'name' => 'John',
@@ -144,9 +129,7 @@ public function testUpdateWithReadReplica(): void
144129
]]);
145130
$pdos->writer()
146131
->shouldUpdateOne(
147-
version_compare($this->app->version(), '5.8', '<')
148-
? 'update `users` set `email` = ?, `updated_at` = ? where `id` = ?'
149-
: 'update `users` set `email` = ?, `users`.`updated_at` = ? where `id` = ?',
132+
'update "users" set "email" = ?, "updated_at" = ? where "id" = ?',
150133
['john-01@example.com', '2020-01-02 00:00:00', 2]
151134
);
152135

@@ -156,8 +139,8 @@ public function testUpdateWithReadReplica(): void
156139
'id' => 2,
157140
'name' => 'John',
158141
'email' => 'john-01@example.com',
159-
'created_at' => $this->formatDate('2020-01-01T00:00:00.000000Z'),
160-
'updated_at' => $this->formatDate('2020-01-02T00:00:00.000000Z'),
142+
'created_at' => '2020-01-01T00:00:00.000000Z',
143+
'updated_at' => '2020-01-02T00:00:00.000000Z',
161144
], $user->toArray());
162145
}
163146

@@ -167,12 +150,10 @@ public function testUpdateAndSelectInAnyOrder(): void
167150

168151
$pdo = DBMock::mockPdo()->inAnyOrder();
169152
$pdo->shouldUpdateOne(
170-
version_compare($this->app->version(), '5.8', '<')
171-
? 'update `users` set `email` = ?, `updated_at` = ? where `id` = ?'
172-
: 'update `users` set `email` = ?, `users`.`updated_at` = ? where `id` = ?',
153+
'update "users" set "email" = ?, "updated_at" = ? where "id" = ?',
173154
['john-01@example.com', '2020-01-02 00:00:00', 2]
174155
);
175-
$pdo->shouldSelect('select * from `users` where `email` = ? limit 1', ['john@example.com'])
156+
$pdo->shouldSelect('select * from "users" where "email" = ? limit 1', ['john@example.com'])
176157
->shouldFetchAllReturns([[
177158
'id' => 2,
178159
'name' => 'John',
@@ -187,8 +168,8 @@ public function testUpdateAndSelectInAnyOrder(): void
187168
'id' => 2,
188169
'name' => 'John',
189170
'email' => 'john-01@example.com',
190-
'created_at' => $this->formatDate('2020-01-01T00:00:00.000000Z'),
191-
'updated_at' => $this->formatDate('2020-01-02T00:00:00.000000Z'),
171+
'created_at' => '2020-01-01T00:00:00.000000Z',
172+
'updated_at' => '2020-01-02T00:00:00.000000Z',
192173
], $user->toArray());
193174
}
194175
}

0 commit comments

Comments
 (0)