Feature #22338 » 13940_tslib_content_testcase.php_v1.diff
tests/typo3/sysext/cms/tslib/tslib_content_testcase.php (working copy) | ||
---|---|---|
$actualResult = $this->cObj->getQueryArguments($getQueryArgumentsConfiguration, $overruleArguments, TRUE);
|
||
$this->assertEquals($expectedResult, $actualResult);
|
||
}
|
||
|
||
/**
|
||
* @test
|
||
*/
|
||
public function doesGetQueryMarkersQuoteWithoutMarkers() {
|
||
$table = 'tt_content';
|
||
|
||
$conf = array('markers.' => array());
|
||
$expectedResult = array();
|
||
$actualResult = $this->cObj->getQueryMarkers($table, $conf);
|
||
$this->assertEquals($expectedResult, $actualResult);
|
||
}
|
||
|
||
/**
|
||
* @test
|
||
*/
|
||
public function doesGetQueryMarkersQuoteInt() {
|
||
$table = 'tt_content';
|
||
$conf = array('markers.' => array('test' => '1'));
|
||
$expectedResult = array('test' => '1');
|
||
$actualResult = $this->cObj->getQueryMarkers($table, $conf);
|
||
|
||
$this->assertEquals($expectedResult, $actualResult);
|
||
}
|
||
|
||
/**
|
||
* @test
|
||
*/
|
||
public function doesGetQueryMarkersQuoteFloat() {
|
||
$table = 'tt_content';
|
||
$conf = array('markers.' => array('test' => '1.234'));
|
||
$expectedResult = array('test' => '1.234');
|
||
$actualResult = $this->cObj->getQueryMarkers($table, $conf);
|
||
|
||
$this->assertEquals($expectedResult, $actualResult);
|
||
}
|
||
|
||
/**
|
||
* @test
|
||
*/
|
||
public function doesGetQueryMarkersQuoteString() {
|
||
$table = 'tt_content';
|
||
$conf = array('markers.' => array('test' => 'hello'));
|
||
$expectedResult = array('test' => $GLOBALS['TYPO3_DB']->fullQuoteStr('hello', $table));
|
||
$actualResult = $this->cObj->getQueryMarkers($table, $conf);
|
||
|
||
$this->assertEquals($expectedResult, $actualResult);
|
||
}
|
||
/**
|
||
* @test
|
||
*/
|
||
public function doesGetQueryMarkersQuoteStringCreatedByStdWrap() {
|
||
$table = 'tt_content';
|
||
$conf = array('markers.' => array('test' => 'hello', 'test.' => array('noTrimWrap' => '| | world |')));
|
||
$expectedResult = array('test' => $GLOBALS['TYPO3_DB']->fullQuoteStr(' hello world ', $table));
|
||
$actualResult = $this->cObj->getQueryMarkers($table, $conf);
|
||
|
||
$this->assertEquals($expectedResult, $actualResult);
|
||
}
|
||
|
||
/**
|
||
* @test
|
||
*/
|
||
public function doesGetQueryMarkersQuoteStringWithQuotes() {
|
||
$table = 'tt_content';
|
||
$conf = array('markers.' => array('test' => 'h"\"el\'lo', 'test.' => array('noTrimWrap' => '| | world |')));
|
||
$expectedResult = array('test' => $GLOBALS['TYPO3_DB']->fullQuoteStr(' h"\"el\'lo world ', $table));
|
||
$actualResult = $this->cObj->getQueryMarkers($table, $conf);
|
||
|
||
$this->assertEquals($expectedResult, $actualResult);
|
||
}
|
||
|
||
/**
|
||
* @test
|
||
*/
|
||
public function doesGetQueryMarkersQuoteWithComma() {
|
||
$table = 'tt_content';
|
||
$conf = array('markers.' => array('name' => 'firstname', 'name.' => array('noTrimWrap' => '|"|, lastname"|')));
|
||
$expectedResult = array('name' => $GLOBALS['TYPO3_DB']->fullQuoteStr('"firstname, lastname"', $table));
|
||
$actualResult = $this->cObj->getQueryMarkers($table, $conf);
|
||
|
||
$this->assertEquals($expectedResult, $actualResult);
|
||
}
|
||
|
||
/**
|
||
* @test
|
||
*/
|
||
public function doesGetQueryMarkersQuoteNullAsString() {
|
||
$table = 'tt_content';
|
||
$conf = array('markers.' => array('title' => 'null'));
|
||
$expectedResult = array('name' => $GLOBALS['TYPO3_DB']->fullQuoteStr('null', $table));
|
||
$actualResult = $this->cObj->getQueryMarkers($table, $conf);
|
||
$this->assertEquals($expectedResult, $actualResult);
|
||
}
|
||
|
||
/**
|
||
* @test
|
||
*/
|
||
public function doesGetQueryMarkersQuoteNull() {
|
||
$table = 'tt_content';
|
||
|
||
$conf = array('markers.' => array('name' => 'NULL'));
|
||
$expectedResult = array('name' => 'NULL');
|
||
$actualResult = $this->cObj->getQueryMarkers($table, $conf);
|
||
|
||
$this->assertEquals($expectedResult, $actualResult);
|
||
|
||
$conf = array('markers.' => array('name' => 'null'));
|
||
$expectedResult = array('name' => 'NULL');
|
||
$actualResult = $this->cObj->getQueryMarkers($table, $conf);
|
||
|
||
$this->assertEquals($expectedResult, $actualResult);
|
||
|
||
$conf = array('markers.' => array('name' => null));
|
||
$expectedResult = array('name' => 'NULL');
|
||
$actualResult = $this->cObj->getQueryMarkers($table, $conf);
|
||
|
||
$this->assertEquals($expectedResult, $actualResult);
|
||
}
|
||
|
||
/**
|
||
* @test
|
||
*/
|
||
public function doesGetQueryMarkersQuoteCommaSeparatedList() {
|
||
$table = 'tt_content';
|
||
$conf = array('markers.' => array('commaSeparatedList' => 1, 'name' => '"kas"per","ingo","stucki","robert"'));
|
||
$quotedNames = array();
|
||
foreach (array('"kasper"', '"ingo"', '"stucki"', '"robert"') as $key => $name) {
|
||
$quotedNames[] = $GLOBALS['TYPO3_DB']->fullQuoteStr($name, $table);
|
||
}
|
||
$expectedResult = array('name' => implode(',',$quotedNames));
|
||
$actualResult = $this->cObj->getQueryMarkers($table, $conf);
|
||
|
||
$this->assertEquals($expectedResult, $actualResult);
|
||
}
|
||
|
||
}
|
||
?>
|