Skip to content

Commit

Permalink
Test case
Browse files Browse the repository at this point in the history
  • Loading branch information
PasanBhanu committed Mar 22, 2020
1 parent 55844ce commit aaf37c2
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 4 deletions.
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ language: php

php:
- 7.2
- 7.3

env:
matrix:
- COMPOSER_FLAGS=""
fast_finish: true

before_script:
- travis_retry composer self-update
- travis_retry composer update ${COMPOSER_FLAGS} --no-interaction --prefer-source
- travis_retry composer install --no-interaction --prefer-source

script:
- php vendor/bin/phpunit --coverage-text
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"illuminate/database": "^7.0"
},
"require-dev": {
"phpunit/phpunit": "^8.0"
"orchestra/database": "^5.0",
"orchestra/testbench": "~5.0"
},
"autoload": {
"files": [
Expand Down
22 changes: 22 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
verbose="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="Softink Lab Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">src/</directory>
</whitelist>
</filter>
</phpunit>
70 changes: 70 additions & 0 deletions tests/FacadeTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?php

namespace SoftinkLab\LaravelKeyvalueStorage\Test;

use SoftinkLab\LaravelKeyvalueStorage\Facades\KVOption;
use SoftinkLab\LaravelKeyvalueStorage\KeyValueStorageServiceProvider;
use Orchestra\Testbench\TestCase;

abstract class FacadeTest extends TestsCase
{
/**
* Define environment setup.
*
* @param \Illuminate\Foundation\Application $app
*
* @return void
*/
protected function getEnvironmentSetUp($app)
{
// Setup default database to use sqlite :memory:
$app['config']->set('database.default', 'testbench');

$app['config']->set(
'database.connections.testbench',
[
'driver' => 'sqlite',
'database' => ':memory:',
'prefix' => '',
]
);
}

/**
* Setup the test environment.
*/
public function setUp(): void
{
parent::setUp();

$this->loadMigrationsFrom(__DIR__ . '/../database/migrations');
}

/**
* Get package providers.
*
* @param \Illuminate\Foundation\Application $app
*
* @return array
*/
protected function getPackageProviders($app)
{
return [
KeyValueStorageServiceProvider::class,
];
}

/**
* Get package aliases.
*
* @param \Illuminate\Foundation\Application $app
*
* @return array
*/
protected function getPackageAliases($app)
{
return [
'KVOption' => KVOption::class,
];
}
}

0 comments on commit aaf37c2

Please sign in to comment.