Skip to content

Commit

Permalink
fixed cs
Browse files Browse the repository at this point in the history
  • Loading branch information
lookyman committed Mar 17, 2015
1 parent c3b279c commit a8b94a0
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 97 deletions.
2 changes: 2 additions & 0 deletions tests/Bridge/Latte/SlugifyHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
class SlugifyHelperTest extends \PHPUnit_Framework_TestCase
{

public function setUp()
{
$this->slugify = m::mock('Cocur\Slugify\SlugifyInterface');
Expand All @@ -34,4 +35,5 @@ public function slugify()

$this->assertEquals('haello_woerld', $this->helper->slugify('hällo wörld', '_'));
}

}
192 changes: 95 additions & 97 deletions tests/Bridge/Nette/SlugifyExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

namespace Cocur\Slugify\Bridge\Nette;

use Nette\Bridges\ApplicationDI\LatteExtension;
use Nette\DI\Compiler;
use \Mockery as m;


Expand All @@ -22,7 +20,7 @@ class SlugifyExtensionTest extends \PHPUnit_Framework_TestCase

public function setUp()
{
$this->extension = new SlugifyExtension();
$this->extension = new SlugifyExtension();
}

/**
Expand All @@ -31,107 +29,107 @@ public function setUp()
*/
public function loadConfiguration()
{
$slugify = m::mock('Nette\DI\ServiceDefinition');
$slugify
->shouldReceive('setClass')
->with('Cocur\Slugify\SlugifyInterface')
->once()
->andReturn($slugify);
$slugify
->shouldReceive('setFactory')
->with('Cocur\Slugify\Slugify')
->once()
->andReturn($slugify);

$helper = m::mock('Nette\DI\ServiceDefinition');
$helper
->shouldReceive('setClass')
->with('Cocur\Slugify\Bridge\Latte\SlugifyHelper')
->once()
->andReturn($helper);
$helper
->shouldReceive('setInject')
->with(false)
->once()
->andReturn($helper);

$builder = m::mock('Nette\DI\ContainerBuilder');
$builder
->shouldReceive('addDefinition')
->with('slugify.slugify')
->once()
->andReturn($slugify);
$builder
->shouldReceive('addDefinition')
->with('slugify.helper')
->once()
->andReturn($helper);

$compiler = m::mock('Nette\DI\Compiler');
$compiler
->shouldReceive('getContainerBuilder')
->once()
->andReturn($builder);

$this->extension->setCompiler($compiler, 'slugify');
$this->extension->loadConfiguration();
$slugify = m::mock('Nette\DI\ServiceDefinition');
$slugify
->shouldReceive('setClass')
->with('Cocur\Slugify\SlugifyInterface')
->once()
->andReturn($slugify);
$slugify
->shouldReceive('setFactory')
->with('Cocur\Slugify\Slugify')
->once()
->andReturn($slugify);

$helper = m::mock('Nette\DI\ServiceDefinition');
$helper
->shouldReceive('setClass')
->with('Cocur\Slugify\Bridge\Latte\SlugifyHelper')
->once()
->andReturn($helper);
$helper
->shouldReceive('setInject')
->with(false)
->once()
->andReturn($helper);

$builder = m::mock('Nette\DI\ContainerBuilder');
$builder
->shouldReceive('addDefinition')
->with('slugify.slugify')
->once()
->andReturn($slugify);
$builder
->shouldReceive('addDefinition')
->with('slugify.helper')
->once()
->andReturn($helper);

$compiler = m::mock('Nette\DI\Compiler');
$compiler
->shouldReceive('getContainerBuilder')
->once()
->andReturn($builder);

$this->extension->setCompiler($compiler, 'slugify');
$this->extension->loadConfiguration();
}

/**
/**
* @test
* @covers Cocur\Slugify\Bridge\Nette\SlugifyExtension::beforeCompile()
*/
public function beforeCompile()
{
$latteFactory = m::mock('Nette\DI\ServiceDefinition');
$latteFactory
->shouldReceive('addSetup')
->with('addFilter', array('slugify', array('@slugify.helper', 'slugify')))
->once()
->andReturn($latteFactory);

$latte = m::mock('Nette\DI\ServiceDefinition');
$latte
->shouldReceive('addSetup')
->with('addFilter', array('slugify', array('@slugify.helper', 'slugify')))
->once()
->andReturn($latte);

$builder = m::mock('Nette\DI\ContainerBuilder');
$builder
->shouldReceive('getByType')
->with('Nette\Bridges\ApplicationLatte\ILatteFactory')
->once()
->andReturn('latte.latteFactory');
$builder
->shouldReceive('hasDefinition')
->with('latte.latteFactory')
->once()
->andReturn(TRUE);
$builder
->shouldReceive('getDefinition')
->with('latte.latteFactory')
->once()
->andReturn($latteFactory);
$builder
->shouldReceive('hasDefinition')
->with('nette.latte')
->once()
->andReturn(TRUE);
$builder
->shouldReceive('getDefinition')
->with('nette.latte')
->once()
->andReturn($latte);

$compiler = m::mock('Nette\DI\Compiler');
$compiler
->shouldReceive('getContainerBuilder')
->once()
->andReturn($builder);

$this->extension->setCompiler($compiler, 'slugify');
$this->extension->beforeCompile();
$latteFactory = m::mock('Nette\DI\ServiceDefinition');
$latteFactory
->shouldReceive('addSetup')
->with('addFilter', array('slugify', array('@slugify.helper', 'slugify')))
->once()
->andReturn($latteFactory);

$latte = m::mock('Nette\DI\ServiceDefinition');
$latte
->shouldReceive('addSetup')
->with('addFilter', array('slugify', array('@slugify.helper', 'slugify')))
->once()
->andReturn($latte);

$builder = m::mock('Nette\DI\ContainerBuilder');
$builder
->shouldReceive('getByType')
->with('Nette\Bridges\ApplicationLatte\ILatteFactory')
->once()
->andReturn('latte.latteFactory');
$builder
->shouldReceive('hasDefinition')
->with('latte.latteFactory')
->once()
->andReturn(true);
$builder
->shouldReceive('getDefinition')
->with('latte.latteFactory')
->once()
->andReturn($latteFactory);
$builder
->shouldReceive('hasDefinition')
->with('nette.latte')
->once()
->andReturn(true);
$builder
->shouldReceive('getDefinition')
->with('nette.latte')
->once()
->andReturn($latte);

$compiler = m::mock('Nette\DI\Compiler');
$compiler
->shouldReceive('getContainerBuilder')
->once()
->andReturn($builder);

$this->extension->setCompiler($compiler, 'slugify');
$this->extension->beforeCompile();
}

}

0 comments on commit a8b94a0

Please sign in to comment.