Skip to content

Commit 3c3bef7

Browse files
committed
laravel 7
1 parent 3ab35b8 commit 3c3bef7

File tree

4 files changed

+20
-33
lines changed

4 files changed

+20
-33
lines changed

.github/workflows/tests.yml

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

1616
steps:
1717
- name: Checkout code
18-
uses: actions/checkout@v1
18+
uses: actions/checkout@v2
1919

2020
- name: Cache composer
2121
uses: actions/cache@v1
@@ -24,7 +24,7 @@ jobs:
2424
key: php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
2525

2626
- name: Setup PHP
27-
uses: shivammathur/setup-php@v1
27+
uses: shivammathur/setup-php@v2
2828
with:
2929
php-version: ${{ matrix.php }}
3030
extension-csv: bcmath, ctype, dom, fileinfo, intl, gd, json, mbstring, pdo, pdo_sqlite, openssl, sqlite, xml, zip
@@ -34,4 +34,4 @@ jobs:
3434
run: composer install --no-interaction --no-scripts --no-suggest --prefer-source
3535

3636
- name: Execute tests
37-
run: vendor/bin/phpunit
37+
run: vendor/bin/phpunit

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{
1+
{
22
"name": "akaunting/firewall",
33
"description": "Web Application Firewall (WAF) package for Laravel",
44
"keywords": [
@@ -14,7 +14,7 @@
1414
],
1515
"license": "MIT",
1616
"authors": [
17-
{
17+
{
1818
"name": "Denis Duliçi",
1919
"email": "[email protected]",
2020
"homepage": "https://akaunting.com",
@@ -28,8 +28,8 @@
2828
"jenssegers/agent": "2.6.*"
2929
},
3030
"require-dev": {
31-
"phpunit/phpunit": "5.7.*",
32-
"orchestra/testbench": "3.4.*|3.5.*|3.6.*|3.7.*|3.8.*"
31+
"phpunit/phpunit": ">=5.7",
32+
"orchestra/testbench": ">=3.4"
3333
},
3434
"autoload": {
3535
"psr-4": {

phpunit.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,6 @@
2828
<env name="QUEUE_DRIVER" value="sync"/>
2929
<env name="QUEUE_CONNECTION" value="sync"/>
3030
<env name="MAIL_DRIVER" value="array"/>
31+
<env name="MAIL_MAILER" value="array"/>
3132
</php>
3233
</phpunit>

tests/TestCase.php

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
abstract class TestCase extends BaseTestCase
99
{
10-
protected $database;
11-
1210
protected function setUp(): void
1311
{
1412
parent::setUp();
@@ -24,8 +22,6 @@ protected function setUp(): void
2422
protected function tearDown(): void
2523
{
2624
parent::tearDown();
27-
28-
$this->deleteDatabase();
2925
}
3026

3127
protected function getPackageProviders($app)
@@ -35,6 +31,18 @@ protected function getPackageProviders($app)
3531
];
3632
}
3733

34+
protected function setUpDatabase()
35+
{
36+
config(['database.default' => 'testbench']);
37+
38+
config(['database.connections.testbench' => [
39+
'driver' => 'sqlite',
40+
'database' => ':memory:',
41+
'prefix' => '',
42+
],
43+
]);
44+
}
45+
3846
protected function setUpConfig()
3947
{
4048
config(['firewall' => require __DIR__ . '/../src/Config/firewall.php']);
@@ -47,28 +55,6 @@ protected function setUpConfig()
4755
config(['firewall.middleware.xss.methods' => ['all']]);
4856
}
4957

50-
protected function setUpDatabase()
51-
{
52-
if (!file_exists($path = __DIR__ . '/databases')) {
53-
mkdir($path);
54-
}
55-
56-
touch($this->database = tempnam($path, 'database.sqlite.'));
57-
58-
app()->config->set(
59-
'database.connections.testbench', [
60-
'driver' => 'sqlite',
61-
'database' => $this->database,
62-
'prefix' => '',
63-
]
64-
);
65-
}
66-
67-
protected function deleteDatabase()
68-
{
69-
@unlink($this->database);
70-
}
71-
7258
public function getNextClosure()
7359
{
7460
return function () {

0 commit comments

Comments
 (0)