Skip to content

Commit aaf37c2

Browse files
committed
Test case
1 parent 55844ce commit aaf37c2

File tree

4 files changed

+96
-4
lines changed

4 files changed

+96
-4
lines changed

.travis.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@ language: php
22

33
php:
44
- 7.2
5-
- 7.3
65

76
env:
87
matrix:
9-
- COMPOSER_FLAGS=""
8+
fast_finish: true
109

1110
before_script:
1211
- travis_retry composer self-update
13-
- travis_retry composer update ${COMPOSER_FLAGS} --no-interaction --prefer-source
12+
- travis_retry composer install --no-interaction --prefer-source
1413

1514
script:
1615
- php vendor/bin/phpunit --coverage-text

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"illuminate/database": "^7.0"
1717
},
1818
"require-dev": {
19-
"phpunit/phpunit": "^8.0"
19+
"orchestra/database": "^5.0",
20+
"orchestra/testbench": "~5.0"
2021
},
2122
"autoload": {
2223
"files": [

phpunit.xml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit bootstrap="vendor/autoload.php"
3+
backupGlobals="false"
4+
backupStaticAttributes="false"
5+
colors="true"
6+
verbose="true"
7+
convertErrorsToExceptions="true"
8+
convertNoticesToExceptions="true"
9+
convertWarningsToExceptions="true"
10+
processIsolation="false"
11+
stopOnFailure="false">
12+
<testsuites>
13+
<testsuite name="Softink Lab Test Suite">
14+
<directory>tests</directory>
15+
</testsuite>
16+
</testsuites>
17+
<filter>
18+
<whitelist>
19+
<directory suffix=".php">src/</directory>
20+
</whitelist>
21+
</filter>
22+
</phpunit>

tests/FacadeTest.php

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<?php
2+
3+
namespace SoftinkLab\LaravelKeyvalueStorage\Test;
4+
5+
use SoftinkLab\LaravelKeyvalueStorage\Facades\KVOption;
6+
use SoftinkLab\LaravelKeyvalueStorage\KeyValueStorageServiceProvider;
7+
use Orchestra\Testbench\TestCase;
8+
9+
abstract class FacadeTest extends TestsCase
10+
{
11+
/**
12+
* Define environment setup.
13+
*
14+
* @param \Illuminate\Foundation\Application $app
15+
*
16+
* @return void
17+
*/
18+
protected function getEnvironmentSetUp($app)
19+
{
20+
// Setup default database to use sqlite :memory:
21+
$app['config']->set('database.default', 'testbench');
22+
23+
$app['config']->set(
24+
'database.connections.testbench',
25+
[
26+
'driver' => 'sqlite',
27+
'database' => ':memory:',
28+
'prefix' => '',
29+
]
30+
);
31+
}
32+
33+
/**
34+
* Setup the test environment.
35+
*/
36+
public function setUp(): void
37+
{
38+
parent::setUp();
39+
40+
$this->loadMigrationsFrom(__DIR__ . '/../database/migrations');
41+
}
42+
43+
/**
44+
* Get package providers.
45+
*
46+
* @param \Illuminate\Foundation\Application $app
47+
*
48+
* @return array
49+
*/
50+
protected function getPackageProviders($app)
51+
{
52+
return [
53+
KeyValueStorageServiceProvider::class,
54+
];
55+
}
56+
57+
/**
58+
* Get package aliases.
59+
*
60+
* @param \Illuminate\Foundation\Application $app
61+
*
62+
* @return array
63+
*/
64+
protected function getPackageAliases($app)
65+
{
66+
return [
67+
'KVOption' => KVOption::class,
68+
];
69+
}
70+
}

0 commit comments

Comments
 (0)