Skip to content

Commit

Permalink
reorganized unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Jun 28, 2010
1 parent 87ae06c commit 244c202
Show file tree
Hide file tree
Showing 112 changed files with 35 additions and 35 deletions.
2 changes: 1 addition & 1 deletion tests/Symfony/Tests/Components/Console/ApplicationTest.php
Expand Up @@ -22,7 +22,7 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase

static public function setUpBeforeClass()
{
self::$fixturesPath = realpath(__DIR__.'/../../../../fixtures/Symfony/Components/Console/');
self::$fixturesPath = realpath(__DIR__.'/Fixtures/');
require_once self::$fixturesPath.'/FooCommand.php';
require_once self::$fixturesPath.'/Foo1Command.php';
require_once self::$fixturesPath.'/Foo2Command.php';
Expand Down
Expand Up @@ -29,7 +29,7 @@ class CommandTest extends \PHPUnit_Framework_TestCase

static public function setUpBeforeClass()
{
self::$fixturesPath = __DIR__.'/../../../../../fixtures/Symfony/Components/Console/';
self::$fixturesPath = __DIR__.'/../Fixtures/';
require_once self::$fixturesPath.'/TestCommand.php';
}

Expand Down
Expand Up @@ -23,7 +23,7 @@ class InputDefinitionTest extends \PHPUnit_Framework_TestCase

static public function setUpBeforeClass()
{
self::$fixtures = __DIR__.'/../../../../../fixtures/Symfony/Components/Console';
self::$fixtures = __DIR__.'/../Fixtures/';
}

public function testConstructor()
Expand Down
Expand Up @@ -23,7 +23,7 @@ class BuilderConfigurationTest extends \PHPUnit_Framework_TestCase

static public function setUpBeforeClass()
{
self::$fixturesPath = __DIR__.'/../../../../fixtures/Symfony/Components/DependencyInjection/';
self::$fixturesPath = __DIR__.'/Fixtures/';
}

/**
Expand Down
Expand Up @@ -23,7 +23,7 @@ class BuilderTest extends \PHPUnit_Framework_TestCase

static public function setUpBeforeClass()
{
self::$fixturesPath = __DIR__.'/../../../../fixtures/Symfony/Components/DependencyInjection/';
self::$fixturesPath = __DIR__.'/Fixtures/';
}

/**
Expand Down
Expand Up @@ -18,7 +18,7 @@ class CrossCheckTest extends \PHPUnit_Framework_TestCase

static public function setUpBeforeClass()
{
self::$fixturesPath = __DIR__.'/../../../../fixtures/Symfony/Components/DependencyInjection/';
self::$fixturesPath = __DIR__.'/Fixtures/';

require_once self::$fixturesPath.'/includes/classes.php';
require_once self::$fixturesPath.'/includes/foo.php';
Expand Down
Expand Up @@ -19,7 +19,7 @@ class GraphvizDumperTest extends \PHPUnit_Framework_TestCase

static public function setUpBeforeClass()
{
self::$fixturesPath = __DIR__.'/../../../../../fixtures/Symfony/Components/DependencyInjection/';
self::$fixturesPath = __DIR__.'/../Fixtures/';
}

public function testDump()
Expand Down
Expand Up @@ -21,7 +21,7 @@ class PhpDumperTest extends \PHPUnit_Framework_TestCase

static public function setUpBeforeClass()
{
self::$fixturesPath = realpath(__DIR__.'/../../../../../fixtures/Symfony/Components/DependencyInjection/');
self::$fixturesPath = realpath(__DIR__.'/../Fixtures/');
}

public function testDump()
Expand Down
Expand Up @@ -19,7 +19,7 @@ class XmlDumperTest extends \PHPUnit_Framework_TestCase

static public function setUpBeforeClass()
{
self::$fixturesPath = realpath(__DIR__.'/../../../../../fixtures/Symfony/Components/DependencyInjection/');
self::$fixturesPath = realpath(__DIR__.'/../Fixtures/');
}

public function testDump()
Expand Down
Expand Up @@ -19,7 +19,7 @@ class YamlDumperTest extends \PHPUnit_Framework_TestCase

static public function setUpBeforeClass()
{
self::$fixturesPath = realpath(__DIR__.'/../../../../../fixtures/Symfony/Components/DependencyInjection/');
self::$fixturesPath = realpath(__DIR__.'/../Fixtures/');
}

public function testDump()
Expand Down
Expand Up @@ -33,15 +33,15 @@ public function testConstructor()
*/
public function testGetAbsolutePath()
{
$loader = new ProjectLoader(array(__DIR__.'/../../../../../fixtures/Symfony/Components/DependencyInjection/containers'));
$loader = new ProjectLoader(array(__DIR__.'/../Fixtures/containers'));
$this->assertEquals('/foo.xml', $loader->getAbsolutePath('/foo.xml'), '->getAbsolutePath() return the path unmodified if it is already an absolute path');
$this->assertEquals('c:\\\\foo.xml', $loader->getAbsolutePath('c:\\\\foo.xml'), '->getAbsolutePath() return the path unmodified if it is already an absolute path');
$this->assertEquals('c:/foo.xml', $loader->getAbsolutePath('c:/foo.xml'), '->getAbsolutePath() return the path unmodified if it is already an absolute path');
$this->assertEquals('\\server\\foo.xml', $loader->getAbsolutePath('\\server\\foo.xml'), '->getAbsolutePath() return the path unmodified if it is already an absolute path');

$this->assertEquals(__DIR__.DIRECTORY_SEPARATOR.'FileLoaderTest.php', $loader->getAbsolutePath('FileLoaderTest.php', __DIR__), '->getAbsolutePath() returns an absolute filename if the file exists in the current path');

$this->assertEquals(__DIR__.'/../../../../../fixtures/Symfony/Components/DependencyInjection/containers'.DIRECTORY_SEPARATOR.'container10.php', $loader->getAbsolutePath('container10.php', __DIR__), '->getAbsolutePath() returns an absolute filename if the file exists in one of the paths given in the constructor');
$this->assertEquals(__DIR__.'/../Fixtures/containers'.DIRECTORY_SEPARATOR.'container10.php', $loader->getAbsolutePath('container10.php', __DIR__), '->getAbsolutePath() returns an absolute filename if the file exists in one of the paths given in the constructor');

$this->assertEquals('foo.xml', $loader->getAbsolutePath('foo.xml', __DIR__), '->getAbsolutePath() returns the path unmodified if it is unable to find it in the given paths');
}
Expand Down
Expand Up @@ -19,7 +19,7 @@ class IniFileLoaderTest extends \PHPUnit_Framework_TestCase

static public function setUpBeforeClass()
{
self::$fixturesPath = realpath(__DIR__.'/../../../../../fixtures/Symfony/Components/DependencyInjection/');
self::$fixturesPath = realpath(__DIR__.'/../Fixtures/');
}

/**
Expand Down
Expand Up @@ -10,7 +10,7 @@

namespace Symfony\Tests\Components\DependencyInjection\Loader;

require_once __DIR__.'/../../../../../fixtures/Symfony/Components/DependencyInjection/includes/ProjectExtension.php';
require_once __DIR__.'/../Fixtures/includes/ProjectExtension.php';

use Symfony\Components\DependencyInjection\BuilderConfiguration;

Expand Down
Expand Up @@ -10,7 +10,7 @@

namespace Symfony\Tests\Components\DependencyInjection\Loader;

require_once __DIR__.'/../../../../../fixtures/Symfony/Components/DependencyInjection/includes/ProjectExtension.php';
require_once __DIR__.'/../Fixtures/includes/ProjectExtension.php';

use Symfony\Components\DependencyInjection\Loader\Loader;
use Symfony\Components\DependencyInjection\BuilderConfiguration;
Expand Down
Expand Up @@ -22,7 +22,7 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase

static public function setUpBeforeClass()
{
self::$fixturesPath = realpath(__DIR__.'/../../../../../fixtures/Symfony/Components/DependencyInjection/');
self::$fixturesPath = realpath(__DIR__.'/../Fixtures/');
require_once self::$fixturesPath.'/includes/ProjectExtension.php';
}

Expand Down
Expand Up @@ -22,7 +22,7 @@ class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase

static public function setUpBeforeClass()
{
self::$fixturesPath = realpath(__DIR__.'/../../../../../fixtures/Symfony/Components/DependencyInjection/');
self::$fixturesPath = realpath(__DIR__.'/../Fixtures/');
require_once self::$fixturesPath.'/includes/ProjectExtension.php';
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Symfony/Tests/Components/Templating/EngineTest.php
Expand Up @@ -11,7 +11,7 @@

namespace Symfony\Tests\Components\Templating;

require_once __DIR__.'/../../../../lib/SymfonyTests/Components/Templating/SimpleHelper.php';
require_once __DIR__.'/Fixtures/SimpleHelper.php';

use Symfony\Components\Templating\Engine;
use Symfony\Components\Templating\Loader\Loader;
Expand Down
Expand Up @@ -11,7 +11,7 @@

namespace Symfony\Tests\Components\Templating\Loader;

require_once __DIR__.'/../../../../../lib/SymfonyTests/Components/Templating/ProjectTemplateDebugger.php';
require_once __DIR__.'/../Fixtures/ProjectTemplateDebugger.php';

use Symfony\Components\Templating\Loader\Loader;
use Symfony\Components\Templating\Loader\CacheLoader;
Expand Down
Expand Up @@ -11,7 +11,7 @@

namespace Symfony\Tests\Components\Templating\Loader;

require_once __DIR__.'/../../../../../lib/SymfonyTests/Components/Templating/ProjectTemplateDebugger.php';
require_once __DIR__.'/../Fixtures/ProjectTemplateDebugger.php';

use Symfony\Components\Templating\Loader\ChainLoader;
use Symfony\Components\Templating\Loader\FilesystemLoader;
Expand All @@ -23,7 +23,7 @@ class ChainLoaderTest extends \PHPUnit_Framework_TestCase

static public function setUpBeforeClass()
{
$fixturesPath = realpath(__DIR__.'/../../../../../fixtures/Symfony/Components/Templating/');
$fixturesPath = realpath(__DIR__.'/../Fixtures/');
self::$loader1 = new FilesystemLoader($fixturesPath.'/null/%name%');
self::$loader2 = new FilesystemLoader($fixturesPath.'/templates/%name%.%renderer%');
}
Expand Down
Expand Up @@ -11,7 +11,7 @@

namespace Symfony\Tests\Components\Templating\Loader;

require_once __DIR__.'/../../../../../lib/SymfonyTests/Components/Templating/ProjectTemplateDebugger.php';
require_once __DIR__.'/../Fixtures/ProjectTemplateDebugger.php';

use Symfony\Components\Templating\Loader\FilesystemLoader;
use Symfony\Components\Templating\Storage\FileStorage;
Expand All @@ -22,7 +22,7 @@ class FilesystemLoaderTest extends \PHPUnit_Framework_TestCase

static public function setUpBeforeClass()
{
self::$fixturesPath = realpath(__DIR__.'/../../../../../fixtures/Symfony/Components/Templating/');
self::$fixturesPath = realpath(__DIR__.'/../Fixtures/');
}

public function testConstructor()
Expand Down
Expand Up @@ -11,7 +11,7 @@

namespace Symfony\Tests\Components\Templating\Loader;

require_once __DIR__.'/../../../../../lib/SymfonyTests/Components/Templating/ProjectTemplateDebugger.php';
require_once __DIR__.'/../Fixtures/ProjectTemplateDebugger.php';

use Symfony\Components\Templating\Loader\Loader;

Expand Down
Expand Up @@ -25,7 +25,7 @@ public function testEvaluate()
$template = new StringStorage('<?php echo $foo ?>');
$this->assertEquals('bar', $renderer->evaluate($template, array('foo' => 'bar')), '->evaluate() renders templates that are instances of StringStorage');

$template = new FileStorage(__DIR__.'/../../../../../fixtures/Symfony/Components/Templating/templates/foo.php');
$template = new FileStorage(__DIR__.'/../Fixtures/templates/foo.php');
$this->assertEquals('bar', $renderer->evaluate($template, array('foo' => 'bar')), '->evaluate() renders templates that are instances of FileStorage');
}
}
Expand Up @@ -11,7 +11,7 @@

namespace Symfony\Tests\Components\Templating\Renderer;

require_once __DIR__.'/../../../../../lib/SymfonyTests/Components/Templating/SimpleHelper.php';
require_once __DIR__.'/../Fixtures/SimpleHelper.php';

use Symfony\Components\Templating\Engine;
use Symfony\Components\Templating\Renderer\Renderer;
Expand All @@ -22,7 +22,7 @@ class RendererTest extends \PHPUnit_Framework_TestCase
{
public function testSetEngine()
{
$loader = new FilesystemLoader(array(__DIR__.'/fixtures/templates/%name%.%renderer%'));
$loader = new FilesystemLoader(array(__DIR__.'/../Fixtures/templates/%name%.%renderer%'));
$engine = new Engine($loader);
$renderer = new ProjectTemplateRenderer();
$renderer->setEngine($engine);
Expand Down
Expand Up @@ -20,7 +20,7 @@ public function testGetContent()
{
$storage = new FileStorage('foo');
$this->assertInstanceOf('Symfony\Components\Templating\Storage\Storage', $storage, 'FileStorage is an instance of Storage');
$storage = new FileStorage(__DIR__.'/../../../../../fixtures/Symfony/Components/Templating/templates/foo.php');
$storage = new FileStorage(__DIR__.'/../Fixtures/templates/foo.php');
$this->assertEquals('<?php echo $foo ?>', $storage->getContent(), '->getContent() returns the content of the template');
}
}
6 changes: 3 additions & 3 deletions tests/Symfony/Tests/Components/Yaml/DumperTest.php
Expand Up @@ -8,7 +8,7 @@
* file that was distributed with this source code.
*/

namespace Symfony\Tests\Components\OutputEscaper;
namespace Symfony\Tests\Components\Yaml;

use Symfony\Components\Yaml\Yaml;
use Symfony\Components\Yaml\Parser;
Expand All @@ -29,7 +29,7 @@ public function setUp()
{
$this->parser = new Parser();
$this->dumper = new Dumper();
$this->path = __DIR__.'/../../../../fixtures/Symfony/Components/Yaml';
$this->path = __DIR__.'/Fixtures';
}

public function testSpecifications()
Expand Down Expand Up @@ -153,7 +153,7 @@ public function testObjectsSupport()
{
$a = array('foo' => new A(), 'bar' => 1);

$this->assertEquals('{ foo: !!php/object:O:40:"Symfony\Tests\Components\OutputEscaper\A":1:{s:1:"a";s:3:"foo";}, bar: 1 }', $this->dumper->dump($a), '->dump() is able to dump objects');
$this->assertEquals('{ foo: !!php/object:O:31:"Symfony\Tests\Components\Yaml\A":1:{s:1:"a";s:3:"foo";}, bar: 1 }', $this->dumper->dump($a), '->dump() is able to dump objects');
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Symfony/Tests/Components/Yaml/InlineTest.php
Expand Up @@ -8,7 +8,7 @@
* file that was distributed with this source code.
*/

namespace Symfony\Tests\Components\OutputEscaper;
namespace Symfony\Tests\Components\Yaml;

use Symfony\Components\Yaml\Yaml;
use Symfony\Components\Yaml\Inline;
Expand Down
6 changes: 3 additions & 3 deletions tests/Symfony/Tests/Components/Yaml/ParserTest.php
Expand Up @@ -8,7 +8,7 @@
* file that was distributed with this source code.
*/

namespace Symfony\Tests\Components\OutputEscaper;
namespace Symfony\Tests\Components\Yaml;

use Symfony\Components\Yaml\Yaml;
use Symfony\Components\Yaml\Parser;
Expand All @@ -27,7 +27,7 @@ static public function setUpBeforeClass()
public function setUp()
{
$this->parser = new Parser();
$this->path = __DIR__.'/../../../../fixtures/Symfony/Components/Yaml';
$this->path = __DIR__.'/Fixtures';
}

public function testSpecifications()
Expand Down Expand Up @@ -80,7 +80,7 @@ public function testObjectsSupport()
{
$b = array('foo' => new B(), 'bar' => 1);
$this->assertEquals($this->parser->parse(<<<EOF
foo: !!php/object:O:40:"Symfony\Tests\Components\OutputEscaper\B":1:{s:1:"b";s:3:"foo";}
foo: !!php/object:O:31:"Symfony\Tests\Components\Yaml\B":1:{s:1:"b";s:3:"foo";}
bar: 1
EOF
), $b, '->parse() is able to dump objects');
Expand Down

0 comments on commit 244c202

Please sign in to comment.