Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: tlayh/Xliff-Translationtool
base: bf1d313920
...
head fork: tlayh/Xliff-Translationtool
compare: 033f925564
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
View
48 Classes/Utility/AjaxResponse.php
@@ -1,48 +0,0 @@
-<?php
-/***************************************************************
- * Copyright notice
- *
- * (c) 2011 domainfactory GmbH (Stefan Galinski <sgalinski@df.eu>)
- *
- * 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 3 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!
- ***************************************************************/
-
-/**
- * Response class for Ext.Direct / Ajax calls
- *
- * @see EXT:df_tools
- * @author Stefan Galinski <sgalinski@df.eu>
- */
-class Tx_XliffTranslationtool_Utility_AjaxResponse extends Tx_Extbase_MVC_Web_Response {
- /**
- * Appends content to the already existing content.
- *
- * @param mixed $content
- * @return void
- */
- public function appendContent($content) {
- if (is_array($content)) {
- $this->setContent($content);
- } else {
- $this->content .= $content;
- }
- }
-}
-
-?>
View
128 Classes/Utility/ExtbaseConnector.php
@@ -1,128 +0,0 @@
-<?php
-
-/**
- * Utility class to simplify the execution of extbase actions from external sources (e.g. from Ext.Direct)
- *
- * @author Stefan Galinski <sgalinski@df.eu>
- * @coauthor Tolleiv Nietsch <tolleiv.nietsch@aoemedia.de>
- * @see https://svn.typo3.org/TYPO3v4/Extensions/df_tools
- * @package df_tools
- */
-class Tx_XliffTranslationtool_Utility_ExbaseConnector implements t3lib_Singleton {
- /**
- * Extension Key
- *
- * @var string
- */
- protected $extensionKey = 'xliff_translationtool';
-
- /**
- * Module Key
- *
- * @var string
- */
- protected $moduleOrPluginKey = 'tools_XliffTranslationtoolTranslation';
-
- /**
- * ExtBase Bootstrap Instance
- *
- * @var Tx_Extbase_Core_Bootstrap
- */
- protected $bootStrap = NULL;
-
- /**
- * Initializes the instance
- */
- public function __construct() {
- /** @var $bootStrap Tx_Extbase_Core_Bootstrap */
- $bootStrap = t3lib_div::makeInstance('Tx_Extbase_Core_Bootstrap');
- $this->injectBootstrap($bootStrap);
- }
-
- /**
- * Initialize the bootstrap
- *
- * @param Tx_Extbase_Core_Bootstrap $bootStrap
- * @return void
- */
- public function injectBootStrap(Tx_Extbase_Core_Bootstrap $bootStrap) {
- $this->bootStrap = $bootStrap;
- }
-
- /**
- * Setter for the extension key
- *
- * @param string $extensionKey
- * @return void
- */
- public function setExtensionKey($extensionKey) {
- $this->extensionKey = $extensionKey;
- }
-
- /**
- * Getter for the extension key
- *
- * @return string
- */
- public function getExtensionKey() {
- return $this->extensionKey;
- }
-
- /**
- * Setter for the module or plugin key
- *
- * @param string $moduleOrPluginKey
- * @return void
- */
- public function setModuleOrPluginKey($moduleOrPluginKey) {
- $this->moduleOrPluginKey = $moduleOrPluginKey;
- }
-
- /**
- * Getter for the module or plugin key
- *
- * @return string
- */
- public function getModuleOrPluginKey() {
- return $this->moduleOrPluginKey;
- }
-
- /**
- * Sets the parameters for the configured module/plugin
- *
- * @param array $parameters
- * @return void
- */
- public function setParameters(array $parameters) {
- $parameterNamespace = Tx_Extbase_Utility_Extension::getPluginNamespace(
- $this->extensionKey,
- $this->moduleOrPluginKey
- );
-
- $_POST[$parameterNamespace] = $parameters;
- }
-
- /**
- * Runs the given ExtBase configuration and returns the result
- *
- * @param string $controller
- * @param string $action
- * @throws InvalidArgumentException
- * @return array
- */
- public function runControllerAction($controller, $action) {
- if ($controller === '' || $action === '') {
- throw new InvalidArgumentException('ExtDirect (XliffTranslationtool): Invalid Controller/Action Combination!');
- }
- $response = $this->bootStrap->run('', array(
- 'extensionName' => $this->extensionKey,
- 'pluginName' => $this->moduleOrPluginKey,
- 'switchableControllerActions' => array(
- $controller => array($action)
- ),
- ));
- return $response;
- }
-}
-
-?>
View
44 Tests/Unit/Utility/XliffFileFunctionsTest.php
@@ -0,0 +1,44 @@
+<?php
+/**
+ * XliffFileFunctionsTests
+ * @author Thomas Layh <develop@layh.com>
+ */
+class Tx_XliffTranslationtool_Utility_XliffFileFunctionsTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
+
+ /**
+ * @var Tx_XliffTranslationtool_Utility_XliffFileFunctions
+ */
+ protected $xliffFileFunctions;
+
+ public function setUp() {
+ $this->xliffFileFunctions = new Tx_XliffTranslationtool_Utility_XliffFileFunctions();
+ }
+
+
+ /**
+ * @dataProvider fileNameDataProvider
+ * @test
+ */
+ public function removeExistingLanguageKeyFromFileTarget($fileName, $expectedFileName) {
+ $method = new ReflectionMethod(
+ 'Tx_XliffTranslationtool_Utility_XliffFileFunctions', 'removeExistingLanguageKeyFromFileTarget'
+ );
+ $method->setAccessible(TRUE);
+ $this->assertEquals($method->invoke($this->xliffFileFunctions, $fileName), $expectedFileName);
+
+ }
+
+ public function fileNameDataProvider() {
+ return array(
+ 'localized file name' => array(
+ 'de.locallang.xlf',
+ 'locallang.xlf'
+ ),
+ 'normal file name' => array(
+ 'locallang_db.xlf',
+ 'locallang_db.xlf'
+ )
+ );
+ }
+
+}

No commit comments for this range

Something went wrong with that request. Please try again.