-
-
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.
add hasMedia convenience method + psr2
- Loading branch information
1 parent
51029ea
commit 3b4006a
Showing
9 changed files
with
74 additions
and
2 deletions.
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
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
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,45 @@ | ||
<?php | ||
|
||
namespace Spatie\MediaLibrary\Test\HasMediaTrait; | ||
|
||
use Spatie\MediaLibrary\Test\TestCase; | ||
|
||
class HasMediaTest extends TestCase | ||
{ | ||
/** | ||
* @test | ||
*/ | ||
public function it_returns_false_for_an_empty_collection() | ||
{ | ||
$this->assertFalse($this->testModel->hasMedia()); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function it_returns_true_for_a_non_empty_collection() | ||
{ | ||
$this->testModel->addMedia($this->getTestFilesDirectory('test.jpg')); | ||
|
||
$this->assertTrue($this->testModel->hasMedia()); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function it_returns_false_for_an_empty_named_collection() | ||
{ | ||
$this->assertFalse($this->testModel->hasMedia('images')); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function it_returns_true_for_a_non_empty_named_collection() | ||
{ | ||
$this->testModel->addMedia($this->getTestFilesDirectory('test.jpg'), 'images'); | ||
|
||
$this->assertTrue($this->testModel->hasMedia('images')); | ||
$this->assertFalse($this->testModel->hasMedia('downloads')); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<?php | ||
|
||
namespace Spatie\MediaLibrary\Test; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<?php | ||
|
||
namespace Spatie\MediaLibrary\Test; | ||
|
||
class TestModelWithConversion extends TestModel | ||
|
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<?php | ||
|
||
namespace Spatie\MediaLibrary\Test; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|