From 77acc2cd4eebb14260384016a04089f80cdf032c Mon Sep 17 00:00:00 2001
From: Thomas Steur <thomas.steur@gmail.com>
Date: Sun, 1 Feb 2015 03:32:09 +0000
Subject: [PATCH] do not append Test to the test name when generating a UI test
 as the testname is needed to run the test and it would be not intuitive if we
 modify that name

---
 plugins/CoreConsole/Commands/GenerateTest.php | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/plugins/CoreConsole/Commands/GenerateTest.php b/plugins/CoreConsole/Commands/GenerateTest.php
index 7c46aeaa9b..fa2d391bf8 100644
--- a/plugins/CoreConsole/Commands/GenerateTest.php
+++ b/plugins/CoreConsole/Commands/GenerateTest.php
@@ -30,8 +30,8 @@ class GenerateTest extends GeneratePluginBase
     protected function execute(InputInterface $input, OutputInterface $output)
     {
         $pluginName = $this->getPluginName($input, $output);
-        $testName   = $this->getTestName($input, $output);
         $testType   = $this->getTestType($input, $output);
+        $testName   = $this->getTestName($input, $output, $testType);
 
         $exampleFolder = PIWIK_INCLUDE_PATH . '/plugins/ExamplePlugin';
         $replace       = array(
@@ -60,7 +60,7 @@ class GenerateTest extends GeneratePluginBase
         }
 
         $messages[] = 'Enjoy!';
-        
+
         $this->writeSuccessMessage($output, $messages);
     }
 
@@ -70,7 +70,7 @@ class GenerateTest extends GeneratePluginBase
      * @return string
      * @throws \RuntimeException
      */
-    private function getTestName(InputInterface $input, OutputInterface $output)
+    private function getTestName(InputInterface $input, OutputInterface $output, $testType)
     {
         $testname = $input->getOption('testname');
 
@@ -89,7 +89,7 @@ class GenerateTest extends GeneratePluginBase
             $validate($testname);
         }
 
-        if (!Common::stringEndsWith(strtolower($testname), 'test')) {
+        if (strtolower($testType) !== 'ui' && !Common::stringEndsWith(strtolower($testname), 'test')) {
             $testname = $testname . 'Test';
         }
 
-- 
GitLab