adding tests for YOURLS functionality

This commit is contained in:
El RIDO 2022-10-23 13:09:54 +02:00
parent 4bd5ef9cda
commit 78e915e049
No known key found for this signature in database
GPG key ID: 0F5C940A6BD81F92
6 changed files with 135 additions and 22 deletions

View file

@ -48,6 +48,7 @@ class ControllerTest extends PHPUnit_Framework_TestCase
*/
public function testView()
{
$_SERVER['HTTP_HOST'] = 'example.com';
$_SERVER['QUERY_STRING'] = Helper::getPasteId();
$_GET[Helper::getPasteId()] = '';
ob_start();
@ -64,6 +65,11 @@ class ControllerTest extends PHPUnit_Framework_TestCase
$content,
'doesn\'t output shortener button'
);
$this->assertRegExp(
'# href="https://' . preg_quote($_SERVER['HTTP_HOST']) . '/">switching to HTTPS#',
$content,
'outputs configured https URL correctly'
);
}
/**