Skip to content

Commit 4d20401

Browse files
author
Pe Ell
authored
Merge pull request #29 from cybercog/laravel-5.4-support
Add Laravel 5.4 support
2 parents e359215 + 1eefbca commit 4d20401

17 files changed

+142
-119
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes to `laravel-eloquent-flag` will be documented in this file.
44

5+
## [3.11.0] - 2017-02-20
6+
7+
### Added
8+
9+
- Laravel 5.4 support.
10+
511
## [3.10.0] - 2017-02-13
612

713
### Added
@@ -139,6 +145,7 @@ All notable changes to `laravel-eloquent-flag` will be documented in this file.
139145

140146
- `is_active` boolean flag added.
141147

148+
[3.11.0]: https://github.com/cybercog/laravel-eloquent-flag/compare/3.10.0...3.11.0
142149
[3.10.0]: https://github.com/cybercog/laravel-eloquent-flag/compare/3.9.0...3.10.0
143150
[3.9.0]: https://github.com/cybercog/laravel-eloquent-flag/compare/3.8.0...3.9.0
144151
[3.8.0]: https://github.com/cybercog/laravel-eloquent-flag/compare/3.7.0...3.8.0

composer.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,15 @@
5252
"docs": "https://github.com/cybercog/laravel-eloquent-flag/wiki"
5353
},
5454
"require": {
55-
"illuminate/database": "~5.2.0|~5.3.0",
55+
"illuminate/database": "~5.2.0|~5.3.0|~5.4.0",
5656
"php": "^5.6|^7.0"
5757
},
5858
"require-dev": {
5959
"friendsofphp/php-cs-fixer": "^1.11",
6060
"mockery/mockery": "^0.9.5",
61-
"orchestra/testbench": "~3.0",
62-
"phpunit/phpunit": "^5.2"
61+
"orchestra/database": "~3.4.0",
62+
"orchestra/testbench": "~3.4.0",
63+
"phpunit/phpunit": "^5.7"
6364
},
6465
"autoload": {
6566
"psr-4": {
@@ -73,5 +74,7 @@
7374
},
7475
"config": {
7576
"sort-packages": true
76-
}
77+
},
78+
"minimum-stability": "dev",
79+
"prefer-stable" : true
7780
}

tests/TestCase.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ protected function setUp()
3131

3232
$this->destroyPackageMigrations();
3333
$this->publishPackageMigrations();
34+
$this->registerMigrations();
3435
$this->migrateUnitTestTables();
3536
$this->registerPackageFactories();
3637
}
@@ -45,6 +46,7 @@ protected function getPackageProviders($app)
4546
{
4647
return [
4748
FlagServiceProvider::class,
49+
\Orchestra\Database\ConsoleServiceProvider::class,
4850
];
4951
}
5052

@@ -64,14 +66,25 @@ protected function destroyPackageMigrations()
6466
File::cleanDirectory('vendor/orchestra/testbench/fixture/database/migrations');
6567
}
6668

69+
/**
70+
* Register test migrations.
71+
*
72+
* @return void
73+
*/
74+
protected function registerMigrations()
75+
{
76+
$this->loadMigrationsFrom([
77+
//'--database' => 'sqlite',
78+
'--realpath' => realpath(__DIR__ . '/database/migrations'),
79+
]);
80+
}
81+
6782
/**
6883
* Perform unit test database migrations.
6984
*/
7085
protected function migrateUnitTestTables()
7186
{
72-
$this->artisan('migrate', [
73-
'--path' => '../../../../tests/database/migrations',
74-
]);
87+
$this->artisan('migrate');
7588
}
7689

