Skip to content

Commit 50b0d9b

Browse files
Merge pull request #581 from RossAHC/laravel-7
Upgrade to Laravel 7
2 parents 5574786 + 7068e2c commit 50b0d9b

File tree

8 files changed

+43
-42
lines changed

8 files changed

+43
-42
lines changed

.scrutinizer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ build:
1212
php72:
1313
environment:
1414
php:
15-
version: 7.2.0
15+
version: 7.2.5
1616
tests:
1717
override:
1818
- php-scrutinizer-run

.styleci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ risky: true
44

55
enabled:
66
- php_unit_strict
7-
- return_type_declaration
87

98
disabled:
109
- self_accessor

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ The package documentation can be found on the [official website](http://www.lara
2222
## Version Information
2323
Version | Illuminate | Status | PHP Version
2424
:----------|:--------------|:------------------------|:------------
25-
9.x | 5.8.x - 6.x.x | Active support :rocket: | >= 7.1.3
25+
10.x | 5.8.x - 7.x.x | Active support :rocket: | >= 7.2.5
26+
9.x | 5.8.x - 6.x.x | Active support | >= 7.1.3
2627
8.x | 5.2.x - 5.7.x | Active support | >= 7.0.13
2728
7.x | 5.2.x - 5.6.x | End of life | >= 7.0.13
2829
6.x | 5.2.x - 5.6.x | End of life | >= 7.0.13

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@
3939
}
4040
],
4141
"require": {
42-
"php": ">=7.2",
43-
"illuminate/console": "^5.8|^6.0",
44-
"illuminate/database": "^5.8|^6.0",
45-
"illuminate/filesystem": "^5.8|^6.0"
42+
"php": ">=7.2.5",
43+
"illuminate/console": "^5.8|^6.0|^7.0",
44+
"illuminate/database": "^5.8|^6.0|^7.0",
45+
"illuminate/filesystem": "^5.8|^6.0|^7.0"
4646
},
4747
"require-dev": {
4848
"phpunit/phpunit": "^8.0",
@@ -65,7 +65,7 @@
6565
},
6666
"extra": {
6767
"branch-alias": {
68-
"dev-master": "9.0-dev"
68+
"dev-master": "10.0-dev"
6969
},
7070
"laravel": {
7171
"providers": [

src/Console/InstallCommand.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@
33
namespace OwenIt\Auditing\Console;
44

55
use Illuminate\Console\Command;
6-
use Illuminate\Console\DetectsApplicationNamespace;
6+
use Illuminate\Container\Container;
77
use Illuminate\Support\Str;
88

99
class InstallCommand extends Command
1010
{
11-
use DetectsApplicationNamespace;
12-
1311
/**
1412
* {@inheritdoc}
1513
*/
@@ -43,7 +41,7 @@ public function handle()
4341
*/
4442
protected function registerAuditingServiceProvider()
4543
{
46-
$namespace = Str::replaceLast('\\', '', $this->getAppNamespace());
44+
$namespace = Str::replaceLast('\\', '', Container::getInstance()->getNamespace());
4745

4846
$appConfig = file_get_contents(config_path('app.php'));
4947

tests/Functional/AuditingTest.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace OwenIt\Auditing\Tests\Functional;
44

55
use Carbon\Carbon;
6+
use Illuminate\Foundation\Testing\Assert;
67
use Illuminate\Support\Facades\App;
78
use Illuminate\Support\Facades\Event;
89
use InvalidArgumentException;
@@ -142,7 +143,7 @@ public function itWillAuditTheCreatedEvent()
142143

143144
$this->assertEmpty($audit->old_values);
144145

145-
$this->assertArraySubset([
146+
Assert::assertArraySubset([
146147
'title' => 'How To Audit Eloquent Models',
147148
'content' => 'N/A',
148149
'published_at' => null,
@@ -177,13 +178,13 @@ public function itWillAuditTheUpdatedEvent()
177178

178179
$audit = Audit::first();
179180

180-
$this->assertArraySubset([
181+
Assert::assertArraySubset([
181182
'content' => 'N/A',
182183
'published_at' => null,
183184
'reviewed' => 0,
184185
], $audit->old_values, true);
185186

186-
$this->assertArraySubset([
187+
Assert::assertArraySubset([
187188
'content' => 'First step: install the laravel-auditing package.',
188189
'published_at' => $now->toDateTimeString(),
189190
'reviewed' => 1,
@@ -210,7 +211,7 @@ public function itWillAuditTheDeletedEvent()
210211

211212
$audit = Audit::first();
212213

213-
$this->assertArraySubset([
214+
Assert::assertArraySubset([
214215
'title' => 'How To Audit Eloquent Models',
215216
'content' => 'N/A',
216217
'published_at' => null,
@@ -244,7 +245,7 @@ public function itWillAuditTheRestoredEvent()
244245

245246
$this->assertEmpty($audit->old_values);
246247

247-
$this->assertArraySubset([
248+
Assert::assertArraySubset([
248249
'title' => 'How To Audit Eloquent Models',
249250
'content' => 'N/A',
250251
'published_at' => null,
@@ -344,7 +345,7 @@ public function itWillAuditUsingTheDefaultDriver()
344345

345346
$this->assertEmpty($audit->old_values);
346347

347-
$this->assertArraySubset([
348+
Assert::assertArraySubset([
348349
'title' => 'How To Audit Using The Fallback Driver',
349350
'content' => 'N/A',
350351
'published_at' => null,

tests/Unit/AuditTest.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Carbon\Carbon;
66
use DateTimeInterface;
7+
use Illuminate\Foundation\Testing\Assert;
78
use OwenIt\Auditing\Encoders\Base64Encoder;
89
use OwenIt\Auditing\Models\Audit;
910
use OwenIt\Auditing\Redactors\LeftRedactor;
@@ -31,7 +32,7 @@ public function itResolvesAuditData()
3132

3233
$this->assertCount(15, $resolvedData = $audit->resolveData());
3334

34-
$this->assertArraySubset([
35+
Assert::assertArraySubset([
3536
'audit_id' => 1,
3637
'audit_event' => 'created',
3738
'audit_url' => 'console',
@@ -78,7 +79,7 @@ public function itResolvesAuditDataIncludingUserAttributes()
7879

7980
$this->assertCount(21, $resolvedData = $audit->resolveData());
8081

81-
$this->assertArraySubset([
82+
Assert::assertArraySubset([
8283
'audit_id' => 2,
8384
'audit_event' => 'created',
8485
'audit_url' => 'console',
@@ -159,7 +160,7 @@ public function itReturnsAuditMetadataAsArray()
159160

160161
$this->assertCount(10, $metadata = $audit->getMetadata());
161162

162-
$this->assertArraySubset([
163+
Assert::assertArraySubset([
163164
'audit_id' => 1,
164165
'audit_event' => 'created',
165166
'audit_url' => 'console',
@@ -192,7 +193,7 @@ public function itReturnsAuditMetadataIncludingUserAttributesAsArray()
192193

193194
$this->assertCount(16, $metadata = $audit->getMetadata());
194195

195-
$this->assertArraySubset([
196+
Assert::assertArraySubset([
196197
'audit_id' => 2,
197198
'audit_event' => 'created',
198199
'audit_url' => 'console',
@@ -300,7 +301,7 @@ public function itReturnsAuditableModifiedAttributesAsArray()
300301

301302
$this->assertCount(5, $modified = $audit->getModified());
302303

303-
$this->assertArraySubset([
304+
Assert::assertArraySubset([
304305
'title' => [
305306
'new' => 'HOW TO AUDIT ELOQUENT MODELS',
306307
],
@@ -391,7 +392,7 @@ public function itReturnsDecodedAuditableAttributes()
391392

392393
$this->assertCount(3, $modified = $audit->getModified());
393394

394-
$this->assertArraySubset([
395+
Assert::assertArraySubset([
395396
'title' => [
396397
'new' => 'HOW TO AUDIT ELOQUENT MODELS',
397398
'old' => 'HOW TO AUDIT MODELS',
@@ -417,8 +418,8 @@ public function itReturnsTags()
417418
'tags' => 'foo,bar,baz',
418419
]);
419420

420-
$this->assertInternalType('array', $audit->getTags());
421-
$this->assertArraySubset([
421+
$this->assertIsArray($audit->getTags());
422+
Assert::assertArraySubset([
422423
'foo',
423424
'bar',
424425
'baz',
@@ -435,7 +436,7 @@ public function itReturnsEmptyTags()
435436
'tags' => null,
436437
]);
437438

438-
$this->assertInternalType('array', $audit->getTags());
439+
$this->assertIsArray($audit->getTags());
439440
$this->assertEmpty($audit->getTags());
440441
}
441442
}

tests/Unit/AuditableTest.php

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Carbon\Carbon;
66
use Illuminate\Database\Eloquent\Relations\Relation;
7+
use Illuminate\Foundation\Testing\Assert;
78
use Illuminate\Support\Facades\App;
89
use Illuminate\Support\Str;
910
use OwenIt\Auditing\Contracts\Auditable;
@@ -115,7 +116,7 @@ public function itReturnsTheDefaultAuditEvents()
115116
{
116117
$model = new Article();
117118

118-
$this->assertArraySubset([
119+
Assert::assertArraySubset([
119120
'created',
120121
'updated',
121122
'deleted',
@@ -136,7 +137,7 @@ public function itReturnsTheCustomAuditEventsFromAttribute()
136137
'archived',
137138
];
138139

139-
$this->assertArraySubset([
140+
Assert::assertArraySubset([
140141
'published' => 'getPublishedEventAttributes',
141142
'archived',
142143
], $model->getAuditEvents(), true);
@@ -155,7 +156,7 @@ public function itReturnsTheCustomAuditEventsFromConfig()
155156

156157
$model = new Article();
157158

158-
$this->assertArraySubset([
159+
Assert::assertArraySubset([
159160
'published' => 'getPublishedEventAttributes',
160161
'archived',
161162
], $model->getAuditEvents(), true);
@@ -399,7 +400,7 @@ public function itReturnsTheAuditData()
399400

400401
$this->assertCount(11, $auditData = $model->toAudit());
401402

402-
$this->assertArraySubset([
403+
Assert::assertArraySubset([
403404
'old_values' => [],
404405
'new_values' => [
405406
'title' => 'How To Audit Eloquent Models',
@@ -458,7 +459,7 @@ public function itReturnsTheAuditDataIncludingUserAttributes(
458459

459460
$this->assertCount(11, $auditData = $model->toAudit());
460461

461-
$this->assertArraySubset([
462+
Assert::assertArraySubset([
462463
'old_values' => [],
463464
'new_values' => [
464465
'title' => 'How To Audit Eloquent Models',
@@ -540,7 +541,7 @@ public function itExcludesAttributesFromTheAuditDataWhenInStrictMode()
540541

541542
$this->assertCount(11, $auditData = $model->toAudit());
542543

543-
$this->assertArraySubset([
544+
Assert::assertArraySubset([
544545
'old_values' => [],
545546
'new_values' => [
546547
'title' => 'How To Audit Eloquent Models',
@@ -610,7 +611,7 @@ public function itModifiesTheAuditAttributesSuccessfully()
610611
'reviewed' => Base64Encoder::class,
611612
];
612613

613-
$this->assertArraySubset([
614+
Assert::assertArraySubset([
614615
'old_values' => [
615616
'title' => 'Ho#################',
616617
'content' => '##A',
@@ -654,7 +655,7 @@ public function transformAudit(array $data): array
654655

655656
$this->assertCount(11, $auditData = $model->toAudit());
656657

657-
$this->assertArraySubset([
658+
Assert::assertArraySubset([
658659
'new_values' => [
659660
'title' => 'How To Audit Eloquent Models',
660661
'content' => 'First step: install the laravel-auditing package.',
@@ -673,7 +674,7 @@ public function itReturnsTheDefaultAttributesToBeIncludedInTheAudit()
673674
{
674675
$model = new Article();
675676

676-
$this->assertArraySubset([], $model->getAuditInclude(), true);
677+
Assert::assertArraySubset([], $model->getAuditInclude(), true);
677678
}
678679

679680
/**
@@ -689,7 +690,7 @@ public function itReturnsTheCustomAttributesToBeIncludedInTheAudit()
689690
'content',
690691
];
691692

692-
$this->assertArraySubset([
693+
Assert::assertArraySubset([
693694
'title',
694695
'content',
695696
], $model->getAuditInclude(), true);
@@ -703,7 +704,7 @@ public function itReturnsTheDefaultAttributesToBeExcludedFromTheAudit()
703704
{
704705
$model = new Article();
705706

706-
$this->assertArraySubset([], $model->getAuditExclude(), true);
707+
Assert::assertArraySubset([], $model->getAuditExclude(), true);
707708
}
708709

709710
/**
@@ -718,7 +719,7 @@ public function itReturnsTheCustomAttributesToBeExcludedFromTheAudit()
718719
'published_at',
719720
];
720721

721-
$this->assertArraySubset([
722+
Assert::assertArraySubset([
722723
'published_at',
723724
], $model->getAuditExclude(), true);
724725
}
@@ -879,7 +880,7 @@ public function itReturnsTheDefaultGeneratedAuditTags()
879880
{
880881
$model = new Article();
881882

882-
$this->assertArraySubset([], $model->generateTags(), true);
883+
Assert::assertArraySubset([], $model->generateTags(), true);
883884
}
884885

885886
/**
@@ -898,7 +899,7 @@ public function generateTags(): array
898899
}
899900
};
900901

901-
$this->assertArraySubset([
902+
Assert::assertArraySubset([
902903
'foo',
903904
'bar',
904905
], $model->generateTags(), true);
@@ -1061,7 +1062,7 @@ public function itFailsToTransitionWhenTheAuditableAttributeCompatibilityIsNotMe
10611062
$e->getMessage()
10621063
);
10631064

1064-
$this->assertArraySubset([
1065+
Assert::assertArraySubset([
10651066
'subject',
10661067
'text',
10671068
], $e->getIncompatibilities(), true);

0 commit comments

Comments
 (0)