This commit is contained in:
Xes
2025-08-14 22:41:49 +02:00
parent 2de81ccc46
commit 8ce45119b6
39774 changed files with 4309466 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
<?php
/**
* This file is part of cocur/slugify.
*
* (c) Florian Eckerstorfer <florian@eckerstorfer.co>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Cocur\Slugify\Tests\Bridge\Symfony;
use Cocur\Slugify\Bridge\Symfony\CocurSlugifyBundle;
use Cocur\Slugify\Bridge\Symfony\CocurSlugifyExtension;
/**
* CocurSlugifyBundleTest
*
* @category test
* @package cocur/slugify
* @subpackage bridge
* @author Florian Eckerstorfer <florian@eckerstorfer.co>
* @copyright 2012-2014 Florian Eckerstorfer
* @license http://www.opensource.org/licenses/MIT The MIT License
* @group unit
*/
class CocurSlugifyBundleTest extends \PHPUnit_Framework_TestCase
{
/**
* @covers Cocur\Slugify\Bridge\Symfony\CocurSlugifyBundle::getContainerExtension()
*/
public function testGetContainerExtension()
{
$bundle = new CocurSlugifyBundle();
static::assertInstanceOf(CocurSlugifyExtension::class, $bundle->getContainerExtension());
}
}

View File

@@ -0,0 +1,70 @@
<?php
/**
* This file is part of cocur/slugify.
*
* (c) Florian Eckerstorfer <florian@eckerstorfer.co>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Cocur\Slugify\Tests\Bridge\Symfony;
use Cocur\Slugify\Bridge\Symfony\CocurSlugifyExtension;
use Mockery as m;
/**
* CocurSlugifyExtensionTest
*
* @category test
* @package cocur/slugify
* @subpackage bridge
* @author Florian Eckerstorfer <florian@eckerstorfer.co>
* @copyright 2012-2014 Florian Eckerstorfer
* @license http://www.opensource.org/licenses/MIT The MIT License
* @group unit
*/
class CocurSlugifyExtensionTest extends \PHPUnit_Framework_TestCase
{
protected function setUp()
{
$this->extension = new CocurSlugifyExtension();
}
/**
* @test
* @covers Cocur\Slugify\Bridge\Symfony\CocurSlugifyExtension::load()
*/
public function load()
{
$twigDefinition = m::mock('Symfony\Component\DependencyInjection\Definition');
$twigDefinition
->shouldReceive('addTag')
->with('twig.extension')
->once()
->andReturn($twigDefinition);
$twigDefinition
->shouldReceive('setPublic')
->with(false)
->once();
$container = m::mock('Symfony\Component\DependencyInjection\ContainerBuilder');
$container
->shouldReceive('setDefinition')
->with('cocur_slugify', m::type('Symfony\Component\DependencyInjection\Definition'))
->once();
$container
->shouldReceive('setDefinition')
->with('cocur_slugify.twig.slugify', m::type('Symfony\Component\DependencyInjection\Definition'))
->once()
->andReturn($twigDefinition);
$container
->shouldReceive('setAlias')
->with('slugify', 'cocur_slugify')
->once();
$this->extension->load([], $container);
}
}

View File

@@ -0,0 +1,55 @@
<?php
/*
* This file is part of the cocur/slugify package.
*
* (c) Enrico Stahn <enrico.stahn@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Cocur\Slugify\Tests\Bridge\Symfony;
use Cocur\Slugify\Bridge\Symfony\Configuration;
use Symfony\Component\Config\Definition\Processor;
class ConfigurationTest extends \PHPUnit_Framework_TestCase
{
public function testAll()
{
$configs = [
[
'lowercase' => true,
'separator' => '_',
'regexp' => 'abcd',
'rulesets' => ['burmese', 'hindi']
],
];
$this->process($configs);
}
/**
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidTypeException
*/
public function testLowercaseOnlyAcceptsBoolean()
{
$configs = [['lowercase' => 'abc']];
$this->process($configs);
}
/**
* Processes an array of configurations and returns a compiled version.
*
* @param array $configs An array of raw configurations
*
* @return array A normalized array
*/
protected function process($configs)
{
$processor = new Processor();
return $processor->processConfiguration(new Configuration(), $configs);
}
}