Skip to content

Commit

Permalink
Support Auto-Discovery / Fix missing lib for testing / Upgrade phpuni…
Browse files Browse the repository at this point in the history
…t / Make it compatible with PHP 7.2 (#31)

* Check if joins is not null due to PHP 7.2 bug that crashes when counting null

* Fix missing libraries and upgrade phpunit

* Add php 7.2 to travis

* Support Auto-Discovery

* Remove compatibility with 5.6 and 7.0

* Revert minimum PHP version requirement to 5.4.0
  • Loading branch information
stephane-monnot authored and hootlex committed Jun 8, 2018
1 parent e9bbc3a commit 1ae3aa8
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
language: php

php:
- 5.6
- 7.0
- 7.1
- 7.2

sudo: false

Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ First, install the package through Composer.
composer require hootlex/laravel-moderation
```

Then include the service provider inside `config/app.php`.

If you are using Laravel < 5.5, you need to add Hootlex\Moderation\ModerationServiceProvider to your `config/app.php` providers array:
```php
'providers' => [
...
Expand Down
19 changes: 16 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
{
"name": "hootlex/laravel-moderation",
"description": "A simple Content Moderation System for Laravel 5.* that allows you to Approve or Reject resources like posts, comments, users, etc.",
"keywords": ["laravel", "moderation", "moderation-system", "content-moderation"],
"keywords": [
"laravel",
"moderation",
"moderation-system",
"content-moderation"
],
"license": "MIT",
"authors": [
{
Expand All @@ -19,12 +24,20 @@
"php": ">=5.4.0"
},
"require-dev": {
"phpunit/phpunit" : "5.*",
"laravel/laravel": "5.*"
"phpunit/phpunit": "7.0",
"laravel/laravel": "5.*",
"nunomaduro/collision": "^2.0"
},
"autoload": {
"psr-4": {
"Hootlex\\Moderation\\": "src/"
}
},
"extra": {
"laravel": {
"providers": [
"Hootlex\\Moderation\\ModerationServiceProvider"
]
}
}
}
2 changes: 1 addition & 1 deletion src/ModerationScope.php
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ protected function addPend(Builder $builder)
*/
protected function getStatusColumn(Builder $builder)
{
if (count($builder->getQuery()->joins) > 0) {
if ($builder->getQuery()->joins && count($builder->getQuery()->joins) > 0) {
return $builder->getModel()->getQualifiedStatusColumn();
} else {
return $builder->getModel()->getStatusColumn();
Expand Down
6 changes: 0 additions & 6 deletions tests/ModerationScopeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,6 @@ public function it_returns_only_pending_stories()
}
}

/** @test */
public function it_returns_only_postponed_stories()
{

}

/** @test */
public function it_returns_stories_including_pending_ones()
{
Expand Down

0 comments on commit 1ae3aa8

Please sign in to comment.