Commit 57e00261 authored by Carsten  Rose's avatar Carsten Rose Committed by bbaer
Browse files

Feature 5333 / Thumbnail: fixed unit tests

parent f44227af
......@@ -20,6 +20,10 @@ class OnString {
* @return string
*/
public static function strrstr($haystack, $needle) {
return substr($haystack, strpos($haystack, $needle) + 1);
if (empty($needle) || empty($haystack)) {
return '';
}
return substr($haystack, strrpos($haystack, $needle) + 1);
}
}
......@@ -12,6 +12,7 @@ require_once(__DIR__ . '/../../qfq/helper/OnArray.php');
class OnArrayTest extends \PHPUnit_Framework_TestCase {
public function testSortByKey() {
$unsorted = [
'a' => 'z',
......
......@@ -8,6 +8,8 @@
namespace qfq;
require_once(__DIR__ . '/../../qfq/helper/OnString.php');
use qfq;
//use qfq\exceptions\CodeException;
......@@ -17,13 +19,13 @@ use qfq;
//require_once(__DIR__ . '/../../qfq/exceptions/CodeException.php');
//
class StringTest extends \PHPUnit_Framework_TestCase {
class OnStringTest extends \PHPUnit_Framework_TestCase {
public function testStrrstr() {
$this->assertEquals('', String::strrstr('', ''));
$this->assertEquals('', String::strrstr('hello world to the limit', ''));
$this->assertEquals('limit', String::strrstr('hello world to the limit', ' '));
$this->assertEquals('', String::strrstr('', ' '));
$this->assertEquals('', OnString::strrstr('', ''));
$this->assertEquals('', OnString::strrstr('hello world to the limit', ''));
$this->assertEquals('limit', OnString::strrstr('hello world to the limit', ' '));
$this->assertEquals('', OnString::strrstr('', ' '));
}
}
\ No newline at end of file
......@@ -336,6 +336,10 @@ EOT;
DOCUMENTATION_QFQ => DOCUMENTATION_QFQ_URL,
SYSTEM_ENTER_AS_SUBMIT => 1,
SYSTEM_CMD_INKSCAPE => 'inkscape',
SYSTEM_CMD_CONVERT => 'convert',
SYSTEM_THUMBNAIL_DIR_PUBLIC => SYSTEM_THUMBNAIL_DIR_PUBLIC_DEFAULT,
SYSTEM_THUMBNAIL_DIR_SECURE => SYSTEM_THUMBNAIL_DIR_SECURE_DEFAULT,
];
$fileName = $this->createFile($body);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment