From d31121d2c291dcab52c92e36498ebbb029da9b64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Monnot?= Date: Fri, 26 Aug 2016 13:52:36 +0200 Subject: [PATCH] Fix composer error on build and add L5.3 compatibility (#12) * Add env COMPOSER_DISCARD_CHANGES=1 * Run composer update instead of composer install * Add L5.3 compatibility * Fix hhvm version for the constant ARRAY_FILTER_USE_BOTH * Revert "Fix hhvm version for the constant ARRAY_FILTER_USE_BOTH" This reverts commit 5844546dbb37372d31bfbf3cd176849c88943808. * update travis * Fix travis syntax error --- .travis.yml | 8 ++++---- src/ModerationScope.php | 4 ++-- tests/ModerationScopeTest.php | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index cacbcaa..e4cd2e7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ language: php php: - 5.6 - - hhvm + - 7.0 sudo: false @@ -13,17 +13,17 @@ cache: - $HOME/.composer/cache before_install: - - if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then phpenv config-rm xdebug.ini; fi; + - phpenv config-rm xdebug.ini install: - - composer install --dev --prefer-source --no-interaction + - COMPOSER_DISCARD_CHANGES=1 composer install --dev --prefer-source --no-interaction before_script: - cp tests/migrations/create_moderation_posts_table.php vendor/laravel/laravel/database/migrations/2015_11_19_053825_create_moderation_posts_table.php - cp src/config/moderation.php vendor/laravel/laravel/config/moderation.php - touch vendor/laravel/laravel/database/database.sqlite - cd vendor/laravel/laravel - - composer install --dev --prefer-source --no-interaction + - composer update --dev --prefer-source --no-interaction - yes | php artisan migrate - cd - diff --git a/src/ModerationScope.php b/src/ModerationScope.php index 6b57bc9..3d6a123 100644 --- a/src/ModerationScope.php +++ b/src/ModerationScope.php @@ -6,9 +6,9 @@ use Carbon\Carbon; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; -use Illuminate\Database\Eloquent\ScopeInterface; +use Illuminate\Database\Eloquent\Scope; -class ModerationScope implements ScopeInterface +class ModerationScope implements Scope { /** * All of the extensions to be added to the builder. diff --git a/tests/ModerationScopeTest.php b/tests/ModerationScopeTest.php index ef3b65d..072d22c 100644 --- a/tests/ModerationScopeTest.php +++ b/tests/ModerationScopeTest.php @@ -152,7 +152,7 @@ public function it_returns_all_stories() public function it_approves_stories() { $posts = $this->createPost([$this->status_column => Status::PENDING], 4); - $postsIds = $posts->lists('id')->all(); + $postsIds = $posts->pluck('id')->all(); (new Post)->newQueryWithoutScope(new ModerationScope)->whereIn('id', $postsIds)->approve(); @@ -165,7 +165,7 @@ public function it_approves_stories() public function it_rejects_stories() { $posts = $this->createPost([$this->status_column => Status::PENDING], 4); - $postsIds = $posts->lists('id')->all(); + $postsIds = $posts->pluck('id')->all(); (new Post)->newQueryWithoutScope(new ModerationScope)->whereIn('id', $postsIds)->reject(); @@ -178,7 +178,7 @@ public function it_rejects_stories() public function it_postpones_stories() { $posts = $this->createPost([$this->status_column => Status::PENDING], 4); - $postsIds = $posts->lists('id')->all(); + $postsIds = $posts->pluck('id')->all(); (new Post)->newQueryWithoutScope(new ModerationScope)->whereIn('id', $postsIds)->postpone(); @@ -300,7 +300,7 @@ public function it_queries_pending_stories_by_default_when_not_in_strict_mode() Post::$strictModeration = false; $posts = $this->createPost([$this->status_column => Status::PENDING], 5); - $postsIds = $posts->lists('id')->all(); + $postsIds = $posts->pluck('id')->all(); $postsReturned = Post::whereIn('id', $postsIds)->get();