Skip to content

Commit

Permalink
Implemented 1. and 2. of goaop#340
Browse files Browse the repository at this point in the history
  • Loading branch information
TheCelavi committed Aug 15, 2017
1 parent 49ccd3e commit eb3b72f
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Go\Tests\TestProject;
namespace Go\Tests\TestProject\Kernel;

use Go\Core\AspectContainer;
use Go\Core\AspectKernel;
Expand All @@ -9,7 +9,7 @@
use Go\Tests\TestProject\Aspect\LoggingAspect;
use Psr\Log\NullLogger;

class ApplicationAspectKernel extends AspectKernel
class DefaultAspectKernel extends AspectKernel
{
/**
* Configure an AspectContainer with advisors, aspects and pointcuts
Expand Down
14 changes: 14 additions & 0 deletions tests/Fixtures/project/web/configuration.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

return array(

'default' => array(
'kernel' => \Go\Tests\TestProject\Kernel\DefaultAspectKernel::class,
'appDir' => __DIR__ . '/../',
'debug' => true,
'cacheDir' => __DIR__ . '/../var/cache/aspect',
'includePaths' => array(
__DIR__ . '/../src/'
)
),
);
14 changes: 4 additions & 10 deletions tests/Fixtures/project/web/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,8 @@

include_once __DIR__ . '/../../../../vendor/autoload.php';

use Go\Tests\TestProject\ApplicationAspectKernel;
$configuration = ($env = getenv('GO_AOP_CONFIGURATION')) ? $env : 'default' ;
$settings = require __DIR__.'/configuration.php';

$applicationAspectKernel = ApplicationAspectKernel::getInstance();
$applicationAspectKernel->init(array(
'appDir' => __DIR__ . '/../',
'debug' => true,
'cacheDir' => __DIR__ . '/../var/cache/aspect',
'includePaths' => array(
__DIR__ . '/../src/'
)
));
$applicationAspectKernel = $settings[$configuration]['kernel']::getInstance();
$applicationAspectKernel->init($settings[$configuration]);
2 changes: 1 addition & 1 deletion tests/Go/Console/Command/DebugAspectCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function testItDisplaysAspectsDebugInfo()
$output = self::exec('debug:aspect');

$expected = [
'Go\Tests\TestProject\ApplicationAspectKernel has following enabled aspects',
'Go\Tests\TestProject\Kernel\DefaultAspectKernel has following enabled aspects',
'Go\Tests\TestProject\Aspect\LoggingAspect',
'Go\Tests\TestProject\Aspect\LoggingAspect->beforeMethod'
];
Expand Down
13 changes: 8 additions & 5 deletions tests/Go/Functional/BaseFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,17 @@ protected static function clearCache()
}
}

protected static function warmUp()
protected static function warmUp($configuration = null)
{
return self::exec('cache:warmup:aop');
return self::exec('cache:warmup:aop', '', $configuration);
}

protected static function exec($command, $args = '')
protected static function exec($command, $args = '', $configuration = null)
{
$commandStatement = sprintf('php %s %s %s %s',
$configuration = ($configuration) ? sprintf('GO_AOP_CONFIGURATION=%s ', $configuration) : '';

$commandStatement = sprintf('%sphp %s %s %s %s',
$configuration,
self::$consolePath,
$command,
self::$frontControllerPath,
Expand All @@ -40,7 +43,7 @@ protected static function exec($command, $args = '')

$process->run();

self::assertTrue($process->isSuccessful(), sprintf('Unable to execute "%s" command.', $command));
self::assertTrue($process->isSuccessful(), sprintf('Unable to execute "%s" command, got output: "%s".', $command, $process->getOutput()));

return $process->getOutput();
}
Expand Down

0 comments on commit eb3b72f

Please sign in to comment.