Skip to content
This repository has been archived by the owner on Jun 18, 2020. It is now read-only.

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
brainexe committed Apr 6, 2016
1 parent fa7c532 commit 5357784
Show file tree
Hide file tree
Showing 35 changed files with 337 additions and 539 deletions.
5 changes: 2 additions & 3 deletions Tests/BrainExe/Core/Application/AppKernelTest.php
Expand Up @@ -56,10 +56,9 @@ public function setUp()
$this->subject = new AppKernel(
$this->controllerResolver,
$this->routeCollection,
$this->urlMatcher
$this->urlMatcher,
[$this->middleWare]
);

$this->subject->setMiddlewares([$this->middleWare]);
}

public function testHandle()
Expand Down
Expand Up @@ -16,9 +16,7 @@ class SerializedRouteCollectionTest extends TestCase

public function setUp()
{
$this->subject = new SerializedRouteCollection([
'foo' => 'C:31:"Symfony\\Component\\Routing\\Route":348:{a:9:{s:4:"path";s:8:"/espeak/";s:4:"host";s:0:"";s:8:"defaults";a:1:{s:11:"_controller";a:2:{i:0;s:29:"__Controller.EspeakController";i:1;s:5:"index";}}s:12:"requirements";a:0:{}s:7:"options";a:1:{s:14:"compiler_class";s:39:"Symfony\\Component\\Routing\\RouteCompiler";}s:7:"schemes";a:0:{}s:7:"methods";a:0:{}s:9:"condition";s:0:"";s:8:"compiled";N;}}',
]);
$this->subject = new SerializedRouteCollection();
}

/**
Expand All @@ -34,7 +32,7 @@ public function testCount()
{
$actual = $this->subject->count();

$this->assertEquals(1, $actual);
$this->assertGreaterThan(0, $actual);
}

/**
Expand Down
Expand Up @@ -5,11 +5,11 @@
use BrainExe\Core\Annotations\Route;
use BrainExe\Core\DependencyInjection\CompilerPass\ControllerCompilerPass;
use PHPUnit_Framework_MockObject_MockObject as MockObject;
use PHPUnit_Framework_TestCase;
use PHPUnit_Framework_TestCase as TestCase;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;

class ControllerCompilerPassTest extends PHPUnit_Framework_TestCase
class ControllerCompilerPassTest extends TestCase
{

/**
Expand Down Expand Up @@ -54,18 +54,12 @@ public function testProcess()

$this->container
->expects($this->at(0))
->method('getDefinition')
->with('Core.RouteCollection')
->willReturn($this->routerDefinition);

$this->container
->expects($this->at(1))
->method('findTaggedServiceIds')
->with(ControllerCompilerPass::ROUTE_TAG)
->willReturn($serviceIds);

$this->container
->expects($this->at(2))
->expects($this->at(1))
->method('getDefinition')
->with($serviceId)
->willReturn($service);
Expand Down
@@ -1,6 +1,6 @@
<?php

namespace Tests\BrainExe\Core\DependencyInjection\CompilerPass\MiddlewareCompilerPass;
namespace Tests\BrainExe\Core\DependencyInjection\CompilerPass;

use BrainExe\Core\DependencyInjection\CompilerPass\MiddlewareCompilerPass;
use PHPUnit_Framework_MockObject_MockObject as MockObject;
Expand Down Expand Up @@ -31,6 +31,7 @@ public function setUp()
'getDefinition',
'setParameter',
'getParameter',
'addArgument'
]);
$this->subject = new MiddlewareCompilerPass();
}
Expand All @@ -55,8 +56,8 @@ public function testProcess()

$appKernel
->expects($this->once())
->method('addMethodCall')
->with('setMiddlewares', [[new Reference($serviceId1)]]);
->method('replaceArgument')
->with(3, [new Reference($serviceId1)]);

$this->container
->expects($this->once())
Expand Down
@@ -1,6 +1,6 @@
<?php

namespace Tests\BrainExe\Core\DependencyInjection\CompilerPass\RedisCompilerPass;
namespace Tests\BrainExe\Core\DependencyInjection\CompilerPass;

use BrainExe\Core\DependencyInjection\CompilerPass\RedisCompilerPass;
use PHPUnit_Framework_MockObject_MockObject as MockObject;
Expand Down
@@ -1,6 +1,6 @@
<?php

namespace Tests\BrainExe\Core\DependencyInjection\CompilerPass\RedisScriptCompilerPass;
namespace Tests\BrainExe\Core\DependencyInjection\CompilerPass;

use BrainExe\Core\DependencyInjection\CompilerPass\RedisScriptCompilerPass;
use BrainExe\Core\Redis\RedisScript;
Expand Down
45 changes: 0 additions & 45 deletions Tests/BrainExe/Core/DependencyInjection/ObjectFinderTest.php

This file was deleted.

28 changes: 17 additions & 11 deletions Tests/BrainExe/Core/Traits/ConfigTraitTest.php
Expand Up @@ -4,8 +4,9 @@

use BrainExe\Core\Traits\ConfigTrait;
use PHPUnit_Framework_MockObject_MockObject as MockObject;
use PHPUnit_Framework_TestCase;
use PHPUnit_Framework_TestCase as TestCase;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;

class ConfigTest
{
Expand All @@ -17,7 +18,7 @@ public function testGetParameter($key)
}
}

class ConfigTraitTest extends PHPUnit_Framework_TestCase
class ConfigTraitTest extends TestCase
{

/**
Expand All @@ -28,29 +29,34 @@ class ConfigTraitTest extends PHPUnit_Framework_TestCase
/**
* @var Container|MockObject
*/
private $mockContainer;
private $container;

public function setUp()
{
$this->mockContainer = $this->getMock(Container::class);

$this->subject = new ConfigTest();
$this->subject->setContainer($this->mockContainer);
$this->container = $this->getMock(Container::class);
$this->subject = new ConfigTest();
}

public function testGetConfig()
{
$key = 'key';
$value = 'value';

$this->mockContainer
$parameterBag = $this->getMock(ParameterBag::class);
$this->container
->expects($this->once())
->method('getParameterBag')
->willReturn($parameterBag);

$parameterBag
->expects($this->once())
->method('getParameter')
->method('get')
->with($key)
->willReturn($value);

$actualResult = $this->subject->testGetParameter($key);
$this->subject->setContainer($this->container);
$actual = $this->subject->testGetParameter($key);

$this->assertEquals($value, $actualResult);
$this->assertEquals($value, $actual);
}
}
92 changes: 0 additions & 92 deletions Tests/BrainExe/Core/Traits/RedisCacheTraitTest.php

This file was deleted.

6 changes: 3 additions & 3 deletions composer.json
Expand Up @@ -2,7 +2,7 @@
"name": "brainexe/core",
"description": "Framework core - used for brainexe/homie",
"homepage": "https://mdoetsch.de",
"minimum-stability": "dev",
"minimum-stability": "stable",
"license": "MIT",
"authors": [
{
Expand All @@ -29,10 +29,10 @@
"symfony/proxy-manager-bridge": "~3.0",
"zendframework/zend-stdlib": "~2.7|~3.0",
"ocramius/proxy-manager": "~1.0",
"brainexe/annotations": "~1.1",
"brainexe/annotations": "~1.0.4",
"monolog/monolog": "~1.17",
"doctrine/cache": "~1.6",
"predis/predis": "~1.1",
"predis/predis": "~1.0",
"mtdowling/cron-expression": "1.1.*",
"phpmailer/phpmailer": "~5.2"
},
Expand Down

0 comments on commit 5357784

Please sign in to comment.