Commit 22ff3b64 authored by Christian Kuhn's avatar Christian Kuhn
Browse files

[TASK] Clean up some ext:belog details and activate tests in travis

Cleans up ext:belog and activates the test suite:
* Fix some annotations
* Move a test that was put to a wrong location
* Minor CGL and readability changes
* Remove namespace compat layer of new 6.0 classes
* Change module registration and viewhelper to namespace

Change-Id: Ia31b5fcd52b76c40dbc6215c9820fa8c83a8ab86
Resolves: #40871
Related: 6.0
Reviewed-on: http://review.typo3.org/14557
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
parent e29649de
......@@ -188,7 +188,7 @@ abstract class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\Acti
* @param boolean $groupByPage Whether or not log entries should be grouped by page
* @return array
*/
protected function groupLogEntriesByPageAndDay(\TYPO3\CMS\Extbase\Persistence\Generic\QueryResult $logEntries, $groupByPage = FALSE) {
protected function groupLogEntriesByPageAndDay(\TYPO3\CMS\Extbase\Persistence\QueryResultInterface $logEntries, $groupByPage = FALSE) {
$targetStructure = array();
/** @var $entry \TYPO3\CMS\Belog\Domain\Model\LogEntry */
foreach ($logEntries as $entry) {
......
......@@ -79,14 +79,14 @@ class Constraint extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
/**
* manual date start
*
* @var DateTime
* @var \DateTime
*/
protected $manualDateStart = NULL;
/**
* manual date stop
*
* @var DateTime
* @var \DateTime
*/
protected $manualDateStop = NULL;
......@@ -249,7 +249,7 @@ class Constraint extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
/**
* Set manual date start
*
* @param DateTime $manualDateStart
* @param \DateTime $manualDateStart
* @return void
*/
public function setManualDateStart(\DateTime $manualDateStart) {
......@@ -259,7 +259,7 @@ class Constraint extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
/**
* Get manual date start
*
* @return DateTime
* @return \DateTime
*/
public function getManualDateStart() {
return $this->manualDateStart;
......@@ -268,7 +268,7 @@ class Constraint extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
/**
* Set manual date stop
*
* @param DateTime $manualDateStop
* @param \DateTime $manualDateStop
* @return void
*/
public function setManualDateStop(\DateTime $manualDateStop) {
......@@ -278,7 +278,7 @@ class Constraint extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
/**
* Get manual date stop
*
* @return DateTime
* @return \DateTime
*/
public function getManualDateStop() {
return $this->manualDateStop;
......
......@@ -58,7 +58,7 @@ class LogEntryRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
* Finds all log entries that match all given constraints.
*
* @param \TYPO3\CMS\Belog\Domain\Model\Constraint $constraint
* @return Tx_Extbase_Persistence_QueryResult<Tx_Belog_Domain_Model_LogEntry>
* @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface<\TYPO3\CMS\Belog\Domain\Model\LogEntry>
*/
public function findByConstraint(\TYPO3\CMS\Belog\Domain\Model\Constraint $constraint) {
$query = $this->createQuery();
......@@ -76,7 +76,7 @@ class LogEntryRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
*
* @param \TYPO3\CMS\Extbase\Persistence\QueryInterface $query
* @param \TYPO3\CMS\Belog\Domain\Model\Constraint $constraint
* @return array<Tx_Extbase_Persistence_QOM_Constraint>
* @return array<\TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface>
*/
protected function createQueryConstraints(\TYPO3\CMS\Extbase\Persistence\QueryInterface $query, \TYPO3\CMS\Belog\Domain\Model\Constraint $constraint) {
$queryConstraints = array();
......
......@@ -65,7 +65,8 @@ class BackendLogModuleBootstrap {
public function main() {
$configuration = array(
'extensionName' => 'Belog',
'pluginName' => 'tools_BelogLog'
'pluginName' => 'tools_BelogLog',
'vendorName' => 'TYPO3\CMS',
);
// Yeah, this is ugly. But currently, there is no other direct way
// in extbase to force a specific controller in backend mode.
......
<?php
/*
* @deprecated since 6.0, the classname tx_belog_WebInfo_Bootstrap and this file is obsolete
* and will be removed by 7.0. The class was renamed and is now located at:
* typo3/sysext/belog/Classes/Module/BackendLogModuleBootstrap.php
*/
require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('belog') . 'Classes/Module/BackendLogModuleBootstrap.php';
?>
\ No newline at end of file
{namespace belog=Tx_Belog_ViewHelpers}
{namespace belog=TYPO3\CMS\Belog\ViewHelpers}
<belog:be.addJsFile file="../t3lib/js/extjs/tceforms.js" />
<belog:be.addJsFile file="../t3lib/js/extjs/ux/Ext.ux.DateTimePicker.js" />
......
{namespace belog=Tx_Belog_ViewHelpers}
{namespace belog=TYPO3\CMS\Belog\ViewHelpers}
<f:if condition="{constraint.groupByPage}">
<div class="divider">
......
<?php
/*
* @deprecated since 6.0, the classname Tx_Belog_Domain_Repository_LogEntryTest and this file is obsolete
* and will be removed by 7.0. The class was renamed and is now located at:
* typo3/sysext/belog/Tests/Unit/Domain/Repository/LogEntryTest.php
namespace TYPO3\CMS\Belog\Tests\Unit\Domain\Model;
/***************************************************************
* Copyright notice
*
* (c) 2012 Oliver Klee <typo3-coding@oliverklee.de>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Testcase
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
* @package TYPO3
* @subpackage belog
*/
require_once \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('belog') . 'Tests/Unit/Domain/Repository/LogEntryTest.php';
class LogEntryTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
/**
* @var \TYPO3\CMS\Belog\Domain\Model\LogEntry
*/
protected $fixture = NULL;
public function setUp() {
$this->fixture = new \TYPO3\CMS\Belog\Domain\Model\LogEntry();
}
public function tearDown() {
unset($this->fixture);
}
/**
* @test
*/
public function getLogDataInitiallyReturnsEmptyArray() {
$this->assertSame(array(), $this->fixture->getLogData());
}
/**
* @test
*/
public function getLogDataForEmptyStringLogDataReturnsEmptyArray() {
$this->fixture->setLogData('');
$this->assertSame(array(), $this->fixture->getLogData());
}
/**
* @test
*/
public function getLogDataForGarbageStringLogDataReturnsEmptyArray() {
$this->fixture->setLogData('foo bar');
$this->assertSame(array(), $this->fixture->getLogData());
}
/**
* @test
*/
public function getLogDataForSerializedArrayReturnsThatArray() {
$logData = array('foo', 'bar');
$this->fixture->setLogData(serialize($logData));
$this->assertSame($logData, $this->fixture->getLogData());
}
/**
* @test
*/
public function getLogDataForSerializedObjectReturnsEmptyArray() {
$this->fixture->setLogData(new \stdClass());
$this->assertSame(array(), $this->fixture->getLogData());
}
}
?>
\ No newline at end of file
......@@ -24,7 +24,7 @@ namespace TYPO3\CMS\Belog\Tests\Unit\Domain\Repository;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Testcase for the Tx_Belog_Domain_Repository_HistoryEntryRepository class.
* Testcase
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
* @package TYPO3
......@@ -33,9 +33,9 @@ namespace TYPO3\CMS\Belog\Tests\Unit\Domain\Repository;
class HistoryEntryRepositoryTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
/**
* @var \TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings
* @var \TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings||\Tx_Phpunit_Interface_AccessibleObject
*/
private $querySettings = NULL;
protected $querySettings = NULL;
public function setUp() {
$this->querySettings = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\QuerySettingsInterface');
......
......@@ -24,7 +24,7 @@ namespace TYPO3\CMS\Belog\Tests\Unit\Domain\Repository;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Testcase for the Tx_Belog_Domain_Repository_LogEntryRepository class.
* Testcase
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
* @package TYPO3
......@@ -35,7 +35,7 @@ class LogEntryRepositoryTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase
/**
* @var \TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings
*/
private $querySettings = NULL;
protected $querySettings = NULL;
public function setUp() {
$this->querySettings = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\QuerySettingsInterface');
......
<?php
namespace TYPO3\CMS\Belog\Tests\Unit\Domain\Repository;
/***************************************************************
* Copyright notice
*
* (c) 2012 Oliver Klee <typo3-coding@oliverklee.de>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Testcase for the Tx_Belog_Domain_Model_LogEntry class.
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
* @package TYPO3
* @subpackage belog
*/
class LogEntryTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
/**
* @var \TYPO3\CMS\Belog\Domain\Model\LogEntry
*/
private $fixture = NULL;
public function setUp() {
$this->fixture = new \TYPO3\CMS\Belog\Domain\Model\LogEntry();
}
public function tearDown() {
unset($this->fixture);
}
/**
* @test
*/
public function getLogDataInitiallyReturnsEmptyArray() {
$this->assertSame(array(), $this->fixture->getLogData());
}
/**
* @test
*/
public function getLogDataForEmptyStringLogDataReturnsEmptyArray() {
$this->fixture->setLogData('');
$this->assertSame(array(), $this->fixture->getLogData());
}
/**
* @test
*/
public function getLogDataForGarbageStringLogDataReturnsEmptyArray() {
$this->fixture->setLogData('foo bar');
$this->assertSame(array(), $this->fixture->getLogData());
}
/**
* @test
*/
public function getLogDataForSerializedArrayReturnsThatArray() {
$logData = array('foo', 'bar');
$this->fixture->setLogData(serialize($logData));
$this->assertSame($logData, $this->fixture->getLogData());
}
/**
* @test
*/
public function getLogDataForSerializedObjectReturnsEmptyArray() {
$this->fixture->setLogData(new \stdClass());
$this->assertSame(array(), $this->fixture->getLogData());
}
}
?>
\ No newline at end of file
......@@ -24,7 +24,7 @@ namespace TYPO3\CMS\Belog\Tests\Unit\Domain\Repository;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Testcase for the Tx_Belog_Domain_Repository_WorkspaceRepository class.
* Testcase
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
* @package TYPO3
......@@ -35,7 +35,7 @@ class WorkspaceRepositoryTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase
/**
* @var \TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings
*/
private $querySettings = NULL;
protected $querySettings = NULL;
public function setUp() {
$this->querySettings = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\QuerySettingsInterface');
......
......@@ -36,8 +36,7 @@ $EM_CONF[$_EXTKEY] = array(
'depends' => array(
'php' => '5.3.0-0.0.0',
'typo3' => '6.0.0-0.0.0',
'extbase' => '1.4.0-0.0.0',
// TODO adjust before final 6.0 release
'extbase' => '1.4.0-0.0.0', // TODO adjust before final 6.0 release
'fluid' => '1.5.0-0.0.0'
),
'conflicts' => array(),
......
......@@ -2,18 +2,32 @@
if (!defined('TYPO3_MODE')) {
die('Access denied.');
}
// Register backend modules, but not in frontend or within upgrade wizards
// Register backend modules, but not in frontend or within upgrade wizards
if (TYPO3_MODE === 'BE' && !(TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_INSTALL)) {
// Module Web->Info->Log
\TYPO3\CMS\Core\Extension\ExtensionManager::insertModuleFunction('web_info', 'TYPO3\\CMS\\Belog\\Module\\BackendLogModuleBootstrap', \TYPO3\CMS\Core\Extension\ExtensionManager::extPath($_EXTKEY) . 'Classes/class.tx_belog_webinfo_bootstrap.php', 'Log');
// Module Tools->Log
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule($_EXTKEY, 'tools', 'log', '', array(
'Tools' => 'index',
'WebInfo' => 'index'
), array(
'access' => 'admin',
'icon' => 'EXT:belog/ext_icon.gif',
'labels' => ('LLL:EXT:' . $_EXTKEY) . '/Resources/Private/Language/locallang_mod.xlf'
));
// Module Web->Info->Log
\TYPO3\CMS\Core\Extension\ExtensionManager::insertModuleFunction(
'web_info',
'TYPO3\\CMS\\Belog\\Module\\BackendLogModuleBootstrap',
\TYPO3\CMS\Core\Extension\ExtensionManager::extPath($_EXTKEY) . 'Classes/Module/BackendLogModuleBootstrap.php',
'Log'
);
// Module Tools->Log
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
'TYPO3.CMS.' . $_EXTKEY,
'tools',
'log',
'',
array(
'Tools' => 'index',
'WebInfo' => 'index',
),
array(
'access' => 'admin',
'icon' => 'EXT:belog/ext_icon.gif',
'labels' => ('LLL:EXT:' . $_EXTKEY) . '/Resources/Private/Language/locallang_mod.xlf',
)
);
}
?>
\ No newline at end of file
......@@ -25,6 +25,9 @@
<testsuite name="Core legacy tests">
<directory>../../../../typo3/sysext/core/Tests/Legacy/</directory>
</testsuite>
<testsuite name="EXT:belog tests">
<directory>../../../../typo3/sysext/belog/Tests/Unit/</directory>
</testsuite>
<testsuite name="EXT:beuser tests">
<directory>../../../../typo3/sysext/beuser/Tests/Unit/</directory>
</testsuite>
......
......@@ -139,31 +139,6 @@ return array(
'TYPO3Logo' => 'TYPO3\\CMS\\Backend\\Views\\LogoView',
'cms_newContentElementWizardsHook' => 'TYPO3\\CMS\\Backend\\Wizard\\NewContentElementWizardHookInterface',
'SC_wizard_tsconfig' => 'TYPO3\\CMS\\Backend\\Wizard\\TsconfigWizard',
'Tx_Belog_Controller_AbstractController' => 'TYPO3\\CMS\\Belog\\Controller\\AbstractController',
'Tx_Belog_Controller_ToolsController' => 'TYPO3\\CMS\\Belog\\Controller\\ToolsController',
'Tx_Belog_Controller_WebInfoController' => 'TYPO3\\CMS\\Belog\\Controller\\WebInfoController',
'Tx_Belog_Domain_Model_Constraint' => 'TYPO3\\CMS\\Belog\\Domain\\Model\\Constraint',
'Tx_Belog_Domain_Model_HistoryEntry' => 'TYPO3\\CMS\\Belog\\Domain\\Model\\HistoryEntry',
'Tx_Belog_Domain_Model_LogEntry' => 'TYPO3\\CMS\\Belog\\Domain\\Model\\LogEntry',
'Tx_Belog_Domain_Model_Workspace' => 'TYPO3\\CMS\\Belog\\Domain\\Model\\Workspace',
'Tx_Belog_Domain_Repository_HistoryEntryRepository' => 'TYPO3\\CMS\\Belog\\Domain\\Repository\\HistoryEntryRepository',
'Tx_Belog_Domain_Repository_LogEntryRepository' => 'TYPO3\\CMS\\Belog\\Domain\\Repository\\LogEntryRepository',
'Tx_Belog_Domain_Repository_WorkspaceRepository' => 'TYPO3\\CMS\\Belog\\Domain\\Repository\\WorkspaceRepository',
'tx_belog_WebInfo_Bootstrap' => 'TYPO3\\CMS\\Belog\\Module\\BackendLogModuleBootstrap',
'Tx_Belog_Domain_Repository_HistoryEntryRepositoryTest' => 'TYPO3\\CMS\\Belog\\Tests\\Unit\\Domain\\Repository\\HistoryEntryRepositoryTest',
'Tx_Belog_Domain_Repository_LogEntryRepositoryTest' => 'TYPO3\\CMS\\Belog\\Tests\\Unit\\Domain\\Repository\\LogEntryRepositoryTest',
'Tx_Belog_Domain_Repository_LogEntryTest' => 'TYPO3\\CMS\\Belog\\Tests\\Unit\\Domain\\Repository\\LogEntryTest',
'Tx_Belog_Domain_Repository_WorkspaceRepositoryTest' => 'TYPO3\\CMS\\Belog\\Tests\\Unit\\Domain\\Repository\\WorkspaceRepositoryTest',
'Tx_Belog_ViewHelpers_Be_AddJsFileViewHelper' => 'TYPO3\\CMS\\Belog\\ViewHelpers\\Be\\AddJsFileViewHelper',
'Tx_Belog_ViewHelpers_Be_InlineSettingsArrayViewHelper' => 'TYPO3\\CMS\\Belog\\ViewHelpers\\Be\\InlineSettingsArrayViewHelper',
'Tx_Belog_ViewHelpers_Be_PagePathViewHelper' => 'TYPO3\\CMS\\Belog\\ViewHelpers\\Be\\PagePathViewHelper',
'Tx_Belog_ViewHelpers_ErrorIconViewHelper' => 'TYPO3\\CMS\\Belog\\ViewHelpers\\ErrorIconViewHelper',
'Tx_Belog_ViewHelpers_Form_TranslateLabelSelectViewHelper' => 'TYPO3\\CMS\\Belog\\ViewHelpers\\Form\\TranslateLabelSelectViewHelper',
'Tx_Belog_ViewHelpers_FormatDetailsViewHelper' => 'TYPO3\\CMS\\Belog\\ViewHelpers\\FormatDetailsViewHelper',
'Tx_Belog_ViewHelpers_HistoryEntryViewHelper' => 'TYPO3\\CMS\\Belog\\ViewHelpers\\HistoryEntryViewHelper',
'Tx_Belog_ViewHelpers_IsExtensionLoadedViewHelper' => 'TYPO3\\CMS\\Belog\\ViewHelpers\\IsExtensionLoadedViewHelper',
'Tx_Belog_ViewHelpers_UsernameViewHelper' => 'TYPO3\\CMS\\Belog\\ViewHelpers\\UsernameViewHelper',
'Tx_Belog_ViewHelpers_WorkspaceTitleViewHelper' => 'TYPO3\\CMS\\Belog\\ViewHelpers\\WorkspaceTitleViewHelper',
'Tx_Beuser_Controller_BackendUserController' => 'TYPO3\\CMS\\Beuser\\Controller\\BackendUserController',
'Tx_Beuser_Domain_Model_BackendUser' => 'TYPO3\\CMS\\Beuser\\Domain\\Model\\BackendUser',
'Tx_Beuser_Domain_Model_BackendUserGroup' => 'TYPO3\\CMS\\Beuser\\Domain\\Model\\BackendUserGroup',
......
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