From aaf37c25fc9c206de779af88eec16fb8864af33a Mon Sep 17 00:00:00 2001 From: PasanBhanu Date: Sun, 22 Mar 2020 20:01:33 +0530 Subject: [PATCH] Test case --- .travis.yml | 5 ++-- composer.json | 3 +- phpunit.xml | 22 ++++++++++++++ tests/FacadeTest.php | 70 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 96 insertions(+), 4 deletions(-) create mode 100644 phpunit.xml create mode 100644 tests/FacadeTest.php diff --git a/.travis.yml b/.travis.yml index cdae4b9..f67b8f6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 \ No newline at end of file diff --git a/composer.json b/composer.json index b46da9f..0b9cb39 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,8 @@ "illuminate/database": "^7.0" }, "require-dev": { - "phpunit/phpunit": "^8.0" + "orchestra/database": "^5.0", + "orchestra/testbench": "~5.0" }, "autoload": { "files": [ diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..bdbe65d --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,22 @@ + + + + + tests + + + + + src/ + + + \ No newline at end of file diff --git a/tests/FacadeTest.php b/tests/FacadeTest.php new file mode 100644 index 0000000..7af96ff --- /dev/null +++ b/tests/FacadeTest.php @@ -0,0 +1,70 @@ +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, + ]; + } +} \ No newline at end of file