Skip to content

Commit 8aa7177

Browse files
committed
Added separate tracy logger extension
1 parent 42b3a3d commit 8aa7177

File tree

3 files changed

+34
-12
lines changed

3 files changed

+34
-12
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
namespace Arachne\Codeception\Tracy;
4+
5+
use Codeception\Events;
6+
use Codeception\Event\FailEvent;
7+
use Codeception\Platform\Extension;
8+
use Tracy\Debugger;
9+
10+
class Logger extends Extension
11+
{
12+
13+
static $events = [
14+
Events::TEST_FAIL => 'testFail',
15+
Events::TEST_ERROR => 'testError',
16+
];
17+
18+
public function __construct()
19+
{
20+
Debugger::$logDirectory = $this->getLogDir();
21+
}
22+
23+
public function testFail(FailEvent $e)
24+
{
25+
Debugger::log($e->getFail());
26+
}
27+
28+
public function testError(FailEvent $e)
29+
{
30+
Debugger::log($e->getFail());
31+
}
32+
33+
}

src/Arachne/Codeception/Util/Connector/Nette.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Arachne\Codeception\Util\Connector;
44

55
use Nette\DI\Container;
6-
use Nette\Diagnostics\Debugger;
76
use Nette\Environment;
87
use Nette\Http\IResponse;
98
use Symfony\Component\BrowserKit\Client;
@@ -50,13 +49,7 @@ public function doRequest($request)
5049
$httpResponse->setCode(IResponse::S200_OK);
5150

5251
ob_start();
53-
try {
54-
$this->container->getByType('Nette\Application\Application')->run();
55-
} catch (\Exception $e) {
56-
ob_end_clean();
57-
Debugger::log($e);
58-
throw $e;
59-
}
52+
$this->container->getByType('Nette\Application\Application')->run();
6053
$content = ob_get_clean();
6154

6255
$code = $httpResponse->getCode();

src/Codeception/Module/Nette.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
use Nette\Configurator;
99
use Nette\DI\Container;
1010
use Nette\DI\MissingServiceException;
11-
use Nette\Diagnostics\Debugger;
1211
use Nette\InvalidStateException;
13-
use Nette\Loaders\RobotLoader;
1412
use Nette\Utils\Validators;
1513
use RecursiveDirectoryIterator;
1614
use RecursiveIteratorIterator;
@@ -47,7 +45,6 @@ protected function validateConfig()
4745
Validators::assertField($this->config, 'configFiles', 'array');
4846
}
4947

50-
// TODO: separate Tracy module (exceptions logging)
5148
// TODO: separate ArachneTools module (debugContent method)
5249
public function _beforeSuite($settings = array())
5350
{
@@ -56,7 +53,6 @@ public function _beforeSuite($settings = array())
5653
$this->detectSuiteName($settings);
5754
$path = pathinfo($settings['path'], PATHINFO_DIRNAME);
5855
$tempDir = $path . DIRECTORY_SEPARATOR . '_temp' . DIRECTORY_SEPARATOR . $this->suite;
59-
Debugger::$logDirectory = $path . DIRECTORY_SEPARATOR . '_log';
6056

6157
self::purge($tempDir);
6258
$this->configurator = new Configurator();

0 commit comments

Comments
 (0)