mirror of
https://github.com/silverstripe/silverstripe-externallinks.git
synced 2024-10-22 17:05:44 +02:00
30 lines
807 B
PHP
30 lines
807 B
PHP
<?php
|
|
namespace SilverStripe\ExternalLinks\Tests\Stubs;
|
|
|
|
use SilverStripe\Dev\TestOnly;
|
|
use SilverStripe\ExternalLinks\Tasks\LinkChecker;
|
|
|
|
class PretendLinkChecker implements LinkChecker, TestOnly
|
|
{
|
|
public function checkLink($href)
|
|
{
|
|
switch ($href) {
|
|
case 'http://www.working.com':
|
|
return 200;
|
|
case 'http://www.broken.com':
|
|
return 403;
|
|
case 'http://www.nodomain.com':
|
|
return 0;
|
|
case '/internal/link':
|
|
case '[sitetree_link,id=9999]':
|
|
case 'home':
|
|
case 'broken-internal':
|
|
case '[sitetree_link,id=1]':
|
|
return null;
|
|
case 'http://www.broken.com/url/thing':
|
|
default:
|
|
return 404;
|
|
}
|
|
}
|
|
}
|