From 18ff11d26e87d1937e2fa32469791063e1e3fe67 Mon Sep 17 00:00:00 2001
From: Matthieu Napoli <matthieu@mnapoli.fr>
Date: Thu, 15 Jan 2015 11:58:17 +1300
Subject: [PATCH] Move test classes into namespace

---
 .../Integration/Log/Fixture/LoggerWrapper.php} |  4 ++--
 tests/PHPUnit/Integration/Log/LogTest.php      | 18 ++++++++++--------
 2 files changed, 12 insertions(+), 10 deletions(-)
 rename tests/{resources/TestPluginLogClass.php => PHPUnit/Integration/Log/Fixture/LoggerWrapper.php} (79%)

diff --git a/tests/resources/TestPluginLogClass.php b/tests/PHPUnit/Integration/Log/Fixture/LoggerWrapper.php
similarity index 79%
rename from tests/resources/TestPluginLogClass.php
rename to tests/PHPUnit/Integration/Log/Fixture/LoggerWrapper.php
index 3a95fe0cfb..07b8a04d20 100644
--- a/tests/resources/TestPluginLogClass.php
+++ b/tests/PHPUnit/Integration/Log/Fixture/LoggerWrapper.php
@@ -6,11 +6,11 @@
  * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
  */
 
-namespace Piwik\Plugins\TestPlugin;
+namespace Piwik\Tests\Integration\Log\Fixture;
 
 use Piwik\Log;
 
-class TestLoggingUtility
+class LoggerWrapper
 {
     public static function doLog($message)
     {
diff --git a/tests/PHPUnit/Integration/Log/LogTest.php b/tests/PHPUnit/Integration/Log/LogTest.php
index a3dbee3178..8fb10599d8 100644
--- a/tests/PHPUnit/Integration/Log/LogTest.php
+++ b/tests/PHPUnit/Integration/Log/LogTest.php
@@ -15,10 +15,8 @@ use Piwik\Container\ContainerFactory;
 use Piwik\Container\StaticContainer;
 use Piwik\Db;
 use Piwik\Log;
-use Piwik\Plugins\TestPlugin\TestLoggingUtility;
 use Piwik\Tests\Framework\TestCase\IntegrationTestCase;
-
-require_once PIWIK_INCLUDE_PATH . '/tests/resources/TestPluginLogClass.php';
+use Piwik\Tests\Integration\Log\Fixture\LoggerWrapper;
 
 /**
  * @group Core
@@ -30,7 +28,7 @@ class LogTest extends IntegrationTestCase
     const STRING_MESSAGE_FORMAT = '[%tag%] %message%';
     const STRING_MESSAGE_FORMAT_SPRINTF = "[%s] %s";
 
-    public static $expectedExceptionOutput = '[Piwik\Tests\Integration\Log\LogTest] LogTest.php(122): dummy error message
+    public static $expectedExceptionOutput = '[Piwik\Tests\Integration\Log\LogTest] LogTest.php(120): dummy error message
   dummy backtrace';
 
     public static $expectedErrorOutput = '[Piwik\Tests\Integration\Log\LogTest] dummyerrorfile.php(145): Unknown error (102) - dummy error string
@@ -132,9 +130,11 @@ class LogTest extends IntegrationTestCase
     {
         Config::getInstance()->log['log_writers'] = array($backend);
 
-        TestLoggingUtility::doLog(self::TESTMESSAGE);
+        LoggerWrapper::doLog(self::TESTMESSAGE);
+
+        $tag = 'Piwik\Tests\Integration\Log\Fixture\LoggerWrapper';
 
-        $this->checkBackend($backend, self::TESTMESSAGE, $formatMessage = true, $tag = 'TestPlugin');
+        $this->checkBackend($backend, self::TESTMESSAGE, $formatMessage = true, $tag);
     }
 
     /**
@@ -157,9 +157,11 @@ class LogTest extends IntegrationTestCase
     {
         Config::getInstance()->log['log_writers'] = array($backend);
 
-        TestLoggingUtility::doLog(" \n   ".self::TESTMESSAGE."\n\n\n   \n");
+        LoggerWrapper::doLog(" \n   ".self::TESTMESSAGE."\n\n\n   \n");
+
+        $tag = 'Piwik\Tests\Integration\Log\Fixture\LoggerWrapper';
 
-        $this->checkBackend($backend, self::TESTMESSAGE, $formatMessage = true, $tag = 'TestPlugin');
+        $this->checkBackend($backend, self::TESTMESSAGE, $formatMessage = true, $tag);
     }
 
     private function checkBackend($backend, $expectedMessage, $formatMessage = false, $tag = false)
-- 
GitLab