7790
/**

tests/unit/Traits/Classic/HasAcceptedAtHelpersTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class HasAcceptedAtHelpersTest extends TestCase
2525
/** @test */
2626
public function it_can_set_accepted_flag()
2727
{
28-
$entity = factory(EntityWithAcceptedAt::class, 1)->create([
28+
$entity = factory(EntityWithAcceptedAt::class)->create([
2929
'accepted_at' => null,
3030
]);
3131

@@ -37,7 +37,7 @@ public function it_can_set_accepted_flag()
3737
/** @test */
3838
public function it_can_unset_accepted_flag()
3939
{
40-
$entity = factory(EntityWithAcceptedAt::class, 1)->create([
40+
$entity = factory(EntityWithAcceptedAt::class)->create([
4141
'accepted_at' => Carbon::now(),
4242
]);
4343

@@ -49,11 +49,11 @@ public function it_can_unset_accepted_flag()
4949
/** @test */
5050
public function it_can_check_if_entity_is_accepted()
5151
{
52-
$acceptedEntity = factory(EntityWithAcceptedAt::class, 1)->create([
52+
$acceptedEntity = factory(EntityWithAcceptedAt::class)->create([
5353
'accepted_at' => Carbon::now(),
5454
]);
5555

56-
$rejectedEntity = factory(EntityWithAcceptedAt::class, 1)->create([
56+
$rejectedEntity = factory(EntityWithAcceptedAt::class)->create([
5757
'accepted_at' => null,
5858
]);
5959

@@ -64,11 +64,11 @@ public function it_can_check_if_entity_is_accepted()
6464
/** @test */
6565
public function it_can_check_if_entity_is_rejected()
6666
{
67-
$acceptedEntity = factory(EntityWithAcceptedAt::class, 1)->create([
67+
$acceptedEntity = factory(EntityWithAcceptedAt::class)->create([
6868
'accepted_at' => Carbon::now(),
6969
]);
7070

71-
$rejectedEntity = factory(EntityWithAcceptedAt::class, 1)->create([
71+
$rejectedEntity = factory(EntityWithAcceptedAt::class)->create([
7272
'accepted_at' => null,
7373
]);
7474

@@ -79,7 +79,7 @@ public function it_can_check_if_entity_is_rejected()
7979
/** @test */
8080
public function it_can_accept_entity()
8181
{
82-
$entity = factory(EntityWithAcceptedAt::class, 1)->create([
82+
$entity = factory(EntityWithAcceptedAt::class)->create([
8383
'accepted_at' => null,
8484
]);
8585

@@ -91,7 +91,7 @@ public function it_can_accept_entity()
9191
/** @test */
9292
public function it_can_reject_entity()
9393
{
94-
$entity = factory(EntityWithAcceptedAt::class, 1)->create([
94+
$entity = factory(EntityWithAcceptedAt::class)->create([
9595
'accepted_at' => Carbon::now(),
9696
]);
9797

tests/unit/Traits/Classic/HasAcceptedFlagHelpersTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class HasAcceptedFlagHelpersTest extends TestCase
2424
/** @test */
2525
public function it_can_set_accepted_flag()
2626
{
27-
$entity = factory(EntityWithAcceptedFlag::class, 1)->create([
27+
$entity = factory(EntityWithAcceptedFlag::class)->create([
2828
'is_accepted' => false,
2929
]);
3030

@@ -36,7 +36,7 @@ public function it_can_set_accepted_flag()
3636
/** @test */
3737
public function it_can_unset_accepted_flag()
3838
{
39-
$entity = factory(EntityWithAcceptedFlag::class, 1)->create([
39+
$entity = factory(EntityWithAcceptedFlag::class)->create([
4040
'is_accepted' => true,
4141
]);
4242

@@ -48,11 +48,11 @@ public function it_can_unset_accepted_flag()
4848
/** @test */
4949
public function it_can_check_if_entity_is_accepted()
5050
{
51-
$acceptedEntity = factory(EntityWithAcceptedFlag::class, 1)->create([
51+
$acceptedEntity = factory(EntityWithAcceptedFlag::class)->create([
5252
'is_accepted' => true,
5353
]);
5454

55-
$rejectedEntity = factory(EntityWithAcceptedFlag::class, 1)->create([
55+
$rejectedEntity = factory(EntityWithAcceptedFlag::class)->create([
5656
'is_accepted' => false,
5757
]);
5858

@@ -63,11 +63,11 @@ public function it_can_check_if_entity_is_accepted()
6363
/** @test */
6464
public function it_can_check_if_entity_is_rejected()
6565
{
66-
$acceptedEntity = factory(EntityWithAcceptedFlag::class, 1)->create([
66+
$acceptedEntity = factory(EntityWithAcceptedFlag::class)->create([
6767
'is_accepted' => true,
6868
]);
6969

70-
$rejectedEntity = factory(EntityWithAcceptedFlag::class, 1)->create([
70+
$rejectedEntity = factory(EntityWithAcceptedFlag::class)->create([
7171
'is_accepted' => false,
7272
]);
7373

@@ -78,7 +78,7 @@ public function it_can_check_if_entity_is_rejected()
7878
/** @test */
7979
public function it_can_accept_entity()
8080
{
81-
$entity = factory(EntityWithAcceptedFlag::class, 1)->create([
81+
$entity = factory(EntityWithAcceptedFlag::class)->create([
8282
'is_accepted' => false,
8383
]);
8484

@@ -90,7 +90,7 @@ public function it_can_accept_entity()
9090
/** @test */
9191
public function it_can_reject_entity()
9292
{
93-
$entity = factory(EntityWithAcceptedFlag::class, 1)->create([
93+
$entity = factory(EntityWithAcceptedFlag::class)->create([
9494
'is_accepted' => true,
9595
]);
9696

tests/unit/Traits/Classic/HasActiveFlagHelpersTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class HasActiveFlagHelpersTest extends TestCase
2424
/** @test */
2525
public function it_can_set_active_flag()
2626
{
27-
$entity = factory(EntityWithActiveFlag::class, 1)->create([
27+
$entity = factory(EntityWithActiveFlag::class)->create([
2828
'is_active' => false,
2929
]);
3030

@@ -36,7 +36,7 @@ public function it_can_set_active_flag()
3636
/** @test */
3737
public function it_can_unset_active_flag()
3838
{
39-
$entity = factory(EntityWithActiveFlag::class, 1)->create([
39+
$entity = factory(EntityWithActiveFlag::class)->create([
4040
'is_active' => true,
4141
]);
4242

@@ -48,11 +48,11 @@ public function it_can_unset_active_flag()
4848
/** @test */
4949
public function it_can_check_if_entity_is_active()
5050
{
51-
$activatedEntity = factory(EntityWithActiveFlag::class, 1)->create([
51+
$activatedEntity = factory(EntityWithActiveFlag::class)->create([
5252
'is_active' => true,
5353
]);
5454

55-
$deactivatedEntity = factory(EntityWithActiveFlag::class, 1)->create([
55+
$deactivatedEntity = factory(EntityWithActiveFlag::class)->create([
5656
'is_active' => false,
5757
]);
5858

@@ -63,11 +63,11 @@ public function it_can_check_if_entity_is_active()
6363
/** @test */
6464
public function it_can_check_if_entity_is_deactivated()
6565
{
66-
$activatedEntity = factory(EntityWithActiveFlag::class, 1)->create([
66+
$activatedEntity = factory(EntityWithActiveFlag::class)->create([
6767
'is_active' => true,
6868
]);
6969

70-
$deactivatedEntity = factory(EntityWithActiveFlag::class, 1)->create([
70+
$deactivatedEntity = factory(EntityWithActiveFlag::class)->create([
7171
'is_active' => false,
7272
]);
7373

@@ -78,7 +78,7 @@ public function it_can_check_if_entity_is_deactivated()
7878
/** @test */
7979
public function it_can_accept_entity()
8080
{
81-
$entity = factory(EntityWithActiveFlag::class, 1)->create([
81+
$entity = factory(EntityWithActiveFlag::class)->create([
8282
'is_active' => false,
8383
]);
8484

@@ -90,7 +90,7 @@ public function it_can_accept_entity()
9090
/** @test */
9191
public function it_can_reject_entity()
9292
{
93-
$entity = factory(EntityWithActiveFlag::class, 1)->create([
93+
$entity = factory(EntityWithActiveFlag::class)->create([
9494
'is_active' => true,
9595
]);
9696

tests/unit/Traits/Classic/HasApprovedAtHelpersTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class HasApprovedAtHelpersTest extends TestCase
2525
/** @test */
2626
public function it_can_set_approved_flag()
2727
{
28-
$entity = factory(EntityWithApprovedAt::class, 1)->create([
28+
$entity = factory(EntityWithApprovedAt::class)->create([
2929
'approved_at' => null,
3030
]);
3131

@@ -37,7 +37,7 @@ public function it_can_set_approved_flag()
3737
/** @test */
3838
public function it_can_unset_approved_flag()
3939
{
40-
$entity = factory(EntityWithApprovedAt::class, 1)->create([
40+
$entity = factory(EntityWithApprovedAt::class)->create([
4141
'approved_at' => Carbon::now(),
4242
]);
4343

@@ -49,11 +49,11 @@ public function it_can_unset_approved_flag()
4949
/** @test */
5050
public function it_can_check_if_entity_is_approved()
5151
{
52-
$approvedEntity = factory(EntityWithApprovedAt::class, 1)->create([
52+
$approvedEntity = factory(EntityWithApprovedAt::class)->create([
5353
'approved_at' => Carbon::now(),
5454
]);
5555

56-
$disapprovedEntity = factory(EntityWithApprovedAt::class, 1)->create([
56+
$disapprovedEntity = factory(EntityWithApprovedAt::class)->create([
5757
'approved_at' => null,
5858
]);
5959

@@ -64,11 +64,11 @@ public function it_can_check_if_entity_is_approved()
6464
/** @test */
6565
public function it_can_check_if_entity_is_disapproved()
6666
{
67-
$approvedEntity = factory(EntityWithApprovedAt::class, 1)->create([
67+
$approvedEntity = factory(EntityWithApprovedAt::class)->create([
6868
'approved_at' => Carbon::now(),
6969
]);
7070

71-
$disapprovedEntity = factory(EntityWithApprovedAt::class, 1)->create([
71+
$disapprovedEntity = factory(EntityWithApprovedAt::class)->create([
7272
'approved_at' => null,
7373
]);
7474

@@ -79,7 +79,7 @@ public function it_can_check_if_entity_is_disapproved()
7979
/** @test */
8080
public function it_can_approve_entity()
8181
{
82-
$entity = factory(EntityWithApprovedAt::class, 1)->create([
82+
$entity = factory(EntityWithApprovedAt::class)->create([
8383
'approved_at' => null,
8484
]);
8585

@@ -91,7 +91,7 @@ public function it_can_approve_entity()
9191
/** @test */
9292
public function it_can_disapprove_entity()
9393
{
94-
$entity = factory(EntityWithApprovedAt::class, 1)->create([
94+
$entity = factory(EntityWithApprovedAt::class)->create([
9595
'approved_at' => Carbon::now(),
9696
]);
9797

0 commit comments

Comments
 (0)