diff --git a/.gitignore b/.gitignore index 5c2d0fa..a46201a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,9 @@ /vendor -/.env composer.phar composer.lock +.DS_Store +Thumbs.db +/phpunit.xml +/.idea +/.vscode +.phpunit.result.cache diff --git a/.travis.yml b/.travis.yml index 51bff58..d3c94d4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,29 @@ +dist: xenial language: php -php: - - 7.1 - - 7.2 +env: + global: + - SETUP=stable -sudo: false +matrix: + fast_finish: true + include: + - php: 7.2 + - php: 7.2 + env: SETUP=lowest + - php: 7.3 + - php: 7.3 + env: SETUP=lowest + - php: 7.4snapshot + - php: 7.4snapshot + env: SETUP=lowest -install: travis_retry composer install --no-interaction --prefer-source +cache: + directories: + - $HOME/.composer/cache + +install: +- if [[ $SETUP = 'stable' ]]; then travis_retry composer update --prefer-dist --no-interaction --prefer-stable --no-suggest; fi +- if [[ $SETUP = 'lowest' ]]; then travis_retry composer update --prefer-dist --no-interaction --prefer-lowest --prefer-stable --no-suggest; fi script: vendor/bin/phpunit --verbose diff --git a/README.md b/README.md index ef212e8..1049301 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ Mango Repo is open-sourced software licensed under the [MIT license](http://open 5.6.x | 0.3.x 5.7.x | 0.3.x 5.8.x | 0.4.x + 6.x | 1.x ### Installation Install Mango Repo as you would with any other dependency managed by Composer: diff --git a/composer.json b/composer.json index 92022ac..c894b3b 100644 --- a/composer.json +++ b/composer.json @@ -1,13 +1,7 @@ { "name": "larachimp/mango-repo", - "description": "Simple repository package for Laravel 5.", - "keywords": [ - "php", - "Laravel5", - "database", - "repository", - "pattern" - ], + "description": "Simple repository package for Laravel.", + "keywords": ["php", "Laravel", "database", "repository", "pattern"], "license": "MIT", "authors": [ { @@ -16,13 +10,14 @@ } ], "require": { - "php": "^7.1.3", - "illuminate/support": "^5.8", - "larachimp/pine-annotations": "0.2.*" + "php": "^7.2", + "illuminate/support": "^6.0", + "larachimp/pine-annotations": "^1.0" }, "require-dev": { - "orchestra/testbench": "3.8.*", - "mockery/mockery": "^1.0" + "mockery/mockery": "^1.1", + "orchestra/testbench": "^4.0", + "phpunit/phpunit": "^8.0" }, "autoload": { "psr-4": { @@ -36,7 +31,7 @@ }, "extra": { "branch-alias": { - "dev-master": "0.5.x-dev" + "dev-master": "develop" }, "laravel": { "providers": [ diff --git a/phpunit.xml b/phpunit.xml.dist similarity index 78% rename from phpunit.xml rename to phpunit.xml.dist index a9bfc45..1229695 100644 --- a/phpunit.xml +++ b/phpunit.xml.dist @@ -1,18 +1,20 @@ - ./tests/ + ./tests diff --git a/tests/Fixtures/database/factories/ModelFactory.php b/tests/Fixtures/database/factories/ModelFactory.php index e3395e7..0de4243 100644 --- a/tests/Fixtures/database/factories/ModelFactory.php +++ b/tests/Fixtures/database/factories/ModelFactory.php @@ -1,5 +1,7 @@ $faker->name, 'email' => $faker->unique()->safeEmail, 'password' => $password ?: $password = bcrypt('secret'), - 'remember_token' => str_random(10), + 'remember_token' => Str::random(10), 'is_active' => true, ]; }); diff --git a/tests/TestRepository.php b/tests/TestRepository.php index 13d7686..3d133ed 100644 --- a/tests/TestRepository.php +++ b/tests/TestRepository.php @@ -151,11 +151,12 @@ public function testUpdateMethod() /** * Test the delete method. * - * @expectedException \Illuminate\Database\Eloquent\ModelNotFoundException * @return void */ public function testDeleteMethod() { + $this->expectException(\Illuminate\Database\Eloquent\ModelNotFoundException::class); + $user1 = factory(User::class)->create([ 'name' => 'User 1', 'email' => 'hello@larachimp.com', @@ -201,11 +202,12 @@ public function testFindMethod() /** * Test the findOrFail method. * - * @expectedException \Illuminate\Database\Eloquent\ModelNotFoundException * @return void */ public function testFindOrFailMethod() { + $this->expectException(\Illuminate\Database\Eloquent\ModelNotFoundException::class); + $user1 = factory(User::class)->create([ 'name' => 'User 1', 'email' => 'hello@larachimp.com', diff --git a/tests/TestRepositoryScopes.php b/tests/TestRepositoryScopes.php index 0831465..6f13f1f 100644 --- a/tests/TestRepositoryScopes.php +++ b/tests/TestRepositoryScopes.php @@ -52,12 +52,12 @@ public function testGlobalScopeOnModelIsAppliedWhenQueringByRepository() /** * We will test if an inexistent method is called. * - * @expectedException \BadMethodCallException - * * @return void */ public function testInExistentScope() { + $this->expectException(\BadMethodCallException::class); + $foos = $this->app->make(FooRepository::class); $foos->isNotActive()->get(); }