forked from kmayo-ss/externallinks
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
56 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
SilverStripe\ORM\DatabaseAdmin: | ||
classname_value_remapping: | ||
BrokenExternalLink: SilverStripe\ExternalLinks\Model\BrokenExternalLink | ||
BrokenExternalPageTrack: SilverStripe\ExternalLinks\Model\BrokenExternalPageTrack | ||
BrokenExternalPageTrackStatus: SilverStripe\ExternalLinks\Model\BrokenExternalPageTrackStatus |
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,35 @@ | ||
<?php | ||
|
||
namespace SilverStripe\ExternalLinks\Tests\Model; | ||
|
||
use SilverStripe\Dev\SapphireTest; | ||
use SilverStripe\ExternalLinks\Model\BrokenExternalLink; | ||
|
||
class BrokenExternalLinkTest extends SapphireTest | ||
{ | ||
/** | ||
* @param int $httpCode | ||
* @param string $expected | ||
* @dataProvider httpCodeProvider | ||
*/ | ||
public function testGetHTTPCodeDescription($httpCode, $expected) | ||
{ | ||
$link = new BrokenExternalLink(); | ||
$link->HTTPCode = $httpCode; | ||
$this->assertSame($expected, $link->getHTTPCodeDescription()); | ||
} | ||
|
||
/** | ||
* @return array[] | ||
*/ | ||
public function httpCodeProvider() | ||
{ | ||
return [ | ||
[200, '200 (OK)'], | ||
[302, '302 (Found)'], | ||
[404, '404 (Not Found)'], | ||
[500, '500 (Internal Server Error)'], | ||
[789, '789 (Unknown Response Code)'], | ||
]; | ||
} | ||
} |