From 5ef828701caea00235a87486dc69d878cb016158 Mon Sep 17 00:00:00 2001 From: thePanz Date: Fri, 14 Jun 2024 18:39:11 +0200 Subject: [PATCH] Fix code style, remove extra whitespaces --- lib/Doctrine/Import/Schema.php | 106 +++++++++---------- lib/Doctrine/Parser.php | 6 +- tests/BaseTestCase.php | 4 +- tests/ConnectionTestCase.php | 44 ++++---- tests/Data/ExportTestCase.php | 4 +- tests/Data/ImportTestCase.php | 24 ++--- tests/DoctrineTest/Doctrine_UnitTestCase.php | 1 + tests/DoctrineTest/GroupTest.php | 2 +- tests/DoctrineTest/UnitTestCase.php | 8 +- tests/DriverTestCase.php | 29 ++--- tests/Export/SchemaTestCase.php | 2 +- tests/Export/SqliteTestCase.php | 28 ++--- tests/Import/BuilderTestCase.php | 6 +- tests/Import/PluginHierarchyTestCase.php | 6 +- tests/Import/SchemaTestCase.php | 20 ++-- tests/ImportTestCase.php | 8 +- tests/Migration/DiffTestCase.php | 4 +- tests/ParserTestCase.php | 20 ++-- tests/Ticket/1118TestCase.php | 4 +- tests/Ticket/1351TestCase.php | 4 +- tests/Ticket/1527TestCase.php | 4 +- tests/Ticket/1617TestCase.php | 4 +- tests/Ticket/2355TestCase.php | 6 +- tests/Ticket/915TestCase.php | 4 +- tests/Ticket/DC147TestCase.php | 10 +- tests/Ticket/DC23TestCase.php | 8 +- tests/Ticket/DC23bTestCase.php | 16 +-- tests/Ticket/DC95TestCase.php | 2 +- 28 files changed, 192 insertions(+), 192 deletions(-) diff --git a/lib/Doctrine/Import/Schema.php b/lib/Doctrine/Import/Schema.php index 65ea075d5..25dc4869b 100644 --- a/lib/Doctrine/Import/Schema.php +++ b/lib/Doctrine/Import/Schema.php @@ -154,7 +154,7 @@ class Doctrine_Import_Schema /** * Returns an array of definition keys that can be applied at the global level. - * + * * @return array */ public static function getGlobalDefinitionKeys() @@ -165,7 +165,7 @@ public static function getGlobalDefinitionKeys() /** * getOption * - * @param string $name + * @param string $name * @return void */ public function getOption($name) @@ -188,8 +188,8 @@ public function getOptions() /** * setOption * - * @param string $name - * @param string $value + * @param string $name + * @param string $value * @return void */ public function setOption($name, $value) @@ -198,11 +198,11 @@ public function setOption($name, $value) $this->_options[$name] = $value; } } - + /** * setOptions * - * @param string $options + * @param array $options * @return void */ public function setOptions($options) @@ -230,7 +230,7 @@ public function buildSchema($schema, $format) $e = explode('.', $s); if (end($e) === $format) { $array = array_merge($array, $this->parseSchema($s, $format)); - } + } } else if (is_dir($s)) { $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($s), RecursiveIteratorIterator::LEAVES_ONLY); @@ -270,20 +270,20 @@ public function importSchema($schema, $format = 'yml', $directory = null, $model $builder = new Doctrine_Import_Builder(); $builder->setTargetPath($directory); $builder->setOptions($this->getOptions()); - + $array = $this->buildSchema($schema, $format); - if (count($array) == 0) { + if (count($array) == 0) { throw new Doctrine_Import_Exception( sprintf('No ' . $format . ' schema found in ' . implode(", ", $schema)) - ); + ); } foreach ($array as $name => $definition) { if ( ! empty($models) && !in_array($definition['className'], $models)) { continue; } - + $builder->buildRecord($definition); } } @@ -313,7 +313,7 @@ public function parseSchema($schema, $type) 'package' => null, 'inheritance' => array(), 'detect_relations' => false); - + $array = Doctrine_Parser::load($schema, $type); // Loop over and build up all the global values and remove them from the array @@ -431,14 +431,14 @@ public function parseSchema($schema, $type) $build[$className][$key] = isset($build[$className][$key]) ? $build[$className][$key]:$defaultValue; } } - + $build[$className]['className'] = $className; $build[$className]['tableName'] = $tableName; $build[$className]['columns'] = $columns; - + // Make sure that anything else that is specified in the schema makes it to the final array $build[$className] = Doctrine_Lib::arrayDeepMerge($table, $build[$className]); - + // We need to keep track of the className for the connection $build[$className]['connectionClassName'] = $build[$className]['className']; } @@ -448,11 +448,11 @@ public function parseSchema($schema, $type) /** * _processInheritance - * + * * Perform some processing on inheritance. * Sets the default type and sets some default values for certain types * - * @param string $array + * @param string $array * @return void */ protected function _processInheritance($array) @@ -472,9 +472,9 @@ protected function _processInheritance($array) if ($array[$className]['inheritance']['type'] == 'column_aggregation') { // Set the keyField to 'type' by default if ( ! isset($array[$className]['inheritance']['keyField'])) { - $array[$className]['inheritance']['keyField'] = 'type'; + $array[$className]['inheritance']['keyField'] = 'type'; } - + // Set the keyValue to the name of the child class if it does not exist if ( ! isset($array[$className]['inheritance']['keyValue'])) { $array[$className]['inheritance']['keyValue'] = $className; @@ -510,22 +510,22 @@ protected function _processInheritance($array) // Populate the parents subclasses if ($definition['inheritance']['type'] == 'column_aggregation') { - // Fix for 2015: loop through superclasses' inheritance to the base-superclass to - // make sure we collect all keyFields needed (and not only the first) - $inheritanceFields = array($definition['inheritance']['keyField'] => $definition['inheritance']['keyValue']); + // Fix for 2015: loop through superclasses' inheritance to the base-superclass to + // make sure we collect all keyFields needed (and not only the first) + $inheritanceFields = array($definition['inheritance']['keyField'] => $definition['inheritance']['keyValue']); - $superClass = $definition['inheritance']['extends']; - $multiInheritanceDef = $array[$superClass]; + $superClass = $definition['inheritance']['extends']; + $multiInheritanceDef = $array[$superClass]; - while (count($multiInheritanceDef['inheritance']) > 0 && array_key_exists('extends', $multiInheritanceDef['inheritance']) && $multiInheritanceDef['inheritance']['type'] == 'column_aggregation') { + while (count($multiInheritanceDef['inheritance']) > 0 && array_key_exists('extends', $multiInheritanceDef['inheritance']) && $multiInheritanceDef['inheritance']['type'] == 'column_aggregation') { $superClass = $multiInheritanceDef['inheritance']['extends']; - + // keep original keyField with it's keyValue - if ( ! isset($inheritanceFields[$multiInheritanceDef['inheritance']['keyField']])) { + if ( ! isset($inheritanceFields[$multiInheritanceDef['inheritance']['keyField']])) { $inheritanceFields[$multiInheritanceDef['inheritance']['keyField']] = $multiInheritanceDef['inheritance']['keyValue']; - } - $multiInheritanceDef = $array[$superClass]; - } + } + $multiInheritanceDef = $array[$superClass]; + } $array[$parent]['inheritance']['subclasses'][$definition['className']] = $inheritanceFields; } @@ -555,10 +555,10 @@ protected function _findBaseSuperClass($array, $class) * buildRelationships * * Loop through an array of schema information and build all the necessary relationship information - * Will attempt to auto complete relationships and simplify the amount of information required + * Will attempt to auto complete relationships and simplify the amount of information required * for defining a relationship * - * @param string $array + * @param string $array * @return void */ protected function _buildRelationships($array) @@ -591,10 +591,10 @@ protected function _buildRelationships($array) if ( ! isset($properties['relations'])) { continue; } - + $className = $properties['className']; $relations = $properties['relations']; - + foreach ($relations as $alias => $relation) { $class = isset($relation['class']) ? $relation['class']:$alias; if ( ! isset($array[$class])) { @@ -602,7 +602,7 @@ protected function _buildRelationships($array) } $relation['class'] = $class; $relation['alias'] = isset($relation['alias']) ? $relation['alias'] : $alias; - + // Attempt to guess the local and foreign if (isset($relation['refClass'])) { $relation['local'] = isset($relation['local']) ? $relation['local']:Doctrine_Inflector::tableize($name) . '_id'; @@ -611,11 +611,11 @@ protected function _buildRelationships($array) $relation['local'] = isset($relation['local']) ? $relation['local']:Doctrine_Inflector::tableize($relation['class']) . '_id'; $relation['foreign'] = isset($relation['foreign']) ? $relation['foreign']:'id'; } - + if (isset($relation['refClass'])) { $relation['type'] = 'many'; } - + if (isset($relation['type']) && $relation['type']) { $relation['type'] = $relation['type'] === 'one' ? Doctrine_Relation::ONE:Doctrine_Relation::MANY; } else { @@ -625,18 +625,18 @@ protected function _buildRelationships($array) if (isset($relation['foreignType']) && $relation['foreignType']) { $relation['foreignType'] = $relation['foreignType'] === 'one' ? Doctrine_Relation::ONE:Doctrine_Relation::MANY; } - + $relation['key'] = $this->_buildUniqueRelationKey($relation); - + $this->_validateSchemaElement('relation', array_keys($relation), $className . '->relation->' . $relation['alias']); - + $this->_relations[$className][$alias] = $relation; } } - + // Now we auto-complete opposite ends of relationships $this->_autoCompleteOppositeRelations(); - + // Make sure we do not have any duplicate relations $this->_fixDuplicateRelations(); @@ -644,7 +644,7 @@ protected function _buildRelationships($array) foreach ($this->_relations as $className => $relations) { $array[$className]['relations'] = $relations; } - + return $array; } @@ -663,22 +663,22 @@ protected function _autoCompleteOppositeRelations() if ((isset($relation['equal']) && $relation['equal']) || (isset($relation['autoComplete']) && $relation['autoComplete'] === false)) { continue; } - + $newRelation = array(); $newRelation['foreign'] = $relation['local']; $newRelation['local'] = $relation['foreign']; $newRelation['class'] = isset($relation['foreignClass']) ? $relation['foreignClass']:$className; $newRelation['alias'] = isset($relation['foreignAlias']) ? $relation['foreignAlias']:$className; $newRelation['foreignAlias'] = $alias; - + // this is so that we know that this relation was autogenerated and // that we do not need to include it if it is explicitly declared in the schema by the users. - $newRelation['autogenerated'] = true; - + $newRelation['autogenerated'] = true; + if (isset($relation['refClass'])) { $newRelation['refClass'] = $relation['refClass']; $newRelation['type'] = isset($relation['foreignType']) ? $relation['foreignType']:$relation['type']; - } else { + } else { if (isset($relation['foreignType'])) { $newRelation['type'] = $relation['foreignType']; } else { @@ -720,7 +720,7 @@ protected function _fixDuplicateRelations() } } } - + $this->_relations[$className] = $uniqueRelations; } } @@ -731,7 +731,7 @@ protected function _fixDuplicateRelations() * Build a unique key to identify a relationship by * Md5 hash of all the relationship parameters * - * @param string $relation + * @param string $relation * @return void */ protected function _buildUniqueRelationKey($relation) @@ -742,8 +742,8 @@ protected function _buildUniqueRelationKey($relation) /** * _validateSchemaElement * - * @param string $name - * @param string $value + * @param string $name + * @param string $value * @return void */ protected function _validateSchemaElement($name, $element, $path) @@ -768,4 +768,4 @@ protected function _validateSchemaElement($name, $element, $path) } } } -} \ No newline at end of file +} diff --git a/lib/Doctrine/Parser.php b/lib/Doctrine/Parser.php index d9c8c124d..8d7571e98 100644 --- a/lib/Doctrine/Parser.php +++ b/lib/Doctrine/Parser.php @@ -62,7 +62,7 @@ abstract public function dumpData($array, $path = null, $charset = null); * Get instance of the specified parser * * @param string $type - * @return void + * @return Doctrine_Parser * @author Jonathan H. Wage */ static public function getParser($type) @@ -94,7 +94,7 @@ static public function load($path, $type = 'xml', $charset = 'UTF-8') * * Interface for pulling and dumping data to a file * - * @param string $array + * @param array $array * @param string $path * @param string $type * @param string $charset The charset of the data being dumped @@ -115,7 +115,7 @@ static public function dump($array, $type = 'xml', $path = null, $charset = null * Either should allow php code in it. * * @param string $path - * @return void + * @return false|string */ public function doLoad($path) { diff --git a/tests/BaseTestCase.php b/tests/BaseTestCase.php index 5a865cab2..ae65c91f3 100644 --- a/tests/BaseTestCase.php +++ b/tests/BaseTestCase.php @@ -45,7 +45,7 @@ public function testAggressiveModelLoading() // Make sure it does not include the base classes $this->assertTrue( ! isset($models['BaseAggressiveModelLoadingUser'])); - + $filteredModels = Doctrine_Core::filterInvalidModels($models); // Make sure filterInvalidModels filters out base abstract classes @@ -85,7 +85,7 @@ public function testModelLoadingCacheInformation() $this->assertTrue(in_array('AggressiveModelLoadingUser', $models)); $this->assertTrue(in_array('ConservativeModelLoadingProfile', $models)); $this->assertTrue(in_array('ConservativeModelLoadingContact', $models)); - + $modelFiles = Doctrine_Core::getLoadedModelFiles(); $this->assertTrue(file_exists($modelFiles['ConservativeModelLoadingUser'])); $this->assertTrue(file_exists($modelFiles['ConservativeModelLoadingProfile'])); diff --git a/tests/ConnectionTestCase.php b/tests/ConnectionTestCase.php index 70d3f28be..9a4b0072a 100644 --- a/tests/ConnectionTestCase.php +++ b/tests/ConnectionTestCase.php @@ -30,10 +30,10 @@ * @since 1.0 * @version $Revision$ */ -class Doctrine_Connection_TestCase extends Doctrine_UnitTestCase +class Doctrine_Connection_TestCase extends Doctrine_UnitTestCase { - public function testUnknownModule() + public function testUnknownModule() { try { $this->connection->unknown; @@ -43,7 +43,7 @@ public function testUnknownModule() } } - public function testGetModule() + public function testGetModule() { $this->assertTrue($this->connection->unitOfWork instanceof Doctrine_Connection_UnitOfWork); //$this->assertTrue($this->connection->dataDict instanceof Doctrine_DataDict); @@ -52,7 +52,7 @@ public function testGetModule() $this->assertTrue($this->connection->export instanceof Doctrine_Export); } - public function testFetchAll() + public function testFetchAll() { $this->conn->exec('DROP TABLE entity'); $this->conn->exec('CREATE TABLE entity (id INT, name TEXT)'); @@ -80,16 +80,16 @@ public function testFetchAll() public function testFetchOne() { $c = $this->conn->fetchOne('SELECT COUNT(1) FROM entity'); - + $this->assertEqual($c, 2); - + $c = $this->conn->fetchOne('SELECT COUNT(1) FROM entity WHERE id = ?', array(1)); - + $this->assertEqual($c, 1); } - - public function testFetchColumn() + + public function testFetchColumn() { $a = $this->conn->fetchColumn('SELECT * FROM entity'); @@ -105,7 +105,7 @@ public function testFetchColumn() )); } - public function testFetchArray() + public function testFetchArray() { $a = $this->conn->fetchArray('SELECT * FROM entity'); @@ -122,7 +122,7 @@ public function testFetchArray() )); } - public function testFetchRow() + public function testFetchRow() { $c = $this->conn->fetchRow('SELECT * FROM entity'); @@ -132,24 +132,24 @@ public function testFetchRow() )); $c = $this->conn->fetchRow('SELECT * FROM entity WHERE id = ?', array(1)); - + $this->assertEqual($c, array ( 'id' => '1', 'name' => 'zYne', )); } - public function testFetchPairs() + public function testFetchPairs() { $this->conn->exec('DROP TABLE entity'); } - public function testGetManager() + public function testGetManager() { $this->assertTrue($this->connection->getManager() === $this->manager); } - public function testDeleteOnTransientRecordIsIgnored() + public function testDeleteOnTransientRecordIsIgnored() { $user = $this->connection->create('User'); try { @@ -159,7 +159,7 @@ public function testDeleteOnTransientRecordIsIgnored() } } - public function testGetTable() + public function testGetTable() { $table = $this->connection->getTable('Group'); $this->assertTrue($table instanceof Doctrine_Table); @@ -176,23 +176,23 @@ public function testGetTable() } - public function testCreate() + public function testCreate() { $email = $this->connection->create('Email'); $this->assertTrue($email instanceof Email); } - public function testGetDbh() + public function testGetDbh() { $this->assertTrue($this->connection->getDbh() instanceof PDO); } - public function testCount() + public function testCount() { $this->assertTrue(is_integer(count($this->connection))); } - public function testGetIterator() + public function testGetIterator() { $this->assertTrue($this->connection->getIterator() instanceof ArrayIterator); } @@ -203,12 +203,12 @@ public function testGetState() $this->assertEqual(Doctrine_Lib::getConnectionStateAsString($this->connection->transaction->getState()), 'open'); } - public function testGetTables() + public function testGetTables() { $this->assertTrue(is_array($this->connection->getTables())); } - public function testRollback() + public function testRollback() { $this->connection->beginTransaction(); $this->assertEqual($this->connection->transaction->getTransactionLevel(),1); diff --git a/tests/Data/ExportTestCase.php b/tests/Data/ExportTestCase.php index 3c176c3d0..03d6e5fa2 100644 --- a/tests/Data/ExportTestCase.php +++ b/tests/Data/ExportTestCase.php @@ -30,7 +30,7 @@ * @since 1.0 * @version $Revision$ */ -class Doctrine_Data_Export_TestCase extends Doctrine_UnitTestCase +class Doctrine_Data_Export_TestCase extends Doctrine_UnitTestCase { public function prepareTables() { @@ -93,4 +93,4 @@ public function setUp() { $this->actAs('I18n', array('fields' => array('name', 'title'))); } -} \ No newline at end of file +} diff --git a/tests/Data/ImportTestCase.php b/tests/Data/ImportTestCase.php index fa07a25cd..76e67dccb 100644 --- a/tests/Data/ImportTestCase.php +++ b/tests/Data/ImportTestCase.php @@ -30,7 +30,7 @@ * @since 1.0 * @version $Revision$ */ -class Doctrine_Data_Import_TestCase extends Doctrine_UnitTestCase +class Doctrine_Data_Import_TestCase extends Doctrine_UnitTestCase { public function prepareTables() { @@ -43,17 +43,17 @@ public function prepareTables() $this->tables[] = 'I18nNumberLang'; parent::prepareTables(); } - + public function testInlineMany() { $yml = <<assertEqual($i[4]['rgt'], 3); $this->assertEqual($i[4]['level'], 1); $this->assertEqual($i[4]['root_id'], $i[3]['root_id']); - + $this->assertEqual($i[5]['name'], 'Item 2.2'); $this->assertEqual($i[5]['lft'], 4); $this->assertEqual($i[5]['rgt'], 11); @@ -367,7 +367,7 @@ public function testMany2ManyManualDataFixtures() unlink('test.yml'); } - + public function testInvalidElementThrowsException() { self::prepareTables(); @@ -609,4 +609,4 @@ public function setUp() { $this->actAs('I18n', array('fields' => array('name', 'title'))); } -} \ No newline at end of file +} diff --git a/tests/DoctrineTest/Doctrine_UnitTestCase.php b/tests/DoctrineTest/Doctrine_UnitTestCase.php index a1f0fb2f7..3fa7bcbcd 100644 --- a/tests/DoctrineTest/Doctrine_UnitTestCase.php +++ b/tests/DoctrineTest/Doctrine_UnitTestCase.php @@ -48,6 +48,7 @@ class Doctrine_UnitTestCase extends UnitTestCase protected $generic = false; protected $conn; protected $adapter; + /** @var Doctrine_Export */ protected $export; protected $expr; protected $dataDict; diff --git a/tests/DoctrineTest/GroupTest.php b/tests/DoctrineTest/GroupTest.php index b17f5e37e..5f4eb14b9 100644 --- a/tests/DoctrineTest/GroupTest.php +++ b/tests/DoctrineTest/GroupTest.php @@ -109,4 +109,4 @@ public function getTestCases() { return $this->_testCases; } -} \ No newline at end of file +} diff --git a/tests/DoctrineTest/UnitTestCase.php b/tests/DoctrineTest/UnitTestCase.php index f1aca2fe5..cfa461e13 100644 --- a/tests/DoctrineTest/UnitTestCase.php +++ b/tests/DoctrineTest/UnitTestCase.php @@ -2,9 +2,7 @@ class UnitTestCase { protected $_passed = 0; - protected $_failed = 0; - protected $_messages = array(); protected static $_passesAndFails = array('passes' => array(), 'fails' => array()); @@ -115,7 +113,7 @@ public function assertNotNull($expr) } } - public function pass() + public function pass() { $class = get_class($this); if ( ! isset(self::$_passesAndFails['fails'][$class])) { @@ -126,7 +124,7 @@ public function pass() public function fail($message = "") { - $this->_fail($message); + $this->_fail($message); } public function _fail($message = "") @@ -166,7 +164,7 @@ public function run(DoctrineTest_Reporter $reporter = null, $filter = null) } } - public function getMessages() + public function getMessages() { return $this->_messages; } diff --git a/tests/DriverTestCase.php b/tests/DriverTestCase.php index c247eed3c..1369d39c6 100644 --- a/tests/DriverTestCase.php +++ b/tests/DriverTestCase.php @@ -1,29 +1,29 @@ name = $name; } - public function getName() + public function getName() { return $this->name; } - public function pop() + public function pop() { return array_pop($this->queries); } - public function forceException($name, $message = '', $code = 0) + public function forceException($name, $message = '', $code = 0) { $this->exception = array($name, $message, $code); } @@ -102,7 +102,7 @@ public function lastInsertId() } public function beginTransaction() - { + { $this->queries[] = 'BEGIN TRANSACTION'; } @@ -111,8 +111,8 @@ public function commit() $this->queries[] = 'COMMIT'; } - public function rollBack() - { + public function rollBack() + { $this->queries[] = 'ROLLBACK'; } @@ -142,7 +142,7 @@ public function setAttribute($attribute, $value) class AdapterStatementMock { private $mock; - + private $query; public function __construct(AdapterMock $mock, $query) @@ -180,6 +180,7 @@ class Doctrine_Driver_UnitTestCase extends UnitTestCase protected $manager; protected $conn; protected $adapter; + /** @var Doctrine_Export */ protected $export; protected $dataDict; protected $transaction; @@ -224,12 +225,12 @@ public function init() if ($this->adapter->getName() == 'oci') $name = 'Oracle'; - + $tx = 'Doctrine_Transaction_' . ucwords($name); $dataDict = 'Doctrine_DataDict_' . ucwords($name); - + $exc = 'Doctrine_Connection_' . ucwords($name) . '_Exception'; - + $this->exc = new $exc(); if (class_exists($tx)) $this->transaction = new $tx($this->conn); diff --git a/tests/Export/SchemaTestCase.php b/tests/Export/SchemaTestCase.php index b1f0d2943..fabb76a0a 100644 --- a/tests/Export/SchemaTestCase.php +++ b/tests/Export/SchemaTestCase.php @@ -30,7 +30,7 @@ * @since 1.0 * @version $Revision$ */ -class Doctrine_Export_Schema_TestCase extends Doctrine_UnitTestCase +class Doctrine_Export_Schema_TestCase extends Doctrine_UnitTestCase { public $tables = array('Entity', 'EntityReference', diff --git a/tests/Export/SqliteTestCase.php b/tests/Export/SqliteTestCase.php index 377696153..0227f02aa 100644 --- a/tests/Export/SqliteTestCase.php +++ b/tests/Export/SqliteTestCase.php @@ -30,7 +30,7 @@ * @since 1.0 * @version $Revision$ */ -class Doctrine_Export_Sqlite_TestCase extends Doctrine_UnitTestCase +class Doctrine_Export_Sqlite_TestCase extends Doctrine_UnitTestCase { public function testCreateDatabaseDoesNotExecuteSqlAndCreatesSqliteFile() { @@ -44,17 +44,17 @@ public function testDropDatabaseDoesNotExecuteSqlAndDeletesSqliteFile() $this->assertFalse(file_exists('sqlite.db')); } - public function testCreateTableSupportsAutoincPks() + public function testCreateTableSupportsAutoincPks() { $name = 'mytable'; - + $fields = array('id' => array('type' => 'integer', 'unsigned' => 1, 'autoincrement' => true)); $this->export->createTable($name, $fields); $this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (id INTEGER PRIMARY KEY AUTOINCREMENT)'); } - public function testCreateTableSupportsDefaultAttribute() + public function testCreateTableSupportsDefaultAttribute() { $name = 'mytable'; $fields = array('name' => array('type' => 'char', 'length' => 10, 'default' => 'def'), @@ -66,15 +66,15 @@ public function testCreateTableSupportsDefaultAttribute() $this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (name CHAR(10) DEFAULT \'def\', type INTEGER DEFAULT 12, PRIMARY KEY(name, type))'); } - public function testCreateTableSupportsMultiplePks() + public function testCreateTableSupportsMultiplePks() { $name = 'mytable'; $fields = array('name' => array('type' => 'char', 'length' => 10), 'type' => array('type' => 'integer', 'length' => 3)); - + $options = array('primary' => array('name', 'type')); $this->export->createTable($name, $fields, $options); - + $this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (name CHAR(10), type INTEGER, PRIMARY KEY(name, type))'); } public function testCreateTableSupportsIndexes() @@ -89,7 +89,7 @@ public function testCreateTableSupportsIndexes() $this->export->createTable('sometable', $fields, $options); - //this was the old line, but it looks like the table is created first + //this was the old line, but it looks like the table is created first //and then the index so i replaced it with the ones below //$this->assertEqual($var, 'CREATE TABLE sometable (id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(4), INDEX myindex (id, name))'); @@ -111,7 +111,7 @@ public function testIdentifierQuoting() $this->export->createTable('sometable', $fields, $options); - //this was the old line, but it looks like the table is created first + //this was the old line, but it looks like the table is created first //and then the index so i replaced it with the ones below //$this->assertEqual($var, 'CREATE TABLE sometable (id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(4), INDEX myindex (id, name))'); @@ -121,17 +121,17 @@ public function testIdentifierQuoting() $this->conn->setAttribute(Doctrine_Core::ATTR_QUOTE_IDENTIFIER, false); } - public function testQuoteMultiplePks() + public function testQuoteMultiplePks() { $this->conn->setAttribute(Doctrine_Core::ATTR_QUOTE_IDENTIFIER, true); $name = 'mytable'; $fields = array('name' => array('type' => 'char', 'length' => 10), 'type' => array('type' => 'integer', 'length' => 3)); - + $options = array('primary' => array('name', 'type')); $this->export->createTable($name, $fields, $options); - + $this->assertEqual($this->adapter->pop(), 'CREATE TABLE "mytable" ("name" CHAR(10), "type" INTEGER, PRIMARY KEY("name", "type"))'); $this->conn->setAttribute(Doctrine_Core::ATTR_QUOTE_IDENTIFIER, false); @@ -157,14 +157,14 @@ public function testCreateTableSupportsIndexesWithCustomSorting() $options = array('primary' => array('id'), 'indexes' => array('myindex' => array( 'fields' => array( - 'id' => array('sorting' => 'ASC'), + 'id' => array('sorting' => 'ASC'), 'name' => array('sorting' => 'DESC') ) )) ); $this->export->createTable('sometable', $fields, $options); - + //removed this assertion and inserted the two below // $this->assertEqual($this->adapter->pop(), 'CREATE TABLE sometable (id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(4), INDEX myindex (id ASC, name DESC))'); diff --git a/tests/Import/BuilderTestCase.php b/tests/Import/BuilderTestCase.php index 84f0804c5..5de915e88 100644 --- a/tests/Import/BuilderTestCase.php +++ b/tests/Import/BuilderTestCase.php @@ -30,7 +30,7 @@ * @since 1.0 * @version $Revision$ */ -class Doctrine_Import_Builder_TestCase extends Doctrine_UnitTestCase +class Doctrine_Import_Builder_TestCase extends Doctrine_UnitTestCase { public function testInheritanceGeneration() { @@ -55,10 +55,10 @@ public function testInheritanceGeneration() $this->assertTrue($schemaTestInheritanceParent->isSubclassOf('PackageSchemaTestInheritanceParent')); $this->assertTrue($schemaTestInheritanceChild1->isSubclassOf('BaseSchemaTestInheritanceChild1')); $this->assertTrue($schemaTestInheritanceChild2->isSubclassOf('BaseSchemaTestInheritanceChild2')); - + $this->assertTrue($schemaTestInheritanceChild1->isSubclassOf('SchemaTestInheritanceParent')); $this->assertTrue($schemaTestInheritanceChild1->isSubclassOf('BaseSchemaTestInheritanceParent')); - + $this->assertTrue($schemaTestInheritanceChild2->isSubclassOf('SchemaTestInheritanceParent')); $this->assertTrue($schemaTestInheritanceChild2->isSubclassOf('BaseSchemaTestInheritanceParent')); $this->assertTrue($schemaTestInheritanceChild2->isSubclassOf('SchemaTestInheritanceChild1')); diff --git a/tests/Import/PluginHierarchyTestCase.php b/tests/Import/PluginHierarchyTestCase.php index 26df10f42..0d286e1fb 100644 --- a/tests/Import/PluginHierarchyTestCase.php +++ b/tests/Import/PluginHierarchyTestCase.php @@ -75,11 +75,11 @@ public function testImportOfHieriarchyOfPluginGeneration() 3 => 'CREATE TABLE wiki_test (id INTEGER PRIMARY KEY AUTOINCREMENT)', 4 => 'CREATE UNIQUE INDEX wiki_test_translation_sluggable_idx ON wiki_test_translation (slug)', ); - + foreach($sql as $idx => $req) { $this->assertEqual($req, $result[$idx]); - } - + } + Doctrine_Lib::removeDirectories($path); unlink('wiki.yml'); } diff --git a/tests/Import/SchemaTestCase.php b/tests/Import/SchemaTestCase.php index c47a30358..05b021b60 100644 --- a/tests/Import/SchemaTestCase.php +++ b/tests/Import/SchemaTestCase.php @@ -30,11 +30,11 @@ * @since 1.0 * @version $Revision$ */ -class Doctrine_Import_Schema_TestCase extends Doctrine_UnitTestCase +class Doctrine_Import_Schema_TestCase extends Doctrine_UnitTestCase { public $buildSchema; public $schema; - + public function testYmlImport() { $path = __DIR__ . '/import_builder_test'; @@ -45,7 +45,7 @@ public function testYmlImport() if ( ! file_exists($path . '/SchemaTestUser.php')) { $this->fail(); } - + if ( ! file_exists($path . '/SchemaTestProfile.php')) { $this->fail(); } @@ -54,7 +54,7 @@ public function testYmlImport() Doctrine_Lib::removeDirectories($path); } - + public function testBuildSchema() { $schema = new Doctrine_Import_Schema(); @@ -77,7 +77,7 @@ public function testBuildSchema() $this->assertTrue(array_key_exists('detect_relations', $model) && is_bool($model['detect_relations'])); $this->assertEqual($array['AliasTest']['columns']['test_col']['name'], 'test_col as test_col_alias'); } - + public function testSchemaRelationshipCompletion() { $this->buildSchema = new Doctrine_Import_Schema(); @@ -87,22 +87,22 @@ public function testSchemaRelationshipCompletion() foreach ($properties['relations'] as $alias => $relation) { if ( ! $this->_verifyMultiDirectionalRelationship($name, $alias, $relation)) { $this->fail(); - + return false; } } } - + $this->pass(); } - + protected function _verifyMultiDirectionalRelationship($class, $relationAlias, $relation) { $foreignClass = $relation['class']; $foreignAlias = isset($relation['foreignAlias']) ? $relation['foreignAlias']:$class; - + $foreignClassRelations = $this->schema[$foreignClass]['relations']; - + // Check to see if the foreign class has the opposite end defined for the class/foreignAlias if (isset($foreignClassRelations[$foreignAlias])) { return true; diff --git a/tests/ImportTestCase.php b/tests/ImportTestCase.php index 8d062a252..3fbe5f276 100644 --- a/tests/ImportTestCase.php +++ b/tests/ImportTestCase.php @@ -30,11 +30,11 @@ * @since 1.0 * @version $Revision$ */ -class Doctrine_Import_TestCase extends Doctrine_UnitTestCase +class Doctrine_Import_TestCase extends Doctrine_UnitTestCase { - public function prepareTables() + public function prepareTables() { } - public function prepareData() + public function prepareData() { } public function testImport() @@ -51,4 +51,4 @@ public function testImport() $this->assertTrue(file_exists('Import/_files/generated/BaseImportTestUser.php')); Doctrine_Lib::removeDirectories('Import/_files'); } -} \ No newline at end of file +} diff --git a/tests/Migration/DiffTestCase.php b/tests/Migration/DiffTestCase.php index 7f6eb78d8..bfd0b2514 100644 --- a/tests/Migration/DiffTestCase.php +++ b/tests/Migration/DiffTestCase.php @@ -30,7 +30,7 @@ * @since 1.0 * @version $Revision$ */ -class Doctrine_Migration_Diff_TestCase extends Doctrine_UnitTestCase +class Doctrine_Migration_Diff_TestCase extends Doctrine_UnitTestCase { public function testTest() { @@ -60,7 +60,7 @@ public function testTest() $this->assertEqual(count($files), 2); $this->assertTrue(strpos($files[0], '_version1.php')); $this->assertTrue(strpos($files[1], '_version2.php')); - + $code1 = file_get_contents($files[0]); $this->assertTrue(strpos($code1, 'this->dropTable')); $this->assertTrue(strpos($code1, 'this->createTable')); diff --git a/tests/ParserTestCase.php b/tests/ParserTestCase.php index 7f5e54862..8afca682d 100644 --- a/tests/ParserTestCase.php +++ b/tests/ParserTestCase.php @@ -30,19 +30,19 @@ * @since 1.0 * @version $Revision$ */ -class Doctrine_Parser_TestCase extends Doctrine_UnitTestCase +class Doctrine_Parser_TestCase extends Doctrine_UnitTestCase { public function testGetParserInstance() { $instance = Doctrine_Parser::getParser('Yml'); - + if ($instance instanceof Doctrine_Parser_Yml) { $this->pass(); } else { $this->fail(); } } - + public function testFacadeLoadAndDump() { Doctrine_Parser::dump(array('test' => 'good job', 'test2' => true, array('testing' => false)), 'yml', 'test.yml'); @@ -51,7 +51,7 @@ public function testFacadeLoadAndDump() $this->assertEqual($array, array('test' => 'good job', 'test2' => true, array('testing' => false))); unlink('test.yml'); } - + public function testParserSupportsEmbeddingPhpSyntax() { $parser = Doctrine_Parser::getParser('Yml'); @@ -62,12 +62,12 @@ public function testParserSupportsEmbeddingPhpSyntax() w00t: not now "; $data = $parser->doLoad($yml); - + $array = $parser->loadData($data); - + $this->assertEqual($array, array('test' => 'good job', 'test2' => true, 'testing' => false, 'w00t' => 'not now')); } - + public function testParserWritingToDisk() { $parser = Doctrine_Parser::getParser('Yml'); @@ -76,15 +76,15 @@ public function testParserWritingToDisk() $this->assertEqual('test', file_get_contents('test.yml')); unlink('test.yml'); } - + public function testParserReturningLoadedData() { $parser = Doctrine_Parser::getParser('Yml'); $result = $parser->doDump('test'); - + $this->assertEqual('test', $result); } - + public function testLoadFromString() { $yml = "--- diff --git a/tests/Ticket/1118TestCase.php b/tests/Ticket/1118TestCase.php index 44aa90c50..3f0d9a54b 100644 --- a/tests/Ticket/1118TestCase.php +++ b/tests/Ticket/1118TestCase.php @@ -30,7 +30,7 @@ * @since 1.0 * @version $Revision$ */ -class Doctrine_Ticket_1118_TestCase extends Doctrine_UnitTestCase +class Doctrine_Ticket_1118_TestCase extends Doctrine_UnitTestCase { // Test that when a foreign key is detected that it sets the foreign key to the same type and length // of the related table primary key @@ -70,4 +70,4 @@ public function testTest() unlink('test.yml'); } -} \ No newline at end of file +} diff --git a/tests/Ticket/1351TestCase.php b/tests/Ticket/1351TestCase.php index 8a7a6b27a..e402926ea 100644 --- a/tests/Ticket/1351TestCase.php +++ b/tests/Ticket/1351TestCase.php @@ -30,7 +30,7 @@ * @since 1.0 * @version $Revision$ */ -class Doctrine_Ticket_1351_TestCase extends Doctrine_UnitTestCase +class Doctrine_Ticket_1351_TestCase extends Doctrine_UnitTestCase { public function prepareTables() { @@ -76,4 +76,4 @@ public function setUp() $i18n0->addChild($searchable1); $this->actAs($i18n0); } -} \ No newline at end of file +} diff --git a/tests/Ticket/1527TestCase.php b/tests/Ticket/1527TestCase.php index 40c8fe188..6d23902df 100644 --- a/tests/Ticket/1527TestCase.php +++ b/tests/Ticket/1527TestCase.php @@ -30,7 +30,7 @@ * @since 1.0 * @version $Revision$ */ -class Doctrine_Ticket_1527_TestCase extends Doctrine_UnitTestCase +class Doctrine_Ticket_1527_TestCase extends Doctrine_UnitTestCase { public function testTest() { @@ -52,7 +52,7 @@ public function testTest() $path = dirname(__DIR__) . '/tmp'; $import->importSchema($yml, 'yml', $path); - + require_once($path . '/generated/BaseTicket_1527_User.php'); require_once($path . '/Ticket_1527_User.php'); $username = Doctrine_Core::getTable('Ticket_1527_User')->getDefinitionOf('username'); diff --git a/tests/Ticket/1617TestCase.php b/tests/Ticket/1617TestCase.php index fc36a8bd9..8c8f71be6 100644 --- a/tests/Ticket/1617TestCase.php +++ b/tests/Ticket/1617TestCase.php @@ -29,7 +29,7 @@ * @since 1.1 * @version $Revision$ */ -class Doctrine_Ticket_1617_TestCase extends Doctrine_UnitTestCase +class Doctrine_Ticket_1617_TestCase extends Doctrine_UnitTestCase { public function testBuildSchema() { @@ -38,4 +38,4 @@ public function testBuildSchema() $this->assertEqual($array['term']['columns']['language']['name'], 'lang as language'); } -} \ No newline at end of file +} diff --git a/tests/Ticket/2355TestCase.php b/tests/Ticket/2355TestCase.php index c661703ca..918038635 100644 --- a/tests/Ticket/2355TestCase.php +++ b/tests/Ticket/2355TestCase.php @@ -30,7 +30,7 @@ * @since 1.0 * @version $Revision$ */ -class Doctrine_Ticket_2355_TestCase extends Doctrine_UnitTestCase +class Doctrine_Ticket_2355_TestCase extends Doctrine_UnitTestCase { public function setUp() { @@ -163,7 +163,7 @@ public function setTableDefinition() $this->index('episode', array( - 'fields' => + 'fields' => array( 0 => 'season', 1 => 'number', @@ -300,4 +300,4 @@ public function setUp() 'foreign' => 'id', 'onDelete' => 'CASCADE')); } -} \ No newline at end of file +} diff --git a/tests/Ticket/915TestCase.php b/tests/Ticket/915TestCase.php index c73ca976a..93ee51ce8 100644 --- a/tests/Ticket/915TestCase.php +++ b/tests/Ticket/915TestCase.php @@ -36,7 +36,7 @@ public function prepareData() { } public function prepareTables() { $this->tables[] = 'Account'; - parent::prepareTables(); + parent::prepareTables(); } public function testBug() @@ -72,4 +72,4 @@ public function testBug() $this->pass(); } } -} \ No newline at end of file +} diff --git a/tests/Ticket/DC147TestCase.php b/tests/Ticket/DC147TestCase.php index 2b0eb5487..d2783dbad 100644 --- a/tests/Ticket/DC147TestCase.php +++ b/tests/Ticket/DC147TestCase.php @@ -30,7 +30,7 @@ * @since 1.0 * @version $Revision$ */ -class Doctrine_Ticket_DC147_TestCase extends Doctrine_UnitTestCase +class Doctrine_Ticket_DC147_TestCase extends Doctrine_UnitTestCase { public function prepareTables() { @@ -50,8 +50,8 @@ public function testInlineMultiple() name: isbn2 ISBN3: name: isbn3 -DC147_Product: - Product_1: +DC147_Product: + Product_1: name: book3 MultipleValues: Multi_1: @@ -60,7 +60,7 @@ public function testInlineMultiple() Multi_2: value: 232323233 Multiple: ISBN3 - Product_2: + Product_2: name: book4 MultipleValues: Multi_3: @@ -171,4 +171,4 @@ public function setUp() $this->hasOne('DC147_Product as Product', array('local' => 'product_id', 'foreign' => 'id')); } -} \ No newline at end of file +} diff --git a/tests/Ticket/DC23TestCase.php b/tests/Ticket/DC23TestCase.php index 20de702d7..2c17a2e6c 100644 --- a/tests/Ticket/DC23TestCase.php +++ b/tests/Ticket/DC23TestCase.php @@ -30,7 +30,7 @@ * @since 1.0 * @version $Revision$ */ -class Doctrine_Ticket_DC23_TestCase extends Doctrine_UnitTestCase +class Doctrine_Ticket_DC23_TestCase extends Doctrine_UnitTestCase { public function prepareTables() { @@ -54,8 +54,8 @@ public function testTest() title: Test body: Testing -Ticket_DC23_User: - User_1: +Ticket_DC23_User: + User_1: name: jwage Contact: name: Test Contact @@ -196,4 +196,4 @@ public function setUp() ) ); } -} \ No newline at end of file +} diff --git a/tests/Ticket/DC23bTestCase.php b/tests/Ticket/DC23bTestCase.php index 682844ff2..b28d63149 100644 --- a/tests/Ticket/DC23bTestCase.php +++ b/tests/Ticket/DC23bTestCase.php @@ -30,7 +30,7 @@ * @since 1.0 * @version $Revision$ */ -class Doctrine_Ticket_DC23b_TestCase extends Doctrine_UnitTestCase +class Doctrine_Ticket_DC23b_TestCase extends Doctrine_UnitTestCase { public function prepareTables() { @@ -45,8 +45,8 @@ public function testInlineSite() { $yml = <<hasOne('Ticket_Product as Product', array('local' => 'product_id', 'foreign' => 'id')); } -} \ No newline at end of file +} diff --git a/tests/Ticket/DC95TestCase.php b/tests/Ticket/DC95TestCase.php index f09d31f2d..c4d2bdcbd 100644 --- a/tests/Ticket/DC95TestCase.php +++ b/tests/Ticket/DC95TestCase.php @@ -30,7 +30,7 @@ * @since 1.0 * @version $Revision$ */ -class Doctrine_Ticket_DC95_TestCase extends Doctrine_UnitTestCase +class Doctrine_Ticket_DC95_TestCase extends Doctrine_UnitTestCase { public function testClassDoesNotExistBeforeImport() {