From b2e59a6b51be773dbc703b6e02c6b36b80ca3b30 Mon Sep 17 00:00:00 2001 From: Karoly Gossler Date: Sat, 17 Feb 2024 07:55:58 +0100 Subject: [PATCH] introduce __DIR__ constants --- lib/Doctrine/Core.php | 4 +-- lib/Doctrine/Parser/sfYaml/sfYaml.php | 4 +-- lib/Doctrine/Parser/sfYaml/sfYamlDumper.php | 2 +- lib/Doctrine/Parser/sfYaml/sfYamlInline.php | 2 +- lib/Doctrine/Parser/sfYaml/sfYamlParser.php | 2 +- tests/CliTestCase.php | 2 +- tests/CliTestCase/cli-default.php | 4 +-- tests/CliTestCase/cli-with-custom-tasks.php | 4 +-- ...li-without-autoregistered-custom-tasks.php | 4 +-- tests/DoctrineTest.php | 20 +++++------ tests/DoctrineTest/UnitTestCase.php | 2 +- tests/Export/PgsqlTestCase.php | 4 +-- tests/Export/RecordTestCase.php | 2 +- tests/Export/SchemaTestCase.php | 2 +- tests/ExtensionTestCase.php | 2 +- tests/Import/BuilderTestCase.php | 4 +-- tests/Import/PluginHierarchyTestCase.php | 4 +-- tests/Import/SchemaTestCase.php | 4 +-- tests/Migration/DiffTestCase.php | 8 ++--- tests/Search/FileTestCase.php | 2 +- tests/Search/IndexerTestCase.php | 2 +- tests/TaskTestCase.php | 2 +- tests/Ticket/1527TestCase.php | 4 +-- tests/Ticket/1727TestCase.php | 34 +++++++++---------- tests/Ticket/2375TestCase.php | 6 ++-- tests/Ticket/DC221TestCase.php | 6 ++-- tests/Ticket/DC292TestCase.php | 6 ++-- tests/Ticket/DC95TestCase.php | 10 +++--- tests/Ticket/gh110TestCase.php | 4 +-- tests/run.php | 6 ++-- tests/unsolved.php | 4 +-- 31 files changed, 83 insertions(+), 83 deletions(-) diff --git a/lib/Doctrine/Core.php b/lib/Doctrine/Core.php index 382bf9510..8662d3284 100644 --- a/lib/Doctrine/Core.php +++ b/lib/Doctrine/Core.php @@ -564,7 +564,7 @@ public static function setPath($path) public static function getPath() { if ( ! self::$_path) { - self::$_path = realpath(dirname(__FILE__) . '/..'); + self::$_path = dirname(__DIR__); } return self::$_path; @@ -1132,7 +1132,7 @@ public static function compile($target = null, $includedDrivers = array()) public static function autoload($className) { if (strpos($className, 'sfYaml') === 0) { - require dirname(__FILE__) . '/Parser/sfYaml/' . $className . '.php'; + require __DIR__ . '/Parser/sfYaml/' . $className . '.php'; return true; } diff --git a/lib/Doctrine/Parser/sfYaml/sfYaml.php b/lib/Doctrine/Parser/sfYaml/sfYaml.php index 1d89ccc97..7e0c14f3f 100644 --- a/lib/Doctrine/Parser/sfYaml/sfYaml.php +++ b/lib/Doctrine/Parser/sfYaml/sfYaml.php @@ -87,7 +87,7 @@ public static function load($input) return $input; } - require_once dirname(__FILE__).'/sfYamlParser.php'; + require_once __DIR__.'/sfYamlParser.php'; $yaml = new sfYamlParser(); @@ -116,7 +116,7 @@ public static function load($input) */ public static function dump($array, $inline = 2) { - require_once dirname(__FILE__).'/sfYamlDumper.php'; + require_once __DIR__.'/sfYamlDumper.php'; $yaml = new sfYamlDumper(); diff --git a/lib/Doctrine/Parser/sfYaml/sfYamlDumper.php b/lib/Doctrine/Parser/sfYaml/sfYamlDumper.php index 0ada2b37d..4ed3c8fbc 100644 --- a/lib/Doctrine/Parser/sfYaml/sfYamlDumper.php +++ b/lib/Doctrine/Parser/sfYaml/sfYamlDumper.php @@ -8,7 +8,7 @@ * file that was distributed with this source code. */ -require_once(dirname(__FILE__).'/sfYamlInline.php'); +require_once(__DIR__.'/sfYamlInline.php'); /** * sfYamlDumper dumps PHP variables to YAML strings. diff --git a/lib/Doctrine/Parser/sfYaml/sfYamlInline.php b/lib/Doctrine/Parser/sfYaml/sfYamlInline.php index 77096e43f..5f4f31168 100644 --- a/lib/Doctrine/Parser/sfYaml/sfYamlInline.php +++ b/lib/Doctrine/Parser/sfYaml/sfYamlInline.php @@ -8,7 +8,7 @@ * file that was distributed with this source code. */ -require_once dirname(__FILE__).'/sfYaml.php'; +require_once __DIR__.'/sfYaml.php'; /** * sfYamlInline implements a YAML parser/dumper for the YAML inline syntax. diff --git a/lib/Doctrine/Parser/sfYaml/sfYamlParser.php b/lib/Doctrine/Parser/sfYaml/sfYamlParser.php index 91da2dcb1..f8bdb34d7 100644 --- a/lib/Doctrine/Parser/sfYaml/sfYamlParser.php +++ b/lib/Doctrine/Parser/sfYaml/sfYamlParser.php @@ -8,7 +8,7 @@ * file that was distributed with this source code. */ -require_once(dirname(__FILE__).'/sfYamlInline.php'); +require_once(__DIR__.'/sfYamlInline.php'); if (!defined('PREG_BAD_UTF8_OFFSET_ERROR')) { diff --git a/tests/CliTestCase.php b/tests/CliTestCase.php index 967c86c8f..c2e206533 100644 --- a/tests/CliTestCase.php +++ b/tests/CliTestCase.php @@ -57,7 +57,7 @@ class Doctrine_Cli_TestCase extends UnitTestCase protected function getFixturesPath() { if (! isset($this->fixturesPath)) { - $this->fixturesPath = dirname(__FILE__) . '/CliTestCase'; + $this->fixturesPath = __DIR__ . '/CliTestCase'; } return $this->fixturesPath; diff --git a/tests/CliTestCase/cli-default.php b/tests/CliTestCase/cli-default.php index cf3e8f524..c0e4c46a8 100644 --- a/tests/CliTestCase/cli-default.php +++ b/tests/CliTestCase/cli-default.php @@ -5,10 +5,10 @@ * @author Dan Bettles */ -require_once(dirname(dirname(dirname(__FILE__))) . '/lib/Doctrine/Core.php'); +require_once dirname(__DIR__, 2) . '/lib/Doctrine/Core.php'; spl_autoload_register(array('Doctrine_Core', 'autoload')); -require_once(dirname(__FILE__) . '/TestTask02.php'); +require_once(__DIR__ . '/TestTask02.php'); $cli = new Doctrine_Cli(); $cli->run($_SERVER['argv']); diff --git a/tests/CliTestCase/cli-with-custom-tasks.php b/tests/CliTestCase/cli-with-custom-tasks.php index ef081e51f..8d16617ad 100644 --- a/tests/CliTestCase/cli-with-custom-tasks.php +++ b/tests/CliTestCase/cli-with-custom-tasks.php @@ -5,12 +5,12 @@ * @author Dan Bettles */ -require_once(dirname(dirname(dirname(__FILE__))) . '/lib/Doctrine/Core.php'); +require_once dirname(__DIR__, 2) . '/lib/Doctrine/Core.php'; spl_autoload_register(array('Doctrine_Core', 'autoload')); $cli = new Doctrine_Cli(); -require_once(dirname(__FILE__) . '/TestTask02.php'); +require_once(__DIR__ . '/TestTask02.php'); //Either...: $cli->registerTaskClass('Doctrine_Cli_TestCase_TestTask02'); diff --git a/tests/CliTestCase/cli-without-autoregistered-custom-tasks.php b/tests/CliTestCase/cli-without-autoregistered-custom-tasks.php index f9b644f5a..a7b6d2599 100644 --- a/tests/CliTestCase/cli-without-autoregistered-custom-tasks.php +++ b/tests/CliTestCase/cli-without-autoregistered-custom-tasks.php @@ -5,10 +5,10 @@ * @author Dan Bettles */ -require_once(dirname(dirname(dirname(__FILE__))) . '/lib/Doctrine/Core.php'); +require_once dirname(__DIR__, 2) . '/lib/Doctrine/Core.php'; spl_autoload_register(array('Doctrine_Core', 'autoload')); -require_once(dirname(__FILE__) . '/TestTask02.php'); +require_once(__DIR__ . '/TestTask02.php'); $cli = new Doctrine_Cli(array('autoregister_custom_tasks' => false)); $cli->run($_SERVER['argv']); diff --git a/tests/DoctrineTest.php b/tests/DoctrineTest.php index 59e60b050..3bafe851a 100644 --- a/tests/DoctrineTest.php +++ b/tests/DoctrineTest.php @@ -32,10 +32,10 @@ * @version $Revision$ */ -require_once dirname(__FILE__) . '/DoctrineTest/UnitTestCase.php'; -require_once dirname(__FILE__) . '/DoctrineTest/GroupTest.php'; -require_once dirname(__FILE__) . '/DoctrineTest/Doctrine_UnitTestCase.php'; -require_once dirname(__FILE__) . '/DoctrineTest/Reporter.php'; +require_once __DIR__ . '/DoctrineTest/UnitTestCase.php'; +require_once __DIR__ . '/DoctrineTest/GroupTest.php'; +require_once __DIR__ . '/DoctrineTest/Doctrine_UnitTestCase.php'; +require_once __DIR__ . '/DoctrineTest/Reporter.php'; class DoctrineTest { @@ -75,13 +75,13 @@ public function run() { $testGroup = $this->testGroup; if (PHP_SAPI === 'cli') { - require_once(dirname(__FILE__) . '/DoctrineTest/Reporter/Cli.php'); + require_once(__DIR__ . '/DoctrineTest/Reporter/Cli.php'); $reporter = new DoctrineTest_Reporter_Cli(); $argv = $_SERVER['argv']; array_shift($argv); $options = $this->parseOptions($argv); } else { - require_once(dirname(__FILE__) . '/DoctrineTest/Reporter/Html.php'); + require_once(__DIR__ . '/DoctrineTest/Reporter/Html.php'); $options = $_GET; if (isset($options['filter'])) { if ( ! is_array($options['filter'])) { @@ -148,7 +148,7 @@ public function run() * somebody could give it a try. Just replace this block of code * with the one below * - define('PHPCOVERAGE_HOME', dirname(dirname(__FILE__)) . '/vendor/spikephpcoverage'); + define('PHPCOVERAGE_HOME', dirname(__DIR__) . '/vendor/spikephpcoverage'); require_once PHPCOVERAGE_HOME . '/CoverageRecorder.php'; require_once PHPCOVERAGE_HOME . '/reporter/HtmlCoverageReporter.php'; @@ -170,8 +170,8 @@ public function run() $ret = $testGroup->run($reporter, $filter); $result['coverage'] = xdebug_get_code_coverage(); xdebug_stop_code_coverage(); - file_put_contents(dirname(__FILE__) . '/coverage/coverage.txt', serialize($result)); - require_once dirname(__FILE__) . '/DoctrineTest/Coverage.php'; + file_put_contents(__DIR__ . '/coverage/coverage.txt', serialize($result)); + require_once __DIR__ . '/DoctrineTest/Coverage.php'; $coverageGeneration = new DoctrineTest_Coverage(); $coverageGeneration->generateReport(); return $ret; @@ -203,7 +203,7 @@ public function run() */ public function requireModels() { - $models = new DirectoryIterator(dirname(__FILE__) . '/models/'); + $models = new DirectoryIterator(__DIR__ . '/models/'); foreach($models as $key => $file) { if ($file->isFile() && ! $file->isDot()) { diff --git a/tests/DoctrineTest/UnitTestCase.php b/tests/DoctrineTest/UnitTestCase.php index a2b4193fd..f1aca2fe5 100644 --- a/tests/DoctrineTest/UnitTestCase.php +++ b/tests/DoctrineTest/UnitTestCase.php @@ -183,7 +183,7 @@ public function getPassCount() public function getPassesAndFailsCachePath() { - $dir = dirname(__FILE__) . '/doctrine_tests'; + $dir = __DIR__ . '/doctrine_tests'; if ( ! is_dir($dir)) { mkdir($dir, 0777, true); } diff --git a/tests/Export/PgsqlTestCase.php b/tests/Export/PgsqlTestCase.php index aa99596bc..d2a393fea 100644 --- a/tests/Export/PgsqlTestCase.php +++ b/tests/Export/PgsqlTestCase.php @@ -128,7 +128,7 @@ public function testCreateTableSupportsMultiplePks() public function testExportSql() { $sql = $this->export->exportClassesSql(array("FooRecord", "FooReferenceRecord", "FooLocallyOwned", "FooForeignlyOwned", "FooForeignlyOwnedWithPK", "FooBarRecord", "BarRecord")); - //dirname(__FILE__) . DIRECTORY_SEPARATOR . '_files'); + //__DIR__ . DIRECTORY_SEPARATOR . '_files'); $this->assertEqual($sql, array ( 0 => 'CREATE TABLE foo_reference (foo1 BIGINT, foo2 BIGINT, PRIMARY KEY(foo1, foo2))', 1 => 'CREATE TABLE foo_locally_owned (id BIGSERIAL, name VARCHAR(200), PRIMARY KEY(id))', @@ -175,4 +175,4 @@ public function testAlterTableSqlIdentifierQuoting() 1 => 'ALTER TABLE "mytable" DROP "oldfield"' )); } -} \ No newline at end of file +} diff --git a/tests/Export/RecordTestCase.php b/tests/Export/RecordTestCase.php index 39a6976af..c51f14f53 100644 --- a/tests/Export/RecordTestCase.php +++ b/tests/Export/RecordTestCase.php @@ -97,7 +97,7 @@ public function testExportSupportsForeignKeysForManyToManyRelations() public function testExportModelFromDirectory() { - Doctrine_Core::createTablesFromModels(dirname(__FILE__) . DIRECTORY_SEPARATOR .'..' . DIRECTORY_SEPARATOR . 'models' . DIRECTORY_SEPARATOR . 'export'); + Doctrine_Core::createTablesFromModels(dirname(__DIR__) . DIRECTORY_SEPARATOR . 'models' . DIRECTORY_SEPARATOR . 'export'); $this->assertEqual($this->adapter->pop(), 'COMMIT'); $this->assertEqual($this->adapter->pop(), 'ALTER TABLE cms__category_languages ADD CONSTRAINT cms__category_languages_category_id_cms__category_id FOREIGN KEY (category_id) REFERENCES cms__category(id) ON DELETE CASCADE'); $this->assertEqual($this->adapter->pop(), 'CREATE TABLE cms__category_languages (id BIGINT AUTO_INCREMENT, name TEXT, category_id BIGINT, language_id BIGINT, INDEX index_category_idx (category_id), INDEX index_language_idx (language_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB'); diff --git a/tests/Export/SchemaTestCase.php b/tests/Export/SchemaTestCase.php index 960611a6f..b1f0d2943 100644 --- a/tests/Export/SchemaTestCase.php +++ b/tests/Export/SchemaTestCase.php @@ -56,7 +56,7 @@ class Doctrine_Export_Schema_TestCase extends Doctrine_UnitTestCase public function testYmlExport() { $export = new Doctrine_Export_Schema(); - $export->exportSchema('schema-export.yml', 'yml', dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'models', $this->tables); + $export->exportSchema('schema-export.yml', 'yml', dirname(__DIR__) . DIRECTORY_SEPARATOR . 'models', $this->tables); unlink('schema-export.yml'); } } diff --git a/tests/ExtensionTestCase.php b/tests/ExtensionTestCase.php index c7dd166c8..667f637f6 100755 --- a/tests/ExtensionTestCase.php +++ b/tests/ExtensionTestCase.php @@ -34,7 +34,7 @@ class Doctrine_Extension_TestCase extends Doctrine_UnitTestCase { public function prepareTables() { - Doctrine_Core::setExtensionsPath(dirname(__FILE__).'/Extension'); + Doctrine_Core::setExtensionsPath(__DIR__.'/Extension'); spl_autoload_register(array('Doctrine_Core', 'extensionsAutoload')); Doctrine_Manager::getInstance() diff --git a/tests/Import/BuilderTestCase.php b/tests/Import/BuilderTestCase.php index 7415c0911..84f0804c5 100644 --- a/tests/Import/BuilderTestCase.php +++ b/tests/Import/BuilderTestCase.php @@ -34,7 +34,7 @@ class Doctrine_Import_Builder_TestCase extends Doctrine_UnitTestCase { public function testInheritanceGeneration() { - $path = dirname(__FILE__) . '/import_builder_test'; + $path = __DIR__ . '/import_builder_test'; $import = new Doctrine_Import_Schema(); $import->setOption('generateTableClasses', true); @@ -122,4 +122,4 @@ public function testBaseTableClass() $class = $builder->buildTableClassDefinition('MyTestTable', array('className' => 'MyTest')); $this->assertTrue(strpos($class, 'class MyTestTable extends MyBaseTable')); } -} \ No newline at end of file +} diff --git a/tests/Import/PluginHierarchyTestCase.php b/tests/Import/PluginHierarchyTestCase.php index 6082cbcc4..26df10f42 100644 --- a/tests/Import/PluginHierarchyTestCase.php +++ b/tests/Import/PluginHierarchyTestCase.php @@ -55,7 +55,7 @@ public function testImportOfHieriarchyOfPluginGeneration() END; file_put_contents('wiki.yml', $yml); - $path = dirname(__FILE__) . '/tmp/import_builder_test'; + $path = __DIR__ . '/tmp/import_builder_test'; $import = new Doctrine_Import_Schema(); $import->setOption('generateTableClasses', true); @@ -83,4 +83,4 @@ public function testImportOfHieriarchyOfPluginGeneration() Doctrine_Lib::removeDirectories($path); unlink('wiki.yml'); } -} \ No newline at end of file +} diff --git a/tests/Import/SchemaTestCase.php b/tests/Import/SchemaTestCase.php index a480499db..c47a30358 100644 --- a/tests/Import/SchemaTestCase.php +++ b/tests/Import/SchemaTestCase.php @@ -37,7 +37,7 @@ class Doctrine_Import_Schema_TestCase extends Doctrine_UnitTestCase public function testYmlImport() { - $path = dirname(__FILE__) . '/import_builder_test'; + $path = __DIR__ . '/import_builder_test'; $import = new Doctrine_Import_Schema(); $import->importSchema('schema.yml', 'yml', $path); @@ -110,4 +110,4 @@ protected function _verifyMultiDirectionalRelationship($class, $relationAlias, $ return false; } } -} \ No newline at end of file +} diff --git a/tests/Migration/DiffTestCase.php b/tests/Migration/DiffTestCase.php index 7a05d7c1d..7f6eb78d8 100644 --- a/tests/Migration/DiffTestCase.php +++ b/tests/Migration/DiffTestCase.php @@ -34,9 +34,9 @@ class Doctrine_Migration_Diff_TestCase extends Doctrine_UnitTestCase { public function testTest() { - $from = dirname(__FILE__) . '/Diff/schema/from.yml'; - $to = dirname(__FILE__) . '/Diff/schema/to.yml'; - $migrationsPath = dirname(__FILE__) . '/Diff/migrations'; + $from = __DIR__ . '/Diff/schema/from.yml'; + $to = __DIR__ . '/Diff/schema/to.yml'; + $migrationsPath = __DIR__ . '/Diff/migrations'; Doctrine_Lib::makeDirectories($migrationsPath); $diff = new Doctrine_Migration_Diff($from, $to, $migrationsPath); @@ -76,4 +76,4 @@ public function testTest() Doctrine_Lib::removeDirectories($migrationsPath); } -} \ No newline at end of file +} diff --git a/tests/Search/FileTestCase.php b/tests/Search/FileTestCase.php index 7f2a81c34..849626d6f 100644 --- a/tests/Search/FileTestCase.php +++ b/tests/Search/FileTestCase.php @@ -48,7 +48,7 @@ public function testSearchFileAutoCreatesFileTable() public function testIndexDirectoryIndexesAllFiles() { - $this->_search->indexDirectory(dirname(__FILE__) . DIRECTORY_SEPARATOR . '_files'); + $this->_search->indexDirectory(__DIR__ . DIRECTORY_SEPARATOR . '_files'); $resultSet = $this->_search->search('dbms'); diff --git a/tests/Search/IndexerTestCase.php b/tests/Search/IndexerTestCase.php index f24cfbd04..6deb6d0f1 100644 --- a/tests/Search/IndexerTestCase.php +++ b/tests/Search/IndexerTestCase.php @@ -48,7 +48,7 @@ public function testIndexexCanRecursivelyIndexDirectories() $indexer = new Doctrine_Search_Indexer(); - $indexer->indexDirectory(dirname(__FILE__) . DIRECTORY_SEPARATOR . '_files'); + $indexer->indexDirectory(__DIR__ . DIRECTORY_SEPARATOR . '_files'); } public function testIndexerAddsFiles() diff --git a/tests/TaskTestCase.php b/tests/TaskTestCase.php index 7dd644734..f60c70535 100644 --- a/tests/TaskTestCase.php +++ b/tests/TaskTestCase.php @@ -91,7 +91,7 @@ public function testSettasknameSetsTheNameOfTheTask() */ protected function loadPhpFixture($basename) { - require_once(dirname(__FILE__) . '/TaskTestCase/' . $basename); + require_once(__DIR__ . '/TaskTestCase/' . $basename); } public function testSettasknameThrowsAnExceptionIfTheTaskNameIsInvalid() diff --git a/tests/Ticket/1527TestCase.php b/tests/Ticket/1527TestCase.php index 8751aca90..40c8fe188 100644 --- a/tests/Ticket/1527TestCase.php +++ b/tests/Ticket/1527TestCase.php @@ -50,7 +50,7 @@ public function testTest() $schema = $import->buildSchema($yml, 'yml'); $this->assertEqual($schema['Ticket_1527_User']['columns']['username']['extra']['test'], '123'); - $path = dirname(__FILE__) . '/../tmp'; + $path = dirname(__DIR__) . '/tmp'; $import->importSchema($yml, 'yml', $path); require_once($path . '/generated/BaseTicket_1527_User.php'); @@ -58,4 +58,4 @@ public function testTest() $username = Doctrine_Core::getTable('Ticket_1527_User')->getDefinitionOf('username'); $this->assertEqual($username['extra']['test'], '123'); } -} \ No newline at end of file +} diff --git a/tests/Ticket/1727TestCase.php b/tests/Ticket/1727TestCase.php index 968de753e..5be1f3de1 100644 --- a/tests/Ticket/1727TestCase.php +++ b/tests/Ticket/1727TestCase.php @@ -34,36 +34,36 @@ class Doctrine_Ticket_1727_TestCase extends Doctrine_UnitTestCase { public function testTest() { - $models1 = Doctrine_Core::loadModels(dirname(__FILE__) . '/1727/models1', Doctrine_Core::MODEL_LOADING_CONSERVATIVE); - $models2 = Doctrine_Core::loadModels(dirname(__FILE__) . '/1727/models1', Doctrine_Core::MODEL_LOADING_CONSERVATIVE); + $models1 = Doctrine_Core::loadModels(__DIR__ . '/1727/models1', Doctrine_Core::MODEL_LOADING_CONSERVATIVE); + $models2 = Doctrine_Core::loadModels(__DIR__ . '/1727/models1', Doctrine_Core::MODEL_LOADING_CONSERVATIVE); $this->assertEqual($models1, $models2); - $models1 = Doctrine_Core::loadModels(dirname(__FILE__) . '/1727/models1'); - $models2 = Doctrine_Core::loadModels(dirname(__FILE__) . '/1727/models1'); + $models1 = Doctrine_Core::loadModels(__DIR__ . '/1727/models1'); + $models2 = Doctrine_Core::loadModels(__DIR__ . '/1727/models1'); $this->assertEqual($models1, $models2); - $models1 = Doctrine_Core::loadModels(dirname(__FILE__) . '/1727/models1', Doctrine_Core::MODEL_LOADING_CONSERVATIVE); - $models2 = Doctrine_Core::loadModels(dirname(__FILE__) . '/1727/models1', Doctrine_Core::MODEL_LOADING_CONSERVATIVE); + $models1 = Doctrine_Core::loadModels(__DIR__ . '/1727/models1', Doctrine_Core::MODEL_LOADING_CONSERVATIVE); + $models2 = Doctrine_Core::loadModels(__DIR__ . '/1727/models1', Doctrine_Core::MODEL_LOADING_CONSERVATIVE); $this->assertEqual($models1, $models2); - $models1 = Doctrine_Core::loadModels(dirname(__FILE__) . '/1727/models2', Doctrine_Core::MODEL_LOADING_CONSERVATIVE); - $models2 = Doctrine_Core::loadModels(dirname(__FILE__) . '/1727/models2', Doctrine_Core::MODEL_LOADING_CONSERVATIVE); + $models1 = Doctrine_Core::loadModels(__DIR__ . '/1727/models2', Doctrine_Core::MODEL_LOADING_CONSERVATIVE); + $models2 = Doctrine_Core::loadModels(__DIR__ . '/1727/models2', Doctrine_Core::MODEL_LOADING_CONSERVATIVE); $this->assertEqual($models1, $models2); - $models1 = Doctrine_Core::loadModels(dirname(__FILE__) . '/1727/models2'); - $models2 = Doctrine_Core::loadModels(dirname(__FILE__) . '/1727/models2'); + $models1 = Doctrine_Core::loadModels(__DIR__ . '/1727/models2'); + $models2 = Doctrine_Core::loadModels(__DIR__ . '/1727/models2'); $this->assertEqual($models1, $models2); - $models1 = Doctrine_Core::loadModels(dirname(__FILE__) . '/1727/models2', Doctrine_Core::MODEL_LOADING_CONSERVATIVE); - $models2 = Doctrine_Core::loadModels(dirname(__FILE__) . '/1727/models2', Doctrine_Core::MODEL_LOADING_CONSERVATIVE); + $models1 = Doctrine_Core::loadModels(__DIR__ . '/1727/models2', Doctrine_Core::MODEL_LOADING_CONSERVATIVE); + $models2 = Doctrine_Core::loadModels(__DIR__ . '/1727/models2', Doctrine_Core::MODEL_LOADING_CONSERVATIVE); $this->assertEqual($models1, $models2); - $models1 = Doctrine_Core::loadModels(array(dirname(__FILE__) . '/1727/models1', dirname(__FILE__) . '/1727/models2')); - $models2 = Doctrine_Core::loadModels(array(dirname(__FILE__) . '/1727/models1', dirname(__FILE__) . '/1727/models2')); + $models1 = Doctrine_Core::loadModels(array(__DIR__ . '/1727/models1', __DIR__ . '/1727/models2')); + $models2 = Doctrine_Core::loadModels(array(__DIR__ . '/1727/models1', __DIR__ . '/1727/models2')); $this->assertEqual($models1, $models2); - $models1 = Doctrine_Core::loadModels(array(dirname(__FILE__) . '/1727/models1', dirname(__FILE__) . '/1727/models2'), Doctrine_Core::MODEL_LOADING_CONSERVATIVE); - $models2 = Doctrine_Core::loadModels(array(dirname(__FILE__) . '/1727/models1', dirname(__FILE__) . '/1727/models2'), Doctrine_Core::MODEL_LOADING_CONSERVATIVE); + $models1 = Doctrine_Core::loadModels(array(__DIR__ . '/1727/models1', __DIR__ . '/1727/models2'), Doctrine_Core::MODEL_LOADING_CONSERVATIVE); + $models2 = Doctrine_Core::loadModels(array(__DIR__ . '/1727/models1', __DIR__ . '/1727/models2'), Doctrine_Core::MODEL_LOADING_CONSERVATIVE); $this->assertEqual($models1, $models2); } -} \ No newline at end of file +} diff --git a/tests/Ticket/2375TestCase.php b/tests/Ticket/2375TestCase.php index 8d10be404..0eb85c36c 100644 --- a/tests/Ticket/2375TestCase.php +++ b/tests/Ticket/2375TestCase.php @@ -34,8 +34,8 @@ class Doctrine_Ticket_2375_TestCase extends Doctrine_UnitTestCase { public function testTest() { - $models1Dir = dirname(__FILE__) . '/2375/models1'; - $models2Dir = dirname(__FILE__) . '/2375/models2'; + $models1Dir = __DIR__ . '/2375/models1'; + $models2Dir = __DIR__ . '/2375/models2'; // try loading a couple initial models @@ -96,4 +96,4 @@ public function testTest() $this->assertEqual($loadedModels['Ticket_2375_Model5'], $models2Dir . DIRECTORY_SEPARATOR . 'Ticket_2375_Model5.php'); $this->assertEqual($loadedModels['Ticket_2375_Model6'], $models2Dir . DIRECTORY_SEPARATOR . 'Ticket_2375_Model5.php'); } -} \ No newline at end of file +} diff --git a/tests/Ticket/DC221TestCase.php b/tests/Ticket/DC221TestCase.php index 6d7c8ca97..0ce9074cd 100644 --- a/tests/Ticket/DC221TestCase.php +++ b/tests/Ticket/DC221TestCase.php @@ -34,8 +34,8 @@ class Doctrine_Ticket_DC221_TestCase extends Doctrine_UnitTestCase { public function testTest() { - $migration1 = new Doctrine_Migration(dirname(__FILE__) . '/DC221'); - $migration2 = new Doctrine_Migration(dirname(__FILE__) . '/DC221'); + $migration1 = new Doctrine_Migration(__DIR__ . '/DC221'); + $migration2 = new Doctrine_Migration(__DIR__ . '/DC221'); $this->assertEqual($migration1->getMigrationClasses(), $migration2->getMigrationClasses()); } -} \ No newline at end of file +} diff --git a/tests/Ticket/DC292TestCase.php b/tests/Ticket/DC292TestCase.php index e0ecb5f14..73822f1c3 100644 --- a/tests/Ticket/DC292TestCase.php +++ b/tests/Ticket/DC292TestCase.php @@ -34,15 +34,15 @@ class Doctrine_Ticket_DC292_TestCase extends Doctrine_UnitTestCase { public function testTest() { - $dir = dirname(__FILE__) . '/DC292/migrations'; + $dir = __DIR__ . '/DC292/migrations'; if ( ! is_dir($dir)) { mkdir($dir, 0777, true); } $migration = new Doctrine_Migration($dir); - $diff = new Doctrine_Migration_Diff(dirname(__FILE__) . '/DC292/from.yml', dirname(__FILE__) . '/DC292/to.yml', $migration); + $diff = new Doctrine_Migration_Diff(__DIR__ . '/DC292/from.yml', __DIR__ . '/DC292/to.yml', $migration); $changes = $diff->generateChanges(); $this->assertEqual(2, count($changes['created_columns']['article'])); $this->assertTrue(isset($changes['created_columns']['article']['created_at'])); $this->assertTrue(isset($changes['created_columns']['article']['updated_at'])); } -} \ No newline at end of file +} diff --git a/tests/Ticket/DC95TestCase.php b/tests/Ticket/DC95TestCase.php index 247e0378d..f09d31f2d 100644 --- a/tests/Ticket/DC95TestCase.php +++ b/tests/Ticket/DC95TestCase.php @@ -42,7 +42,7 @@ public function testClassDoesNotExistBeforeImport() public function testClassExistsAfterImport() { - Doctrine_Core::setModelsDirectory(dirname(__FILE__) . '/DC95/models'); + Doctrine_Core::setModelsDirectory(__DIR__ . '/DC95/models'); $import = new Doctrine_Import_Schema(); $import->setOptions(array( @@ -52,8 +52,8 @@ public function testClassExistsAfterImport() 'classPrefix' => 'DC95_', 'classPrefixFiles' => true )); - $modelsPath = dirname(__FILE__) . '/DC95/models'; - $import->importSchema(dirname(__FILE__) . '/DC95/schema.yml', 'yml', $modelsPath); + $modelsPath = __DIR__ . '/DC95/models'; + $import->importSchema(__DIR__ . '/DC95/schema.yml', 'yml', $modelsPath); /* $this->assertTrue(file_exists($modelsPath . '/DC95/Base/Article.php')); @@ -63,6 +63,6 @@ public function testClassExistsAfterImport() */ Doctrine_Core::setModelsDirectory(null); - Doctrine_Lib::removeDirectories(dirname(__FILE__) . '/DC95/models'); + Doctrine_Lib::removeDirectories(__DIR__ . '/DC95/models'); } -} \ No newline at end of file +} diff --git a/tests/Ticket/gh110TestCase.php b/tests/Ticket/gh110TestCase.php index 6528b9b43..f140d88ed 100644 --- a/tests/Ticket/gh110TestCase.php +++ b/tests/Ticket/gh110TestCase.php @@ -39,8 +39,8 @@ public function testAddActAsColumnsToDocBlock() ); // Can be used to update the snapshot. - //file_put_contents(dirname(__FILE__) . '/gh110/Ticket_gh110_TestRecord.snapshot', $class); - $this->assertEqual($class, file_get_contents(dirname(__FILE__) . '/gh110/Ticket_gh110_TestRecord.snapshot')); + //file_put_contents(__DIR__ . '/gh110/Ticket_gh110_TestRecord.snapshot', $class); + $this->assertEqual($class, file_get_contents(__DIR__ . '/gh110/Ticket_gh110_TestRecord.snapshot')); } } diff --git a/tests/run.php b/tests/run.php index 2b32582de..d1dd2c7ee 100644 --- a/tests/run.php +++ b/tests/run.php @@ -1,6 +1,6 @@ addTestCase($unsorted); */ -exit($test->run() ? 0 : 1); \ No newline at end of file +exit($test->run() ? 0 : 1); diff --git a/tests/unsolved.php b/tests/unsolved.php index e10461a6b..0009580a0 100644 --- a/tests/unsolved.php +++ b/tests/unsolved.php @@ -1,12 +1,12 @@ ";