Skip to content

Commit 1ae3aa8

Browse files
stephane-monnothootlex
authored andcommitted
Support Auto-Discovery / Fix missing lib for testing / Upgrade phpunit / 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
1 parent e9bbc3a commit 1ae3aa8

File tree

5 files changed

+20
-14
lines changed

5 files changed

+20
-14
lines changed

.travis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
language: php
22

33
php:
4-
- 5.6
5-
- 7.0
4+
- 7.1
5+
- 7.2
66

77
sudo: false
88

README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ First, install the package through Composer.
2323
composer require hootlex/laravel-moderation
2424
```
2525

26-
Then include the service provider inside `config/app.php`.
27-
26+
If you are using Laravel < 5.5, you need to add Hootlex\Moderation\ModerationServiceProvider to your `config/app.php` providers array:
2827
```php
2928
'providers' => [
3029
...

composer.json

+16-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
{
22
"name": "hootlex/laravel-moderation",
33
"description": "A simple Content Moderation System for Laravel 5.* that allows you to Approve or Reject resources like posts, comments, users, etc.",
4-
"keywords": ["laravel", "moderation", "moderation-system", "content-moderation"],
4+
"keywords": [
5+
"laravel",
6+
"moderation",
7+
"moderation-system",
8+
"content-moderation"
9+
],
510
"license": "MIT",
611
"authors": [
712
{
@@ -19,12 +24,20 @@
1924
"php": ">=5.4.0"
2025
},
2126
"require-dev": {
22-
"phpunit/phpunit" : "5.*",
23-
"laravel/laravel": "5.*"
27+
"phpunit/phpunit": "7.0",
28+
"laravel/laravel": "5.*",
29+
"nunomaduro/collision": "^2.0"
2430
},
2531
"autoload": {
2632
"psr-4": {
2733
"Hootlex\\Moderation\\": "src/"
2834
}
35+
},
36+
"extra": {
37+
"laravel": {
38+
"providers": [
39+
"Hootlex\\Moderation\\ModerationServiceProvider"
40+
]
41+
}
2942
}
3043
}

src/ModerationScope.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ protected function addPend(Builder $builder)
317317
*/
318318
protected function getStatusColumn(Builder $builder)
319319
{
320-
if (count($builder->getQuery()->joins) > 0) {
320+
if ($builder->getQuery()->joins && count($builder->getQuery()->joins) > 0) {
321321
return $builder->getModel()->getQualifiedStatusColumn();
322322
} else {
323323
return $builder->getModel()->getStatusColumn();

tests/ModerationScopeTest.php

-6
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,6 @@ public function it_returns_only_pending_stories()
6868
}
6969
}
7070

71-
/** @test */
72-
public function it_returns_only_postponed_stories()
73-
{
74-
75-
}
76-
7771
/** @test */
7872
public function it_returns_stories_including_pending_ones()
7973
{

0 commit comments

Comments
 (0)