Refactored DependencyFactory for Profiler
This commit is contained in:
parent
cdcf1667d7
commit
5e5c39b0e1
12 changed files with 65 additions and 47 deletions
|
@ -39,13 +39,12 @@ class ApiTest extends DatabaseTest
|
|||
$basedir = BasePath::create(dirname(__DIR__) . '/../');
|
||||
$configLoader = new Cache\ConfigCacheLoader($basedir);
|
||||
$configCache = Factory\ConfigFactory::createCache($configLoader);
|
||||
Factory\DBFactory::init($configCache, $_SERVER);
|
||||
$profiler = Factory\ProfilerFactory::create($configCache);
|
||||
Factory\DBFactory::init($configCache, $profiler, $_SERVER);
|
||||
$config = Factory\ConfigFactory::createConfig($configCache);
|
||||
Factory\ConfigFactory::createPConfig($configCache);
|
||||
$logger = Factory\LoggerFactory::create('test', $config);
|
||||
$profiler = Factory\ProfilerFactory::create($logger, $config);
|
||||
$this->app = new App($config, $logger, $profiler, false);
|
||||
$this->logOutput = FActory\LoggerFactory::enableTest($this->app->getLogger());
|
||||
|
||||
parent::setUp();
|
||||
|
||||
|
|
|
@ -16,13 +16,12 @@ class DBATest extends DatabaseTest
|
|||
$basedir = BasePath::create(dirname(__DIR__) . '/../../');
|
||||
$configLoader = new Cache\ConfigCacheLoader($basedir);
|
||||
$configCache = Factory\ConfigFactory::createCache($configLoader);
|
||||
Factory\DBFactory::init($configCache, $_SERVER);
|
||||
$profiler = Factory\ProfilerFactory::create($configCache);
|
||||
Factory\DBFactory::init($configCache, $profiler, $_SERVER);
|
||||
$config = Factory\ConfigFactory::createConfig($configCache);
|
||||
$pconfig = Factory\ConfigFactory::createPConfig($configCache);
|
||||
Factory\ConfigFactory::createPConfig($configCache);
|
||||
$logger = Factory\LoggerFactory::create('test', $config);
|
||||
$profiler = Factory\ProfilerFactory::create($logger, $config);
|
||||
$this->app = new App($config, $logger, $profiler, false);
|
||||
$this->logOutput = FActory\LoggerFactory::enableTest($this->app->getLogger());
|
||||
|
||||
parent::setUp();
|
||||
|
||||
|
|
|
@ -16,13 +16,12 @@ class DBStructureTest extends DatabaseTest
|
|||
$basedir = BasePath::create(dirname(__DIR__) . '/../../');
|
||||
$configLoader = new Cache\ConfigCacheLoader($basedir);
|
||||
$configCache = Factory\ConfigFactory::createCache($configLoader);
|
||||
Factory\DBFactory::init($configCache, $_SERVER);
|
||||
$profiler = Factory\ProfilerFactory::create($configCache);
|
||||
Factory\DBFactory::init($configCache, $profiler, $_SERVER);
|
||||
$config = Factory\ConfigFactory::createConfig($configCache);
|
||||
$pconfig = Factory\ConfigFactory::createPConfig($configCache);
|
||||
Factory\ConfigFactory::createPConfig($configCache);
|
||||
$logger = Factory\LoggerFactory::create('test', $config);
|
||||
$profiler = Factory\ProfilerFactory::create($logger, $config);
|
||||
$this->app = new App($config, $logger, $profiler, false);
|
||||
$this->logOutput = FActory\LoggerFactory::enableTest($this->app->getLogger());
|
||||
|
||||
parent::setUp();
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ class ProfilerTest extends MockedTest
|
|||
*/
|
||||
public function testSetUp()
|
||||
{
|
||||
$profiler = new Profiler($this->logger, true, true);
|
||||
$profiler = new Profiler(true, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -96,7 +96,7 @@ class ProfilerTest extends MockedTest
|
|||
*/
|
||||
public function testSaveTimestamp($timestamp, $name, array $functions)
|
||||
{
|
||||
$profiler = new Profiler($this->logger, true, true);
|
||||
$profiler = new Profiler(true, true);
|
||||
|
||||
foreach ($functions as $function) {
|
||||
$profiler->saveTimestamp($timestamp, $name, $function);
|
||||
|
@ -111,7 +111,7 @@ class ProfilerTest extends MockedTest
|
|||
*/
|
||||
public function testReset($timestamp, $name, array $functions)
|
||||
{
|
||||
$profiler = new Profiler($this->logger, true, true);
|
||||
$profiler = new Profiler(true, true);
|
||||
|
||||
$profiler->saveTimestamp($timestamp, $name);
|
||||
$profiler->reset();
|
||||
|
@ -168,7 +168,7 @@ class ProfilerTest extends MockedTest
|
|||
->shouldReceive('info')
|
||||
->once();
|
||||
|
||||
$profiler = new Profiler($this->logger, true, true);
|
||||
$profiler = new Profiler(true, true);
|
||||
|
||||
foreach ($data as $perf => $items) {
|
||||
foreach ($items['functions'] as $function) {
|
||||
|
@ -176,6 +176,6 @@ class ProfilerTest extends MockedTest
|
|||
}
|
||||
}
|
||||
|
||||
$profiler->saveLog('test');
|
||||
$profiler->saveLog($this->logger, 'test');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue