re-introducing (optional) URL shortener support, resolves #58
This commit is contained in:
@@ -44,6 +44,7 @@ class RainTPLTest extends PHPUnit_Framework_TestCase
|
||||
$page->assign('EXPIRE', self::$expire);
|
||||
$page->assign('EXPIREDEFAULT', self::$expire_default);
|
||||
$page->assign('EXPIRECLONE', true);
|
||||
$page->assign('URLSHORTENER', '');
|
||||
ob_start();
|
||||
$page->draw('page');
|
||||
$this->_content = ob_get_contents();
|
||||
|
||||
@@ -16,6 +16,7 @@ class configurationTest extends PHPUnit_Framework_TestCase
|
||||
'base64version' => '2.1.9',
|
||||
'languageselection' => false,
|
||||
'languagedefault' => '',
|
||||
'urlshortener' => '',
|
||||
),
|
||||
'expire' => array(
|
||||
'default' => '1week',
|
||||
|
||||
@@ -44,6 +44,13 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
$content,
|
||||
'outputs title correctly'
|
||||
);
|
||||
$this->assertNotTag(
|
||||
array(
|
||||
'id' => 'shortenbutton'
|
||||
),
|
||||
$content,
|
||||
'doesn\'t output shortener button'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,6 +77,56 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @runInSeparateProcess
|
||||
*/
|
||||
public function testViewForceLanguageDefault()
|
||||
{
|
||||
$this->reset();
|
||||
$options = parse_ini_file(CONF, true);
|
||||
$options['main']['languageselection'] = false;
|
||||
$options['main']['languagedefault'] = 'fr';
|
||||
helper::confBackup();
|
||||
helper::createIniFile(CONF, $options);
|
||||
$_COOKIE['lang'] = 'de';
|
||||
ob_start();
|
||||
new zerobin;
|
||||
$content = ob_get_contents();
|
||||
$this->assertTag(
|
||||
array(
|
||||
'tag' => 'title',
|
||||
'content' => 'ZeroBin'
|
||||
),
|
||||
$content,
|
||||
'outputs title correctly'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @runInSeparateProcess
|
||||
*/
|
||||
public function testViewUrlShortener()
|
||||
{
|
||||
$shortener = 'https://shortener.example.com/api?link=';
|
||||
$this->reset();
|
||||
$options = parse_ini_file(CONF, true);
|
||||
$options['main']['urlshortener'] = $shortener;
|
||||
helper::confBackup();
|
||||
helper::createIniFile(CONF, $options);
|
||||
$_COOKIE['lang'] = 'de';
|
||||
ob_start();
|
||||
new zerobin;
|
||||
$content = ob_get_contents();
|
||||
$this->assertTag(
|
||||
array(
|
||||
'id' => 'shortenbutton',
|
||||
'attributes' => array('data-shortener' => $shortener)
|
||||
),
|
||||
$content,
|
||||
'outputs configured shortener URL correctly'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @runInSeparateProcess
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user