-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add slideHasLink method and corresponding tests for link valida…
…tion (#795)
- Loading branch information
Showing
2 changed files
with
62 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,42 @@ | ||
<?php | ||
|
||
namespace Modularity\Module\Slider; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
|
||
class SliderTest extends TestCase { | ||
|
||
/** | ||
* @testdox class can be instantiated | ||
*/ | ||
public function testClassCanBeInstantiated() { | ||
$slider = new Slider(); | ||
$this->assertInstanceOf(Slider::class, $slider); | ||
} | ||
|
||
/** | ||
* @testdox slideHasLink returns false if link_type is not internal or external | ||
*/ | ||
public function testSlideHasLinkReturnFalseIfLinkTypeIndicatesNoLink() { | ||
$slider = new Slider(); | ||
$linkUrl = 'https://example.com'; | ||
$this->assertFalse($slider->slideHasLink([ 'link_type' => 'false', 'link_url' => $linkUrl ])); | ||
} | ||
|
||
/** | ||
* @testdox slideHasLink returns false if link_url is empty | ||
*/ | ||
public function testSlideHasLinkReturnFalseIfLinkUrlIsEmpty() { | ||
$slider = new Slider(); | ||
$this->assertFalse($slider->slideHasLink([ 'link_type' => 'internal', 'link_url' => '' ])); | ||
} | ||
|
||
/** | ||
* @testdox slideHasLink returns true if link_type is internal and link_url is not empty | ||
*/ | ||
public function testSlideHasLinkReturnTrueIfLinkTypeIsInternalAndLinkUrlIsNotEmpty() { | ||
$slider = new Slider(); | ||
$linkUrl = 'https://example.com'; | ||
$this->assertTrue($slider->slideHasLink([ 'link_type' => 'internal', 'link_url' => $linkUrl ])); | ||
} | ||
} |