public function fetchRelatedEagerReturnsNullForEmptyRelationHasOne() {
$columnMap = new \TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap('columnName', 'propertyName');
$columnMap->setTypeOfRelation(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap::RELATION_HAS_ONE);
- $dataMap = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\DataMap', array('getColumnMap'));
+ $dataMap = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\DataMap', array('getColumnMap'), array(), '', FALSE);
$dataMap->expects($this->any())->method('getColumnMap')->will($this->returnValue($columnMap));
$dataMapper = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\DataMapper', array('getDataMap'));
$dataMapper->expects($this->any())->method('getDataMap')->will($this->returnValue($dataMap));
public function fetchRelatedEagerReturnsEmptyArrayForEmptyRelationNotHasOne() {
$columnMap = new \TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap('columnName', 'propertyName');
$columnMap->setTypeOfRelation(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap::RELATION_BELONGS_TO_MANY);
- $dataMap = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\DataMap', array('getColumnMap'));
+ $dataMap = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\DataMap', array('getColumnMap'), array(), '', FALSE);
$dataMap->expects($this->any())->method('getColumnMap')->will($this->returnValue($columnMap));
$dataMapper = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Mapper\\DataMapper', array('getDataMap'));
$dataMapper->expects($this->any())->method('getDataMap')->will($this->returnValue($dataMap));
class ExtensionUtilityTest extends \tx_phpunit_testcase {
/**
- * Contains backup of $TYPO3_CONF_VARS
+ * Enable backup of global and system variables
+ *
+ * @var boolean
+ */
+ protected $backupGlobals = TRUE;
+
+ /**
+ * Exclude TYPO3_DB from backup/ restore of $GLOBALS
+ * because resource types cannot be handled during serializing
*
* @var array
*/
- protected $typo3ConfVars = array();
+ protected $backupGlobalsBlacklist = array('TYPO3_DB');
/**
- * @var \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController contains a backup of the current $GLOBALS['TSFE']
+ * A backup of the global database
+ *
+ * @var \TYPO3\CMS\Core\Database\DatabaseConnection
*/
- protected $tsfeBackup;
+ protected $databaseBackup = NULL;
public function setUp() {
- $this->typo3ConfVars = $GLOBALS['TYPO3_CONF_VARS'];
+ $this->databaseBackup = $GLOBALS['TYPO3_DB'];
$GLOBALS['TYPO3_DB'] = $this->getMock('TYPO3\\CMS\\Core\\Database\\DatabaseConnection', array('fullQuoteStr', 'exec_SELECTgetRows'));
- $this->tsfeBackup = $GLOBALS['TSFE'];
if (!isset($GLOBALS['TSFE']->tmpl)) {
$GLOBALS['TSFE']->tmpl = new \stdClass();
}
}
public function tearDown() {
- $GLOBALS['TYPO3_CONF_VARS'] = $this->typo3ConfVars;
- $GLOBALS['TSFE'] = $this->tsfeBackup;
+ $GLOBALS['TYPO3_DB'] = $this->databaseBackup;
}
/**