-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix an issue where the same mediaCollections could be registered mult…
…iple times. (#3598)
- Loading branch information
1 parent
8d6bac7
commit 3cac2fd
Showing
2 changed files
with
25 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
use Spatie\MediaLibrary\Tests\TestSupport\TestModels\TestModelWithConversion; | ||
|
||
it('calling getRegisteredMediaCollections multiple times should return the same result', function () { | ||
$testModel = new class() extends TestModelWithConversion | ||
{ | ||
public function registerMediaCollections(): void | ||
{ | ||
$this->addMediaCollection('images') | ||
->useDisk('secondMediaDisk'); | ||
} | ||
}; | ||
|
||
$result = $testModel->getRegisteredMediaCollections(); | ||
ray($result); | ||
|
||
expect($result)->toHaveCount(1); | ||
|
||
$result = $testModel->getRegisteredMediaCollections(); | ||
ray($result); | ||
|
||
expect($result)->toHaveCount(1); | ||
}); |