<commit_before><?php

/*
 * This file is part of the symfony package.
 * (c) <NAME> <<EMAIL>>
 * 
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Tests\Components\DependencyInjection\Loader;

require_once __DIR__.'/../../../bootstrap.php';

use Symfony\Components\DependencyInjection\Builder;
use Symfony\Components\DependencyInjection\Loader\FileLoader;

class XmlDumperTest extends \PHPUnit_Framework_TestCase
{
  public function testConstructor()
  {
    $loader = new ProjectLoader(__DIR__);
    $this->assertEquals($loader->paths, array(__DIR__), '__construct() takes a path as its second argument');

    $loader = new ProjectLoader(array(__DIR__, __DIR__));
    $this->assertEquals($loader->paths, array(__DIR__, __DIR__), '__construct() takes an array of paths as its second argument');
  }

  public function testGetAbsolutePath()
  {
    $loader = new ProjectLoader(array(__DIR__.'/../../../../../bin'));
    $this->assertEquals($loader->getAbsolutePath('/foo.xml'), '/foo.xml', '->getAbsolutePath() return the path unmodified if it is already an absolute path');
    $this->assertEquals($loader->getAbsolutePath('c:\\\\foo.xml'), 'c:\\\\foo.xml', '->getAbsolutePath() return the path unmodified if it is already an absolute path');
    $this->assertEquals($loader->getAbsolutePath('c:/foo.xml'), 'c:/foo.xml', '->getAbsolutePath() return the path unmodified if it is already an absolute path');
    $this->assertEquals($loader->getAbsolutePath('\\server\\foo.xml'), '\\server\\foo.xml', '->getAbsolutePath() return the path unmodified if it is already an absolute path');

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

    $this->assertEquals($loader->getAbsolutePath('prove.php', __DIR__), __DIR__.'/../../../../../bin/prove.php', '->getAbsolutePath() returns an absolute filename if the file exists in one of the paths given in the constructor');

    $this->assertEquals($loader->getAbsolutePath('foo.xml', __DIR__), 'foo.xml', '->getAbsolutePath() returns the path unmodified if it is unable to find it in the given paths');
  }
}

class ProjectLoader extends FileLoader
{
  public $paths;

  public function load($resource)
  {<commit_msg>[DependencyInjection] fixed a unit test<commit_after><?php

/*
 * This file is part of the symfony package.
 * (c) <NAME> <<EMAIL>>
 * 
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Tests\Components\DependencyInjection\Loader;

require_once __DIR__.'/../../../bootstrap.php';

use Symfony\Components\DependencyInjection\Builder;
use Symfony\Components\DependencyInjection\Loader\FileLoader;

class XmlDumperTest extends \PHPUnit_Framework_TestCase
{
  public function testConstructor()
  {
    $loader = new ProjectLoader(__DIR__);
    $this->assertEquals($loader->paths, array(__DIR__), '__construct() takes a path as its second argument');

    $loader = new ProjectLoader(array(__DIR__, __DIR__));
    $this->assertEquals($loader->paths, array(__DIR__, __DIR__), '__construct() takes an array of paths as its second argument');
  }

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

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

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

    $this->assertEquals($loader->getAbsolutePath('foo.xml', __DIR__), 'foo.xml', '->getAbsolutePath() returns the path unmodified if it is unable to find it in the given paths');
  }
}

class ProjectLoader extends FileLoader
{
  public $paths;

  public function load($resource)
  {
{'fraction_non_alphanumeric': 0.1497991967871486, 'fraction_numerical': 0.0008032128514056225, 'mean_word_length': 4.718714121699196, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 59, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 20}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2895524', 'n_tokens_mistral': 1367, 'n_tokens_neox': 1341, 'n_words': 410}