Вход Регистрация
Файл: symfony-2.7/src/Symfony/Bundle/WebProfilerBundle/Tests/Command/ImportCommandTest.php
Строк: 54
<?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 SymfonyBundleWebProfilerBundleTestsCommand;

use 
SymfonyBundleWebProfilerBundleCommandImportCommand;
use 
SymfonyComponentConsoleTesterCommandTester;
use 
SymfonyComponentHttpKernelProfilerProfile;

class 
ImportCommandTest extends PHPUnit_Framework_TestCase
{
    public function 
testExecute()
    {
        
$profiler $this
            
->getMockBuilder('SymfonyComponentHttpKernelProfilerProfiler')
            ->
disableOriginalConstructor()
            ->
getMock()
        ;

        
$profiler->expects($this->once())->method('import')->will($this->returnValue(new Profile('TOKEN')));

        
$command = new ImportCommand($profiler);
        
$commandTester = new CommandTester($command);
        
$commandTester->execute(array('filename' => __DIR__.'/../Fixtures/profile.data'));
        
$this->assertRegExp('/Profile "TOKEN" has been successfully imported./'$commandTester->getDisplay());
    }
}
Онлайн: 1
Реклама