Skip to content

Commit

Permalink
Do not derive from Singleton in Config (since the object is now in DI).
Browse files Browse the repository at this point in the history
  • Loading branch information
diosmosis committed May 24, 2015
1 parent 38a51b0 commit 96dffbc
Show file tree
Hide file tree
Showing 11 changed files with 2 additions and 28 deletions.
1 change: 0 additions & 1 deletion core/CliMulti/RequestCommand.php
Expand Up @@ -49,7 +49,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
$this->initHostAndQueryString($input);

if ($this->isTestModeEnabled()) {
Config::setSingletonInstance(new TestConfig());
$indexFile = '/tests/PHPUnit/proxy/';

$this->resetDatabase();
Expand Down
2 changes: 1 addition & 1 deletion core/Config.php
Expand Up @@ -38,7 +38,7 @@
* Config::getInstance()->MySection = array('myoption' => 1);
* Config::getInstance()->forceSave();
*/
class Config extends Singleton
class Config
{
const DEFAULT_LOCAL_CONFIG_PATH = '/config/config.ini.php';
const DEFAULT_COMMON_CONFIG_PATH = '/config/common.config.ini.php';
Expand Down
3 changes: 1 addition & 2 deletions tests/PHPUnit/Integration/Tracker/ActionTest.php
Expand Up @@ -12,7 +12,6 @@
use Piwik\Config;
use Piwik\Plugins\SitesManager\API;
use Piwik\Tests\Framework\Mock\FakeAccess;
use Piwik\Tests\Framework\Mock\TestConfig;
use Piwik\Tracker\Action;
use Piwik\Tracker\PageUrl;
use Piwik\Tracker\Request;
Expand All @@ -29,7 +28,7 @@ class ActionTest extends IntegrationTestCase
public function setUp()
{
parent::setUp();
Config::setSingletonInstance(new TestConfig());

$section = Config::getInstance()->Tracker;
$section['default_action_url'] = '/';
$section['campaign_var_name'] = 'campaign_param_name,piwik_campaign,utm_campaign,test_campaign_name';
Expand Down
5 changes: 0 additions & 5 deletions tests/PHPUnit/Integration/TrackerTest.php
Expand Up @@ -8,7 +8,6 @@

namespace Piwik\Tests\Integration;

use Piwik\Application\Kernel\GlobalSettingsProvider;
use Piwik\Common;
use Piwik\Config;
use Piwik\EventDispatcher;
Expand Down Expand Up @@ -59,8 +58,6 @@ public function setUp()
{
parent::setUp();

Config::unsetInstance();

Fixture::createWebsite('2014-01-01 00:00:00');

$this->tracker = new TestTracker();
Expand Down Expand Up @@ -152,8 +149,6 @@ public function test_loadTrackerEnvironment_shouldNotThrow_whenConfigNotFound()

$this->assertFalse(is_readable(Config::getInstance()->getLocalPath()));

Config::unsetInstance();

Tracker::loadTrackerEnvironment();

$this->assertTrue(SettingsServer::isTrackerApiRequest());
Expand Down
2 changes: 0 additions & 2 deletions tests/PHPUnit/System/BlobReportLimitingTest.php
Expand Up @@ -174,8 +174,6 @@ public static function getOutputPrefix()

protected static function setUpConfigOptions()
{
Config::setSingletonInstance(new TestConfig());

$generalConfig =& Config::getInstance()->General;
$generalConfig['datatable_archiving_maximum_rows_referers'] = 3;
$generalConfig['datatable_archiving_maximum_rows_subtable_referers'] = 2;
Expand Down
2 changes: 0 additions & 2 deletions tests/PHPUnit/Unit/AssetManagerTest.php
Expand Up @@ -117,8 +117,6 @@ private function setUpConfig($filename)
$userFile = PIWIK_INCLUDE_PATH . '/' . self::ASSET_MANAGER_TEST_DIR . 'configs/' . $filename;
$globalFile = PIWIK_INCLUDE_PATH . '/' . self::ASSET_MANAGER_TEST_DIR . 'configs/plugins.ini.php';

Config::setSingletonInstance(new TestConfig($globalFile, $userFile));

$this->initEnvironment();
}

Expand Down
8 changes: 0 additions & 8 deletions tests/PHPUnit/Unit/Columns/DimensionTest.php
Expand Up @@ -67,20 +67,12 @@ public function setUp()
{
parent::setUp();

Config::unsetInstance();

Manager::getInstance()->unloadPlugins();
Manager::getInstance()->doNotLoadAlwaysActivatedPlugins();

$this->dimension = new DimensionTest();
}

public function tearDown()
{
Config::unsetInstance();
parent::tearDown();
}

public function test_hasImplementedEvent_shouldDetectWhetherAMethodWasOverwrittenInTheActualPluginClass()
{
$this->assertTrue($this->dimension->hasImplementedEvent('set'));
Expand Down
3 changes: 0 additions & 3 deletions tests/PHPUnit/Unit/DataTable/Filter/PivotByDimensionTest.php
Expand Up @@ -14,7 +14,6 @@
use Piwik\DataTable\Row;
use Piwik\Plugin\Manager as PluginManager;
use Exception;
use Piwik\Tests\Framework\Mock\TestConfig;
use Piwik\Tests\Framework\TestCase\UnitTestCase;

/**
Expand Down Expand Up @@ -59,8 +58,6 @@ public function setUp()
Proxy::setSingletonInstance($proxyMock);

$this->segmentTableCount = 0;

Config::setSingletonInstance(new TestConfig());
}

public function tearDown()
Expand Down
1 change: 0 additions & 1 deletion tests/PHPUnit/Unit/DataTable/MapTest.php
Expand Up @@ -16,7 +16,6 @@ class Test_DataTable_Map extends \PHPUnit_Framework_TestCase
public function setUp()
{
parent::setUp();
Config::setSingletonInstance(new TestConfig());
Manager::getInstance()->deleteAll();
}

Expand Down
2 changes: 0 additions & 2 deletions tests/PHPUnit/Unit/IPTest.php
Expand Up @@ -87,8 +87,6 @@ public function getIpFromHeaderTestData()
*/
public function testGetIpFromHeader($description, $test)
{
Config::setSingletonInstance(new TestConfig());

$_SERVER['REMOTE_ADDR'] = $test[0];
$_SERVER['HTTP_X_FORWARDED_FOR'] = $test[1];
Config::getInstance()->General['proxy_client_headers'] = array($test[2]);
Expand Down
1 change: 0 additions & 1 deletion tests/PHPUnit/Unit/Plugin/ComponentFactoryTest.php
Expand Up @@ -25,7 +25,6 @@ public function setUp()
{
parent::setUp();

Config::setSingletonInstance(new TestConfig());
Config::getInstance()->Plugins['Plugins'] = array();

$this->unloadAllPlugins();
Expand Down

0 comments on commit 96dffbc

Please sign in to comment.