提交代码
This commit is contained in:
42
vendor/symfony/mime/Tests/DependencyInjection/AddMimeTypeGuesserPassTest.php
vendored
Normal file
42
vendor/symfony/mime/Tests/DependencyInjection/AddMimeTypeGuesserPassTest.php
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Mime\Tests\DependencyInjection;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
use Symfony\Component\Mime\DependencyInjection\AddMimeTypeGuesserPass;
|
||||
use Symfony\Component\Mime\FileinfoMimeTypeGuesser;
|
||||
use Symfony\Component\Mime\MimeTypes;
|
||||
|
||||
class AddMimeTypeGuesserPassTest extends TestCase
|
||||
{
|
||||
public function testTags()
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
$container->addCompilerPass(new AddMimeTypeGuesserPass());
|
||||
|
||||
$definition = new Definition(FileinfoMimeTypeGuesser::class);
|
||||
$definition->addArgument('/path/to/magic/file');
|
||||
$definition->addTag('mime.mime_type_guesser');
|
||||
$container->setDefinition('some_mime_type_guesser', $definition->setPublic(true));
|
||||
$container->register('mime_types', MimeTypes::class)->setPublic(true);
|
||||
$container->compile();
|
||||
|
||||
$router = $container->getDefinition('mime_types');
|
||||
$calls = $router->getMethodCalls();
|
||||
$this->assertCount(1, $calls);
|
||||
$this->assertEquals('registerGuesser', $calls[0][0]);
|
||||
$this->assertEquals(new Reference('some_mime_type_guesser'), $calls[0][1][0]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user