From 73148f836080cd8ad28df245db0fc511ab7c22f3 Mon Sep 17 00:00:00 2001 From: Jeffrey Wong Date: Mon, 19 Dec 2022 19:04:53 -0800 Subject: [PATCH] compatibility with php 7.4 and 8.x (#4) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Correct deprecated methods in PHP7.4 (#1079) * runtime/lib/query/Join.php implode() was used against the definition (wrong PHP documentation * runtime/lib/query/ModelCriteria.php count() was used on non-countable variable (non-array) * 7.4 and phpunit9 changes. Tests are passing * Compatibility changes * Added docker setup * updated travis * added correct path * 7.4 final travis setup * #1086: Code review suggestions applying * remove dependency on docker mysql * remove 5.6 and 7.2 from test matrix; add 8.0 and 8.1 * Upgraded PHP version and removed some deprecations * Migrated phpunit.xml.dist * Switched to PHP8.0 in Dockerfile * Removed usage of ReflectionClass->getClass in favor of ReflectionClass->getType * Changed order of arguments in ModelCriteriaTest.php and ModelCriteriaWithNamespaceTest.php * Fixed signatures of PropelOnDemandCollection::asort and PropelOnDemandCollection::ksort * Removed require_once from all the classes because we have autoloading via composer * Rector automated upgrade to PHP8 * Fixed invalid handling of resource type for binded value in DebugPDOStatement.php * Fixed invalid way of checking if method exists in delegated class via is_callable. Switched to method_exists * Replaced order of params because of failed tests * [STYLE]: Added simplified usage because of version support dropping * Fix use of abs() with string on PHP8.0 Can happen when using Yaml's multiline syntax * specify minimum version of phing for php8 * drop php 7.3 from test matrix * update to ubuntu-20.04 * fork propel/propel1 for versions >=1.8 Co-authored-by: Michal Drozd Co-authored-by: Luke Adamczewski Co-authored-by: Ɓukasz Adamczewski Co-authored-by: Jeffrey Wong Co-authored-by: Luke Adamczewski Co-authored-by: Paulo Magalhaes --- .github/workflows/test.yml | 9 +-- .travis.yml | 34 ++------- composer.json | 32 ++++----- docker/Dockerfile | 11 +++ docker/docker-compose.yml | 29 ++++++++ docker/reset.sh | 4 ++ docker/run.sh | 7 ++ generator/lib/behavior/DelegateBehavior.php | 2 +- .../AggregateColumnBehavior.php | 2 - .../AggregateColumnRelationBehavior.php | 2 - .../templates/objectCompute.php | 1 - .../templates/objectUpdate.php | 1 - .../templates/objectUpdateRelated.php | 1 - .../templates/queryFindRelated.php | 1 - .../templates/queryUpdateRelated.php | 1 - .../archivable/ArchivableBehavior.php | 3 +- .../templates/objectDeleteWithoutArchive.php | 1 - .../archivable/templates/objectGetArchive.php | 1 - .../templates/objectPopulateFromArchive.php | 1 - .../templates/objectRestoreFromArchive.php | 1 - .../templates/objectSaveWithoutArchive.php | 1 - .../archivable/templates/queryArchive.php | 1 - .../templates/queryDeleteWithoutArchive.php | 1 - .../templates/querySetArchiveOnDelete.php | 1 - .../templates/querySetArchiveOnUpdate.php | 1 - .../templates/queryUpdateWithoutArchive.php | 1 - .../ConcreteInheritanceBehavior.php | 1 - generator/lib/behavior/i18n/I18nBehavior.php | 5 +- .../i18n/templates/objectAttributes.php | 1 - .../templates/objectGetCurrentTranslation.php | 1 - .../i18n/templates/objectGetLocale.php | 1 - .../i18n/templates/objectGetLocaleAlias.php | 1 - .../i18n/templates/objectGetTranslation.php | 1 - .../i18n/templates/objectPostDelete.php | 1 - .../templates/objectRemoveTranslation.php | 1 - .../i18n/templates/objectSetLocale.php | 1 - .../i18n/templates/objectSetLocaleAlias.php | 1 - .../i18n/templates/objectSetTranslation.php | 1 - .../objectTranslatedColumnGetter.php | 1 - .../objectTranslatedColumnSetter.php | 1 - .../behavior/i18n/templates/queryJoinI18n.php | 1 - .../i18n/templates/queryJoinWithI18n.php | 1 - .../i18n/templates/queryUseI18nQuery.php | 1 - .../behavior/nestedset/NestedSetBehavior.php | 5 +- .../behavior/sortable/SortableBehavior.php | 7 +- .../versionable/VersionableBehavior.php | 5 +- .../lib/builder/om/ExtensionQueryBuilder.php | 1 - .../om/ExtensionQueryInheritanceBuilder.php | 1 - generator/lib/builder/om/OMBuilder.php | 1 - generator/lib/builder/om/ObjectBuilder.php | 1 - .../builder/om/PHP5ExtensionNodeBuilder.php | 1 - .../om/PHP5ExtensionNodePeerBuilder.php | 1 - .../builder/om/PHP5ExtensionObjectBuilder.php | 1 - .../builder/om/PHP5ExtensionPeerBuilder.php | 1 - .../lib/builder/om/PHP5InterfaceBuilder.php | 1 - .../om/PHP5MultiExtendObjectBuilder.php | 1 - .../lib/builder/om/PHP5NestedSetBuilder.php | 1 - .../builder/om/PHP5NestedSetPeerBuilder.php | 1 - generator/lib/builder/om/PHP5NodeBuilder.php | 1 - .../lib/builder/om/PHP5NodePeerBuilder.php | 1 - .../lib/builder/om/PHP5ObjectBuilder.php | 4 +- .../om/PHP5ObjectNoCollectionBuilder.php | 4 +- generator/lib/builder/om/PHP5PeerBuilder.php | 5 +- .../lib/builder/om/PHP5TableMapBuilder.php | 1 - generator/lib/builder/om/PeerBuilder.php | 1 - generator/lib/builder/om/QueryBuilder.php | 5 +- .../builder/om/QueryInheritanceBuilder.php | 3 +- generator/lib/builder/sql/DataSQLBuilder.php | 3 +- .../builder/sql/mssql/MssqlDataSQLBuilder.php | 1 - .../builder/sql/mysql/MysqlDataSQLBuilder.php | 1 - .../sql/oracle/OracleDataSQLBuilder.php | 1 - .../builder/sql/pgsql/PgsqlDataSQLBuilder.php | 1 - .../sql/sqlite/SqliteDataSQLBuilder.php | 1 - .../sql/sqlsrv/SqlsrvDataSQLBuilder.php | 1 - .../builder/util/DefaultEnglishPluralizer.php | 1 - .../util/StandardEnglishPluralizer.php | 1 - generator/lib/builder/util/XmlToAppData.php | 3 +- generator/lib/builder/util/XmlToDataSQL.php | 1 - generator/lib/config/GeneratorConfig.php | 5 +- generator/lib/config/QuickGeneratorConfig.php | 13 ++-- generator/lib/exception/EngineException.php | 1 - generator/lib/model/AppData.php | 3 +- generator/lib/model/Behavior.php | 3 +- generator/lib/model/Column.php | 7 -- generator/lib/model/Database.php | 9 ++- generator/lib/model/Domain.php | 1 - generator/lib/model/ForeignKey.php | 1 - generator/lib/model/IdMethodParameter.php | 1 - generator/lib/model/Index.php | 5 +- generator/lib/model/Inheritance.php | 2 +- generator/lib/model/NameFactory.php | 7 +- generator/lib/model/PhpNameGenerator.php | 1 - generator/lib/model/Rule.php | 1 - generator/lib/model/ScopedElement.php | 1 - generator/lib/model/Table.php | 19 +++-- generator/lib/model/Unique.php | 1 - generator/lib/model/Validator.php | 7 +- generator/lib/model/VendorInfo.php | 3 +- generator/lib/model/XMLElement.php | 3 +- .../lib/model/diff/PropelColumnComparator.php | 3 +- generator/lib/model/diff/PropelColumnDiff.php | 1 - .../model/diff/PropelDatabaseComparator.php | 5 +- .../lib/model/diff/PropelDatabaseDiff.php | 3 +- .../model/diff/PropelForeignKeyComparator.php | 1 - .../lib/model/diff/PropelIndexComparator.php | 1 - .../lib/model/diff/PropelTableComparator.php | 11 ++- generator/lib/model/diff/PropelTableDiff.php | 3 +- generator/lib/platform/DefaultPlatform.php | 11 ++- generator/lib/platform/MssqlPlatform.php | 3 +- generator/lib/platform/MysqlPlatform.php | 1 - generator/lib/platform/OraclePlatform.php | 1 - generator/lib/platform/PgsqlPlatform.php | 3 +- generator/lib/platform/SqlitePlatform.php | 1 - generator/lib/platform/SqlsrvPlatform.php | 1 - generator/lib/reverse/BaseSchemaParser.php | 1 - .../lib/reverse/mssql/MssqlSchemaParser.php | 1 - .../lib/reverse/mysql/MysqlSchemaParser.php | 1 - .../lib/reverse/oracle/OracleSchemaParser.php | 1 - .../lib/reverse/pgsql/PgsqlSchemaParser.php | 1 - .../lib/reverse/sqlite/SqliteSchemaParser.php | 1 - .../lib/reverse/sqlsrv/SqlsrvSchemaParser.php | 1 - .../lib/task/AbstractPropelDataModelTask.php | 2 +- generator/lib/task/AbstractPropelTask.php | 1 - .../lib/task/BasePropelMigrationTask.php | 1 - generator/lib/task/PropelConvertConfTask.php | 7 +- generator/lib/task/PropelDataSQLTask.php | 7 +- generator/lib/task/PropelGraphvizTask.php | 5 +- .../lib/task/PropelMigrationDownTask.php | 3 +- .../lib/task/PropelMigrationStatusTask.php | 3 +- generator/lib/task/PropelMigrationTask.php | 3 +- generator/lib/task/PropelMigrationUpTask.php | 3 +- generator/lib/task/PropelOMTask.php | 5 +- generator/lib/task/PropelSQLDiffTask.php | 9 ++- generator/lib/task/PropelSQLExec.php | 3 +- generator/lib/task/PropelSQLTask.php | 1 - .../lib/task/PropelSchemaReverseTask.php | 5 +- generator/lib/task/PropelSqlBuildTask.php | 1 - generator/lib/util/PropelMigrationManager.php | 7 +- generator/lib/util/PropelQuickBuilder.php | 7 +- generator/lib/util/PropelSqlManager.php | 3 +- phpunit.xml.dist | 37 ++++------ .../collection/PropelOnDemandCollection.php | 4 +- runtime/lib/connection/DebugPDOStatement.php | 7 +- runtime/lib/connection/PropelPDO.php | 10 ++- .../lib/formatter/PropelArrayFormatter.php | 17 ++++- runtime/lib/map/TableMap.php | 4 ++ runtime/lib/parser/PropelCSVParser.php | 10 +-- runtime/lib/parser/yaml/sfYamlInline.php | 12 ++-- runtime/lib/parser/yaml/sfYamlParser.php | 8 +-- runtime/lib/query/Join.php | 2 +- runtime/lib/query/ModelCriteria.php | 2 +- runtime/lib/util/BasePeer.php | 4 +- runtime/lib/validator/MatchValidator.php | 2 +- runtime/lib/validator/NotMatchValidator.php | 2 +- ...AlternativeCodingStandardsBehaviorTest.php | 2 +- .../behavior/DelegateBehaviorTest.php | 5 +- .../behavior/NamespacedBehaviorTest.php | 2 +- .../behavior/SoftDeleteBehaviorTest.php | 2 +- .../generator/behavior/TableBehaviorTest.php | 4 +- .../AggregateColumnBehaviorWithSchemaTest.php | 4 +- ...ableAndConcreteInheritanceBehaviorTest.php | 4 +- ...vableBehaviorObjectBuilderModifierTest.php | 7 +- ...ivableBehaviorQueryBuilderModifierTest.php | 4 +- .../archivable/ArchivableBehaviorTest.php | 10 +-- .../ConcreteInheritanceBehaviorTest.php | 3 +- ...eInheritanceExcludedParentBehaviorTest.php | 4 +- .../I18nBehaviorObjectBuilderModifierTest.php | 4 +- .../I18nBehaviorPeerBuilderModifierTest.php | 2 +- .../I18nBehaviorQueryBuilderModifierTest.php | 4 +- .../behavior/i18n/I18nBehaviorTest.php | 24 +++---- ...edSetBehaviorObjectBuilderModifierTest.php | 1 + ...viorObjectBuilderModifierWithScopeTest.php | 1 + .../NestedSetBehaviorWithNamespaceTest.php | 2 +- .../sluggable/SluggableBehaviorTest.php | 1 + ...tableBehaviorObjectBuilderModifierTest.php | 7 +- ...viorObjectBuilderModifierWithScopeTest.php | 8 ++- ...ortableBehaviorPeerBuilderModifierTest.php | 2 +- ...haviorPeerBuilderModifierWithScopeTest.php | 2 +- ...rtableBehaviorQueryBuilderModifierTest.php | 3 +- ...aviorQueryBuilderModifierWithScopeTest.php | 2 +- .../sortable/SortableBehaviorTest.php | 2 +- ...nableBehaviorObjectBuilderModifierTest.php | 5 +- ...ionableBehaviorPeerBuilderModifierTest.php | 4 +- .../versionable/VersionableBehaviorTest.php | 26 +++---- .../generator/builder/NamespaceTest.php | 6 +- .../om/GeneratedNestedSetObjectTest.php | 1 + .../builder/om/GeneratedNestedSetPeerTest.php | 1 + .../om/GeneratedObjectArrayColumnTypeTest.php | 4 +- .../GeneratedObjectBooleanColumnTypeTest.php | 4 +- .../om/GeneratedObjectConstantNameTest.php | 2 +- .../GeneratedObjectDateTimeColumnTypeTest.php | 4 +- .../om/GeneratedObjectEnumColumnTypeTest.php | 6 +- .../om/GeneratedObjectLazyLoadTest.php | 4 +- .../builder/om/GeneratedObjectLobTest.php | 14 ++-- .../om/GeneratedObjectMoreRelationTest.php | 4 +- .../GeneratedObjectObjectColumnTypeTest.php | 4 +- .../builder/om/GeneratedObjectPhpNameTest.php | 4 +- .../builder/om/GeneratedObjectRelTest.php | 9 +-- .../GeneratedObjectTemporalColumnTypeTest.php | 5 +- .../builder/om/GeneratedObjectTest.php | 6 +- .../om/GeneratedObjectWithFixturesTest.php | 12 ++-- .../om/GeneratedObjectWithInterfaceTest.php | 4 +- .../builder/om/GeneratedPeerDoDeleteTest.php | 8 +-- .../builder/om/GeneratedPeerDoSelectTest.php | 2 +- .../om/GeneratedPeerEnumColumnTypeTest.php | 5 +- .../builder/om/GeneratedPeerLazyLoadTest.php | 4 +- .../om/GeneratedQueryArrayColumnTypeTest.php | 4 +- .../om/GeneratedQueryEnumColumnTypeTest.php | 4 +- .../om/GeneratedQueryObjectColumnTypeTest.php | 4 +- .../builder/om/OMBuilderNamespaceTest.php | 2 +- .../builder/om/OMBuilderRelatedByTest.php | 4 +- .../generator/builder/om/OMBuilderTest.php | 2 +- .../builder/om/PHP5ObjectBuilderTest.php | 4 +- .../builder/om/PHP5TableMapBuilderTest.php | 2 +- .../util/DefaultEnglishPluralizerTest.php | 2 +- .../builder/util/PropelTemplateTest.php | 2 +- .../util/StandardEnglishPluralizerTest.php | 2 +- .../builder/util/XmlToAppDataTest.php | 3 +- .../generator/config/GeneratorConfigTest.php | 5 +- .../generator/model/BehaviorTest.php | 3 +- .../model/ColumnDefaultValueTest.php | 2 +- test/testsuite/generator/model/ColumnTest.php | 2 +- .../generator/model/DatabaseTest.php | 2 +- .../generator/model/NameFactoryTest.php | 69 ++++++++----------- .../generator/model/PhpNameGeneratorTest.php | 2 +- test/testsuite/generator/model/TableTest.php | 4 +- .../generator/model/XMLElementTest.php | 2 +- .../model/diff/PropelColumnComparatorTest.php | 4 +- .../PropelDatabaseTableComparatorTest.php | 4 +- .../diff/PropelForeignKeyComparatorTest.php | 2 +- .../model/diff/PropelIndexComparatorTest.php | 2 +- .../diff/PropelTableColumnComparatorTest.php | 4 +- .../PropelTableForeignKeyComparatorTest.php | 4 +- .../diff/PropelTableIndexComparatorTest.php | 4 +- .../PropelTablePkColumnComparatorTest.php | 4 +- .../generator/platform/CustomPlatformTest.php | 4 +- .../platform/DefaultPlatformTest.php | 4 +- .../generator/platform/PlatformTestBase.php | 2 +- .../reverse/mssql/MssqlSchemaParserTest.php | 2 +- .../reverse/mysql/MysqlSchemaParserTest.php | 6 +- .../reverse/pgsql/PgsqlSchemaParserTest.php | 6 +- .../generator/util/PropelDotGeneratorTest.php | 2 +- .../generator/util/PropelPHPParserTest.php | 2 +- .../generator/util/PropelQuickBuilderTest.php | 26 +++---- .../generator/util/PropelSQLParserTest.php | 2 +- .../util/PropelSchemaValidatorTest.php | 2 +- test/testsuite/misc/BookstoreTest.php | 8 +-- test/testsuite/misc/CharacterEncodingTest.php | 2 +- test/testsuite/misc/FieldnameRelatedTest.php | 4 +- test/testsuite/misc/Issue617Test.php | 4 +- test/testsuite/misc/Issue651Test.php | 2 +- test/testsuite/misc/PoisonedCacheBugTest.php | 4 +- .../testsuite/runtime/adapter/DBMySQLTest.php | 1 + .../collection/PropelArrayCollectionTest.php | 5 +- .../PropelCollectionConvertTest.php | 2 +- .../collection/PropelCollectionTest.php | 4 ++ .../collection/PropelObjectCollectionTest.php | 2 + ...PropelObjectCollectionWithFixturesTest.php | 2 +- .../PropelOnDemandCollectionTest.php | 10 ++- .../collection/PropelOnDemandIteratorTest.php | 2 +- .../config/PropelConfigurationTest.php | 2 +- .../runtime/connection/PropelPDOTest.php | 2 +- .../runtime/exception/PropelExceptionTest.php | 3 +- .../formatter/PropelArrayFormatterTest.php | 2 +- .../PropelArrayFormatterWithTest.php | 1 + .../runtime/formatter/PropelFormatterTest.php | 2 +- .../PropelObjectFormatterInheritanceTest.php | 2 +- .../formatter/PropelObjectFormatterTest.php | 2 +- .../PropelObjectFormatterWithTest.php | 1 + .../formatter/PropelOnDemandFormatterTest.php | 1 + .../PropelOnDemandFormatterWithTest.php | 1 + .../PropelSimpleArrayFormatterTest.php | 2 +- .../PropelStatementFormatterTest.php | 2 +- test/testsuite/runtime/map/ColumnMapTest.php | 4 +- .../testsuite/runtime/map/DatabaseMapTest.php | 4 +- .../runtime/map/GeneratedRelationMapTest.php | 2 +- .../GeneratedRelationMapWithSchemasTest.php | 2 +- .../runtime/map/RelatedMapSymmetricalTest.php | 2 +- .../RelatedMapSymmetricalWithSchemasTest.php | 2 +- .../testsuite/runtime/map/RelationMapTest.php | 4 +- test/testsuite/runtime/map/TableMapTest.php | 25 ++----- .../runtime/om/BaseObjectConvertTest.php | 2 +- test/testsuite/runtime/om/BaseObjectTest.php | 3 +- .../runtime/parser/PropelCSVParserTest.php | 2 +- .../runtime/parser/PropelJSONParserTest.php | 2 +- .../runtime/parser/PropelParserTest.php | 3 +- .../runtime/parser/PropelXMLParserTest.php | 2 +- .../runtime/parser/PropelYAMLParserTest.php | 2 +- .../runtime/query/CriteriaCombineTest.php | 4 +- .../runtime/query/CriteriaMergeTest.php | 2 + test/testsuite/runtime/query/CriteriaTest.php | 4 +- test/testsuite/runtime/query/JoinTest.php | 4 +- .../runtime/query/ModelCriteriaHooksTest.php | 2 +- .../runtime/query/ModelCriteriaSelectTest.php | 7 +- .../runtime/query/ModelCriteriaTest.php | 11 ++- .../query/ModelCriteriaWithNamespaceTest.php | 6 +- .../query/ModelCriteriaWithSchemaTest.php | 6 +- .../runtime/util/BasePeerExceptionsTest.php | 12 ++-- test/testsuite/runtime/util/BasePeerTest.php | 2 + .../runtime/util/PropelDateTimeTest.php | 3 +- .../runtime/util/PropelModelPagerTest.php | 2 +- .../runtime/util/PropelPagerTest.php | 4 +- .../runtime/validator/ValidatorTest.php | 2 +- test/tools/helpers/BaseTestCase.php | 2 +- .../helpers/PlatformDatabaseBuildTimeBase.php | 6 +- .../bookstore/BookstoreEmptyTestBase.php | 3 +- .../helpers/bookstore/BookstoreTestBase.php | 6 +- test/tools/helpers/cms/CmsTestBase.php | 6 +- .../helpers/namespaces/NamespacesTestBase.php | 6 +- .../tools/helpers/schemas/SchemasTestBase.php | 6 +- 310 files changed, 618 insertions(+), 687 deletions(-) create mode 100644 docker/Dockerfile create mode 100644 docker/docker-compose.yml create mode 100644 docker/reset.sh create mode 100755 docker/run.sh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4a50c7f52..e408d392c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,17 +8,14 @@ jobs: env: DB: mysql DB_USER: root - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 strategy: fail-fast: false matrix: php: - - '5.6' - - '7.2' - - '7.3' - '7.4' -# - '8.0' -# - '8.1' + - '8.0' + - '8.1' composer: - '' - '--prefer-lowest' diff --git a/.travis.yml b/.travis.yml index 9bbabbff5..99db8cd1c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,36 +1,10 @@ language: php -dist: trusty branches: only: - - 1.6 - - master - - gh-pages + - php7.4 -php: - - 5.4 - - 5.5 - - hhvm +services: docker -env: - - DB=mysql DB_USER=root - -before_script: - # MySQL - - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'SET FOREIGN_KEY_CHECKS = 0; DROP DATABASE IF EXISTS test; DROP SCHEMA IF EXISTS second_hand_books; DROP SCHEMA IF EXISTS contest; DROP DATABASE IF EXISTS reverse_bookstore; DROP SCHEMA IF EXISTS bookstore_schemas; SET FOREIGN_KEY_CHECKS = 1;'; fi" - - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE test; CREATE SCHEMA bookstore_schemas; CREATE SCHEMA contest; CREATE SCHEMA second_hand_books; CREATE DATABASE reverse_bookstore;'; fi" - - # Composer - - wget http://getcomposer.org/composer.phar - - php composer.phar install --prefer-source - - - ./test/reset_tests.sh - -script: vendor/bin/phpunit - -matrix: - include: - - php: 5.3 - dist: precise - allow_failures: - - php: hhvm +script: + bash docker/run.sh diff --git a/composer.json b/composer.json index a5a42349a..8237463a0 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "propel/propel1", + "name": "dayspring-tech/propel1", "description": "Propel is an open-source Object-Relational Mapping (ORM) for PHP5.", "keywords": ["orm", "active record", "mapping", "database", "persistence"], "homepage": "http://www.propelorm.org/", @@ -14,23 +14,23 @@ }, "include-path": ["runtime/lib", "generator/lib"], "require": { - "php": ">=5.2.4", - "phing/phing": "~2.4" + "php": "^8.0|^7.4", + "phing/phing": "^2.17", + "ext-pdo": "*" }, "require-dev": { - "pear-pear.php.net/PEAR_PackageFileManager2": "@stable", - "phpunit/phpunit": "~4.0||~5.0" + "phpunit/phpunit": "^9.0.0", + "phpcompatibility/php-compatibility": "^9.3", + "squizlabs/php_codesniffer": "^3.5", + "ext-simplexml": "*", + "ext-dom": "*" }, - "extra": { - "branch-alias": { - "dev-master": "1.7-dev" - } + "replace": { + "propel/propel1": "^1.8" }, - "repositories": [ - { - "type": "pear", - "url": "https://pear.php.net" - } - ], - "bin": ["generator/bin/propel-gen", "generator/bin/propel-gen.bat"] + "bin": ["generator/bin/propel-gen", "generator/bin/propel-gen.bat"], + "scripts": { + "post-install-cmd": "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility", + "post-update-cmd" : "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility" + } } diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 000000000..310c6a0ba --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,11 @@ +FROM thecodingmachine/php:8.0-v4-cli +USER root +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y locales + +RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ + dpkg-reconfigure --frontend=noninteractive locales && \ + update-locale LANG=en_US.UTF-8 + +USER docker +ENV LANG en_US.UTF-8 + diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 000000000..da9c15be4 --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,29 @@ +version: '3' +services: + php: + build: + context: . + dockerfile: Dockerfile + working_dir: /usr/src/app + command: phpunit + volumes: + - ../:/usr/src/app + environment: + - PHP_EXTENSIONS=intl pdo_sqlite sqlite3 xdebug + - STARTUP_COMMAND_1=composer install + - STARTUP_COMMAND_2=bash test/reset_tests.sh + - PHP_IDE_CONFIG="serverName=propel" + - XDEBUG_MODE=debug + - XDEBUG_SESSION=1 + + db: + image: percona + command: > + mysqld + --sql-mode="NO_ENGINE_SUBSTITUTION" + --character-set-server="utf8" + --collation-server="utf8_unicode_ci" + --default-authentication-plugin=mysql_native_password + restart: always + environment: + MYSQL_ALLOW_EMPTY_PASSWORD: 'yes' diff --git a/docker/reset.sh b/docker/reset.sh new file mode 100644 index 000000000..7cbb1a8ce --- /dev/null +++ b/docker/reset.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +mysql -u root -e 'SET FOREIGN_KEY_CHECKS = 0; DROP DATABASE IF EXISTS test; DROP SCHEMA IF EXISTS second_hand_books; DROP SCHEMA IF EXISTS contest; DROP DATABASE IF EXISTS reverse_bookstore; DROP SCHEMA IF EXISTS bookstore_schemas; SET FOREIGN_KEY_CHECKS = 1;' +mysql -u root -e 'CREATE DATABASE test; CREATE SCHEMA bookstore_schemas; CREATE SCHEMA contest; CREATE SCHEMA second_hand_books; CREATE DATABASE reverse_bookstore;' diff --git a/docker/run.sh b/docker/run.sh new file mode 100755 index 000000000..354575f86 --- /dev/null +++ b/docker/run.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +cd docker +docker-compose up -d db +sleep 20 +docker-compose exec -T db bash < reset.sh +docker-compose build +docker-compose run php diff --git a/generator/lib/behavior/DelegateBehavior.php b/generator/lib/behavior/DelegateBehavior.php index 4f9af83cd..e5f5a5bc3 100644 --- a/generator/lib/behavior/DelegateBehavior.php +++ b/generator/lib/behavior/DelegateBehavior.php @@ -111,7 +111,7 @@ public function objectCall($builder) $relationName = $builder->getFKPhpNameAffix($fk); } $script .= " -if (is_callable(array('$ARFQCN', \$name))) { +if (method_exists('$ARFQCN', \$name)) { if (!\$delegate = \$this->get$relationName()) { \$delegate = new $ARClassName(); \$this->set$relationName(\$delegate); diff --git a/generator/lib/behavior/aggregate_column/AggregateColumnBehavior.php b/generator/lib/behavior/aggregate_column/AggregateColumnBehavior.php index f2b9eb802..75d2cca75 100644 --- a/generator/lib/behavior/aggregate_column/AggregateColumnBehavior.php +++ b/generator/lib/behavior/aggregate_column/AggregateColumnBehavior.php @@ -8,8 +8,6 @@ * @license MIT License */ -require_once 'AggregateColumnRelationBehavior.php'; - /** * Keeps an aggregate column updated with related table * diff --git a/generator/lib/behavior/aggregate_column/AggregateColumnRelationBehavior.php b/generator/lib/behavior/aggregate_column/AggregateColumnRelationBehavior.php index cf27b38f1..41e7706f2 100644 --- a/generator/lib/behavior/aggregate_column/AggregateColumnRelationBehavior.php +++ b/generator/lib/behavior/aggregate_column/AggregateColumnRelationBehavior.php @@ -8,8 +8,6 @@ * @license MIT License */ -require_once 'AggregateColumnRelationBehavior.php'; - /** * Keeps an aggregate column updated with related table * diff --git a/generator/lib/behavior/aggregate_column/templates/objectCompute.php b/generator/lib/behavior/aggregate_column/templates/objectCompute.php index 32db0fdc7..37d440694 100644 --- a/generator/lib/behavior/aggregate_column/templates/objectCompute.php +++ b/generator/lib/behavior/aggregate_column/templates/objectCompute.php @@ -1,4 +1,3 @@ - /** * Computes the value of the aggregate column getName() ?> * diff --git a/generator/lib/behavior/aggregate_column/templates/objectUpdate.php b/generator/lib/behavior/aggregate_column/templates/objectUpdate.php index 147d5ca47..9527162b0 100644 --- a/generator/lib/behavior/aggregate_column/templates/objectUpdate.php +++ b/generator/lib/behavior/aggregate_column/templates/objectUpdate.php @@ -1,4 +1,3 @@ - /** * Updates the aggregate column getName() ?> * diff --git a/generator/lib/behavior/aggregate_column/templates/objectUpdateRelated.php b/generator/lib/behavior/aggregate_column/templates/objectUpdateRelated.php index 3e4399e87..5a282e825 100644 --- a/generator/lib/behavior/aggregate_column/templates/objectUpdateRelated.php +++ b/generator/lib/behavior/aggregate_column/templates/objectUpdateRelated.php @@ -1,4 +1,3 @@ - /** * Update the aggregate column in the related object * diff --git a/generator/lib/behavior/aggregate_column/templates/queryFindRelated.php b/generator/lib/behavior/aggregate_column/templates/queryFindRelated.php index f2761bfe6..876f4c0bd 100644 --- a/generator/lib/behavior/aggregate_column/templates/queryFindRelated.php +++ b/generator/lib/behavior/aggregate_column/templates/queryFindRelated.php @@ -1,4 +1,3 @@ - /** * Finds the related getPhpName() ?> objects and keep them for later * diff --git a/generator/lib/behavior/aggregate_column/templates/queryUpdateRelated.php b/generator/lib/behavior/aggregate_column/templates/queryUpdateRelated.php index 01404112f..de80fa61a 100644 --- a/generator/lib/behavior/aggregate_column/templates/queryUpdateRelated.php +++ b/generator/lib/behavior/aggregate_column/templates/queryUpdateRelated.php @@ -1,4 +1,3 @@ - protected function updateRelateds($con) { foreach ($this->s as $) { diff --git a/generator/lib/behavior/archivable/ArchivableBehavior.php b/generator/lib/behavior/archivable/ArchivableBehavior.php index 91225d2fb..b39fb354c 100644 --- a/generator/lib/behavior/archivable/ArchivableBehavior.php +++ b/generator/lib/behavior/archivable/ArchivableBehavior.php @@ -8,8 +8,7 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/ArchivableBehaviorObjectBuilderModifier.php'; -require_once dirname(__FILE__) . '/ArchivableBehaviorQueryBuilderModifier.php'; + /** * Keeps tracks of an ActiveRecord object, even after deletion diff --git a/generator/lib/behavior/archivable/templates/objectDeleteWithoutArchive.php b/generator/lib/behavior/archivable/templates/objectDeleteWithoutArchive.php index b3d3658cd..8853e5e20 100644 --- a/generator/lib/behavior/archivable/templates/objectDeleteWithoutArchive.php +++ b/generator/lib/behavior/archivable/templates/objectDeleteWithoutArchive.php @@ -1,4 +1,3 @@ - /** * Removes the object from the database without archiving it. * diff --git a/generator/lib/behavior/archivable/templates/objectGetArchive.php b/generator/lib/behavior/archivable/templates/objectGetArchive.php index 308e07974..4a2b65874 100644 --- a/generator/lib/behavior/archivable/templates/objectGetArchive.php +++ b/generator/lib/behavior/archivable/templates/objectGetArchive.php @@ -1,4 +1,3 @@ - /** * Get an archived version of the current object. * diff --git a/generator/lib/behavior/archivable/templates/objectPopulateFromArchive.php b/generator/lib/behavior/archivable/templates/objectPopulateFromArchive.php index c16c0f229..045b62661 100644 --- a/generator/lib/behavior/archivable/templates/objectPopulateFromArchive.php +++ b/generator/lib/behavior/archivable/templates/objectPopulateFromArchive.php @@ -1,4 +1,3 @@ - /** * Populates the the current object based on a $archiveTablePhpName archive object. * diff --git a/generator/lib/behavior/archivable/templates/objectRestoreFromArchive.php b/generator/lib/behavior/archivable/templates/objectRestoreFromArchive.php index 3b3e72930..31b232305 100644 --- a/generator/lib/behavior/archivable/templates/objectRestoreFromArchive.php +++ b/generator/lib/behavior/archivable/templates/objectRestoreFromArchive.php @@ -1,4 +1,3 @@ - /** * Revert the the current object to the state it had when it was last archived. * The object must be saved afterwards if the changes must persist. diff --git a/generator/lib/behavior/archivable/templates/objectSaveWithoutArchive.php b/generator/lib/behavior/archivable/templates/objectSaveWithoutArchive.php index 1868b35ca..db321cae8 100644 --- a/generator/lib/behavior/archivable/templates/objectSaveWithoutArchive.php +++ b/generator/lib/behavior/archivable/templates/objectSaveWithoutArchive.php @@ -1,4 +1,3 @@ - /** * Persists the object to the database without archiving it. * diff --git a/generator/lib/behavior/archivable/templates/queryArchive.php b/generator/lib/behavior/archivable/templates/queryArchive.php index 05d5a028b..f0babd887 100644 --- a/generator/lib/behavior/archivable/templates/queryArchive.php +++ b/generator/lib/behavior/archivable/templates/queryArchive.php @@ -1,4 +1,3 @@ - /** * Copy the data of the objects satisfying the query into archive objects. * The archived objects are then saved. diff --git a/generator/lib/behavior/archivable/templates/queryDeleteWithoutArchive.php b/generator/lib/behavior/archivable/templates/queryDeleteWithoutArchive.php index 1f30eac50..edd936bda 100644 --- a/generator/lib/behavior/archivable/templates/queryDeleteWithoutArchive.php +++ b/generator/lib/behavior/archivable/templates/queryDeleteWithoutArchive.php @@ -1,4 +1,3 @@ - /** * Delete records matching the current query without archiving them. * diff --git a/generator/lib/behavior/archivable/templates/querySetArchiveOnDelete.php b/generator/lib/behavior/archivable/templates/querySetArchiveOnDelete.php index f4fb08ebd..f1740687e 100644 --- a/generator/lib/behavior/archivable/templates/querySetArchiveOnDelete.php +++ b/generator/lib/behavior/archivable/templates/querySetArchiveOnDelete.php @@ -1,4 +1,3 @@ - /** * Enable/disable auto-archiving on delete for the next query. * diff --git a/generator/lib/behavior/archivable/templates/querySetArchiveOnUpdate.php b/generator/lib/behavior/archivable/templates/querySetArchiveOnUpdate.php index 7b9fd9c12..f095b93e6 100644 --- a/generator/lib/behavior/archivable/templates/querySetArchiveOnUpdate.php +++ b/generator/lib/behavior/archivable/templates/querySetArchiveOnUpdate.php @@ -1,4 +1,3 @@ - /** * Enable/disable auto-archiving on update for the next query. * diff --git a/generator/lib/behavior/archivable/templates/queryUpdateWithoutArchive.php b/generator/lib/behavior/archivable/templates/queryUpdateWithoutArchive.php index 129390006..891b0483c 100644 --- a/generator/lib/behavior/archivable/templates/queryUpdateWithoutArchive.php +++ b/generator/lib/behavior/archivable/templates/queryUpdateWithoutArchive.php @@ -1,4 +1,3 @@ - /** * Delete records matching the current query without archiving them. * diff --git a/generator/lib/behavior/concrete_inheritance/ConcreteInheritanceBehavior.php b/generator/lib/behavior/concrete_inheritance/ConcreteInheritanceBehavior.php index 28ecda907..0b634ec13 100644 --- a/generator/lib/behavior/concrete_inheritance/ConcreteInheritanceBehavior.php +++ b/generator/lib/behavior/concrete_inheritance/ConcreteInheritanceBehavior.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once 'ConcreteInheritanceParentBehavior.php'; /** * Makes a model inherit another one. The model with this behavior gets a copy diff --git a/generator/lib/behavior/i18n/I18nBehavior.php b/generator/lib/behavior/i18n/I18nBehavior.php index 21adb0a6d..8d005babd 100644 --- a/generator/lib/behavior/i18n/I18nBehavior.php +++ b/generator/lib/behavior/i18n/I18nBehavior.php @@ -8,9 +8,8 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/I18nBehaviorObjectBuilderModifier.php'; -require_once dirname(__FILE__) . '/I18nBehaviorQueryBuilderModifier.php'; -require_once dirname(__FILE__) . '/I18nBehaviorPeerBuilderModifier.php'; + + /** * Allows translation of text columns through transparent one-to-many relationship diff --git a/generator/lib/behavior/i18n/templates/objectAttributes.php b/generator/lib/behavior/i18n/templates/objectAttributes.php index 59bfcee7f..00a6ca0a1 100644 --- a/generator/lib/behavior/i18n/templates/objectAttributes.php +++ b/generator/lib/behavior/i18n/templates/objectAttributes.php @@ -1,4 +1,3 @@ - /** * Current locale * @var string diff --git a/generator/lib/behavior/i18n/templates/objectGetCurrentTranslation.php b/generator/lib/behavior/i18n/templates/objectGetCurrentTranslation.php index df56fa53f..d4215b6da 100644 --- a/generator/lib/behavior/i18n/templates/objectGetCurrentTranslation.php +++ b/generator/lib/behavior/i18n/templates/objectGetCurrentTranslation.php @@ -1,4 +1,3 @@ - /** * Returns the current translation * diff --git a/generator/lib/behavior/i18n/templates/objectGetLocale.php b/generator/lib/behavior/i18n/templates/objectGetLocale.php index 9a6aa0ccf..808a3c1cd 100644 --- a/generator/lib/behavior/i18n/templates/objectGetLocale.php +++ b/generator/lib/behavior/i18n/templates/objectGetLocale.php @@ -1,4 +1,3 @@ - /** * Gets the locale for translations * diff --git a/generator/lib/behavior/i18n/templates/objectGetLocaleAlias.php b/generator/lib/behavior/i18n/templates/objectGetLocaleAlias.php index 915c6f817..a1ae02cbe 100644 --- a/generator/lib/behavior/i18n/templates/objectGetLocaleAlias.php +++ b/generator/lib/behavior/i18n/templates/objectGetLocaleAlias.php @@ -1,4 +1,3 @@ - /** * Gets the locale for translations. * Alias for getLocale(), for BC purpose. diff --git a/generator/lib/behavior/i18n/templates/objectGetTranslation.php b/generator/lib/behavior/i18n/templates/objectGetTranslation.php index f26d116a8..82bf1f625 100644 --- a/generator/lib/behavior/i18n/templates/objectGetTranslation.php +++ b/generator/lib/behavior/i18n/templates/objectGetTranslation.php @@ -1,4 +1,3 @@ - /** * Returns the current translation for a given locale * diff --git a/generator/lib/behavior/i18n/templates/objectPostDelete.php b/generator/lib/behavior/i18n/templates/objectPostDelete.php index 959653119..343ad026e 100644 --- a/generator/lib/behavior/i18n/templates/objectPostDelete.php +++ b/generator/lib/behavior/i18n/templates/objectPostDelete.php @@ -1,4 +1,3 @@ - // emulate delete cascade ::create() ->filterBy($this) diff --git a/generator/lib/behavior/i18n/templates/objectRemoveTranslation.php b/generator/lib/behavior/i18n/templates/objectRemoveTranslation.php index 455b8d41e..21a4e7fc5 100644 --- a/generator/lib/behavior/i18n/templates/objectRemoveTranslation.php +++ b/generator/lib/behavior/i18n/templates/objectRemoveTranslation.php @@ -1,4 +1,3 @@ - /** * Remove the translation for a given locale * diff --git a/generator/lib/behavior/i18n/templates/objectSetLocale.php b/generator/lib/behavior/i18n/templates/objectSetLocale.php index 5678f0629..be99740dd 100644 --- a/generator/lib/behavior/i18n/templates/objectSetLocale.php +++ b/generator/lib/behavior/i18n/templates/objectSetLocale.php @@ -1,4 +1,3 @@ - /** * Sets the locale for translations * diff --git a/generator/lib/behavior/i18n/templates/objectSetLocaleAlias.php b/generator/lib/behavior/i18n/templates/objectSetLocaleAlias.php index 6bba031d3..29830105f 100644 --- a/generator/lib/behavior/i18n/templates/objectSetLocaleAlias.php +++ b/generator/lib/behavior/i18n/templates/objectSetLocaleAlias.php @@ -1,4 +1,3 @@ - /** * Sets the locale for translations. * Alias for setLocale(), for BC purpose. diff --git a/generator/lib/behavior/i18n/templates/objectSetTranslation.php b/generator/lib/behavior/i18n/templates/objectSetTranslation.php index 6d90a08cb..73266f1b0 100644 --- a/generator/lib/behavior/i18n/templates/objectSetTranslation.php +++ b/generator/lib/behavior/i18n/templates/objectSetTranslation.php @@ -1,4 +1,3 @@ - /** * Sets the translation for a given locale * diff --git a/generator/lib/behavior/i18n/templates/objectTranslatedColumnGetter.php b/generator/lib/behavior/i18n/templates/objectTranslatedColumnGetter.php index 019f32f20..9296aeab3 100644 --- a/generator/lib/behavior/i18n/templates/objectTranslatedColumnGetter.php +++ b/generator/lib/behavior/i18n/templates/objectTranslatedColumnGetter.php @@ -1,4 +1,3 @@ - diff --git a/generator/lib/behavior/i18n/templates/objectTranslatedColumnSetter.php b/generator/lib/behavior/i18n/templates/objectTranslatedColumnSetter.php index 5acd2a14e..ff5ee478b 100644 --- a/generator/lib/behavior/i18n/templates/objectTranslatedColumnSetter.php +++ b/generator/lib/behavior/i18n/templates/objectTranslatedColumnSetter.php @@ -1,4 +1,3 @@ - $this->getCurrentTranslation()->set(); diff --git a/generator/lib/behavior/i18n/templates/queryJoinI18n.php b/generator/lib/behavior/i18n/templates/queryJoinI18n.php index 9008c024f..1d33c5d9f 100644 --- a/generator/lib/behavior/i18n/templates/queryJoinI18n.php +++ b/generator/lib/behavior/i18n/templates/queryJoinI18n.php @@ -1,4 +1,3 @@ - /** * Adds a JOIN clause to the query using the i18n relation * diff --git a/generator/lib/behavior/i18n/templates/queryJoinWithI18n.php b/generator/lib/behavior/i18n/templates/queryJoinWithI18n.php index b67040bea..f10edd173 100644 --- a/generator/lib/behavior/i18n/templates/queryJoinWithI18n.php +++ b/generator/lib/behavior/i18n/templates/queryJoinWithI18n.php @@ -1,4 +1,3 @@ - /** * Adds a JOIN clause to the query and hydrates the related I18n object. * Shortcut for $c->joinI18n($locale)->with() diff --git a/generator/lib/behavior/i18n/templates/queryUseI18nQuery.php b/generator/lib/behavior/i18n/templates/queryUseI18nQuery.php index 80ce2bcad..caa6ebca4 100644 --- a/generator/lib/behavior/i18n/templates/queryUseI18nQuery.php +++ b/generator/lib/behavior/i18n/templates/queryUseI18nQuery.php @@ -1,4 +1,3 @@ - /** * Use the I18n relation query object * diff --git a/generator/lib/behavior/nestedset/NestedSetBehavior.php b/generator/lib/behavior/nestedset/NestedSetBehavior.php index a3dfde11d..26fb9b4eb 100644 --- a/generator/lib/behavior/nestedset/NestedSetBehavior.php +++ b/generator/lib/behavior/nestedset/NestedSetBehavior.php @@ -8,9 +8,8 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/NestedSetBehaviorObjectBuilderModifier.php'; -require_once dirname(__FILE__) . '/NestedSetBehaviorQueryBuilderModifier.php'; -require_once dirname(__FILE__) . '/NestedSetBehaviorPeerBuilderModifier.php'; + + /** * Behavior to adds nested set tree structure columns and abilities diff --git a/generator/lib/behavior/sortable/SortableBehavior.php b/generator/lib/behavior/sortable/SortableBehavior.php index 2bec8453d..847eec9ea 100644 --- a/generator/lib/behavior/sortable/SortableBehavior.php +++ b/generator/lib/behavior/sortable/SortableBehavior.php @@ -8,10 +8,9 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/SortableBehaviorObjectBuilderModifier.php'; -require_once dirname(__FILE__) . '/SortableBehaviorQueryBuilderModifier.php'; -require_once dirname(__FILE__) . '/SortableBehaviorPeerBuilderModifier.php'; -require_once dirname(__FILE__) . '/SortableRelationBehavior.php'; + + + /** * Gives a model class the ability to be ordered diff --git a/generator/lib/behavior/versionable/VersionableBehavior.php b/generator/lib/behavior/versionable/VersionableBehavior.php index 7751e941d..0b50aa792 100644 --- a/generator/lib/behavior/versionable/VersionableBehavior.php +++ b/generator/lib/behavior/versionable/VersionableBehavior.php @@ -8,9 +8,8 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/VersionableBehaviorObjectBuilderModifier.php'; -require_once dirname(__FILE__) . '/VersionableBehaviorQueryBuilderModifier.php'; -require_once dirname(__FILE__) . '/VersionableBehaviorPeerBuilderModifier.php'; + + /** * Keeps tracks of all the modifications in an ActiveRecord object diff --git a/generator/lib/builder/om/ExtensionQueryBuilder.php b/generator/lib/builder/om/ExtensionQueryBuilder.php index da103aa94..c7f4bd01d 100644 --- a/generator/lib/builder/om/ExtensionQueryBuilder.php +++ b/generator/lib/builder/om/ExtensionQueryBuilder.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/OMBuilder.php'; /** * Generates the empty PHP5 stub class for object query diff --git a/generator/lib/builder/om/ExtensionQueryInheritanceBuilder.php b/generator/lib/builder/om/ExtensionQueryInheritanceBuilder.php index 0c9432c4c..0823d2a87 100644 --- a/generator/lib/builder/om/ExtensionQueryInheritanceBuilder.php +++ b/generator/lib/builder/om/ExtensionQueryInheritanceBuilder.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/OMBuilder.php'; /** * Generates the empty PHP5 stub query class for use with single table inheritance. diff --git a/generator/lib/builder/om/OMBuilder.php b/generator/lib/builder/om/OMBuilder.php index a27187b9e..f2344c55f 100644 --- a/generator/lib/builder/om/OMBuilder.php +++ b/generator/lib/builder/om/OMBuilder.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/../DataModelBuilder.php'; /** * Baseclass for OM-building classes. diff --git a/generator/lib/builder/om/ObjectBuilder.php b/generator/lib/builder/om/ObjectBuilder.php index ab5cc81e1..cd9c5ff8a 100644 --- a/generator/lib/builder/om/ObjectBuilder.php +++ b/generator/lib/builder/om/ObjectBuilder.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/OMBuilder.php'; /** * Base class for Peer-building classes. diff --git a/generator/lib/builder/om/PHP5ExtensionNodeBuilder.php b/generator/lib/builder/om/PHP5ExtensionNodeBuilder.php index 58f6ab4ed..3e241bf66 100644 --- a/generator/lib/builder/om/PHP5ExtensionNodeBuilder.php +++ b/generator/lib/builder/om/PHP5ExtensionNodeBuilder.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/ObjectBuilder.php'; /** * Generates the empty PHP5 stub node object class for user object model (OM). diff --git a/generator/lib/builder/om/PHP5ExtensionNodePeerBuilder.php b/generator/lib/builder/om/PHP5ExtensionNodePeerBuilder.php index da8cd17a6..d3e4142e4 100644 --- a/generator/lib/builder/om/PHP5ExtensionNodePeerBuilder.php +++ b/generator/lib/builder/om/PHP5ExtensionNodePeerBuilder.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/PeerBuilder.php'; /** * Generates the empty PHP5 stub node peer class for user object model (OM). diff --git a/generator/lib/builder/om/PHP5ExtensionObjectBuilder.php b/generator/lib/builder/om/PHP5ExtensionObjectBuilder.php index 9161c1a8d..5c74f8b60 100644 --- a/generator/lib/builder/om/PHP5ExtensionObjectBuilder.php +++ b/generator/lib/builder/om/PHP5ExtensionObjectBuilder.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/ObjectBuilder.php'; /** * Generates the empty PHP5 stub object class for user object model (OM). diff --git a/generator/lib/builder/om/PHP5ExtensionPeerBuilder.php b/generator/lib/builder/om/PHP5ExtensionPeerBuilder.php index 3a72e12e0..daa85c71b 100644 --- a/generator/lib/builder/om/PHP5ExtensionPeerBuilder.php +++ b/generator/lib/builder/om/PHP5ExtensionPeerBuilder.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/PeerBuilder.php'; /** * Generates the empty PHP5 stub peer class for user object model (OM). diff --git a/generator/lib/builder/om/PHP5InterfaceBuilder.php b/generator/lib/builder/om/PHP5InterfaceBuilder.php index 0850b1732..2788fb561 100644 --- a/generator/lib/builder/om/PHP5InterfaceBuilder.php +++ b/generator/lib/builder/om/PHP5InterfaceBuilder.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/ObjectBuilder.php'; /** * Generates the empty PHP5 stub interface for user object model (OM). diff --git a/generator/lib/builder/om/PHP5MultiExtendObjectBuilder.php b/generator/lib/builder/om/PHP5MultiExtendObjectBuilder.php index c861d6d3f..d648ee124 100644 --- a/generator/lib/builder/om/PHP5MultiExtendObjectBuilder.php +++ b/generator/lib/builder/om/PHP5MultiExtendObjectBuilder.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/ObjectBuilder.php'; /** * Generates the empty PHP5 stub object class for use with inheritance in the user object model (OM). diff --git a/generator/lib/builder/om/PHP5NestedSetBuilder.php b/generator/lib/builder/om/PHP5NestedSetBuilder.php index 4c2e92c50..3b8ed4bee 100644 --- a/generator/lib/builder/om/PHP5NestedSetBuilder.php +++ b/generator/lib/builder/om/PHP5NestedSetBuilder.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/ObjectBuilder.php'; /** * Generates a PHP5 tree node Object class for user object model (OM) using Nested Set way. diff --git a/generator/lib/builder/om/PHP5NestedSetPeerBuilder.php b/generator/lib/builder/om/PHP5NestedSetPeerBuilder.php index ca6f3d20b..2a05e160f 100644 --- a/generator/lib/builder/om/PHP5NestedSetPeerBuilder.php +++ b/generator/lib/builder/om/PHP5NestedSetPeerBuilder.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/PeerBuilder.php'; /** * Generates a PHP5 tree nested set Peer class for user object model (OM). diff --git a/generator/lib/builder/om/PHP5NodeBuilder.php b/generator/lib/builder/om/PHP5NodeBuilder.php index 9d9f8cc7b..691979db1 100644 --- a/generator/lib/builder/om/PHP5NodeBuilder.php +++ b/generator/lib/builder/om/PHP5NodeBuilder.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/ObjectBuilder.php'; /** * Generates a PHP5 tree node Object class for user object model (OM). diff --git a/generator/lib/builder/om/PHP5NodePeerBuilder.php b/generator/lib/builder/om/PHP5NodePeerBuilder.php index b3ab83c81..133e3e1ba 100644 --- a/generator/lib/builder/om/PHP5NodePeerBuilder.php +++ b/generator/lib/builder/om/PHP5NodePeerBuilder.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/PeerBuilder.php'; /** * Generates a PHP5 tree node Peer class for user object model (OM). diff --git a/generator/lib/builder/om/PHP5ObjectBuilder.php b/generator/lib/builder/om/PHP5ObjectBuilder.php index a68e1cd36..6b5407019 100644 --- a/generator/lib/builder/om/PHP5ObjectBuilder.php +++ b/generator/lib/builder/om/PHP5ObjectBuilder.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/ObjectBuilder.php'; /** * Generates a PHP5 base Object class for user object model (OM). @@ -1411,6 +1410,9 @@ protected function addLazyLoaderBody(&$script, Column $col) try { \$stmt = " . $this->getPeerClassname() . "::doSelectStmt(\$c, \$con); \$row = \$stmt->fetch(PDO::FETCH_NUM); + if (\$row === false) { + \$row = [null]; // for backward compatibility + } \$stmt->closeCursor();"; } diff --git a/generator/lib/builder/om/PHP5ObjectNoCollectionBuilder.php b/generator/lib/builder/om/PHP5ObjectNoCollectionBuilder.php index 96162152c..c2549122d 100644 --- a/generator/lib/builder/om/PHP5ObjectNoCollectionBuilder.php +++ b/generator/lib/builder/om/PHP5ObjectNoCollectionBuilder.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/PHP5ObjectBuilder.php'; /** * Generates a PHP5 base Object class for user object model (OM). @@ -111,6 +110,9 @@ protected function addLazyLoaderBody(&$script, Column $col) try { \$stmt = " . $this->getPeerClassname() . "::doSelectStmt(\$c, \$con); \$row = \$stmt->fetch(PDO::FETCH_NUM); + if (\$row === false) { + \$row = [null]; // for backward compatibility + } \$stmt->closeCursor();"; if ($col->getType() === PropelTypes::CLOB && $this->getPlatform() instanceof OraclePlatform) { diff --git a/generator/lib/builder/om/PHP5PeerBuilder.php b/generator/lib/builder/om/PHP5PeerBuilder.php index e22fcc3cb..063d8def0 100644 --- a/generator/lib/builder/om/PHP5PeerBuilder.php +++ b/generator/lib/builder/om/PHP5PeerBuilder.php @@ -8,8 +8,7 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/PeerBuilder.php'; -require_once dirname(__FILE__) . '/ClassTools.php'; + /** * Generates a PHP5 base Peer class for user object model (OM). @@ -1200,7 +1199,7 @@ public static function getPrimaryKeyFromRow(\$row, \$startcol = 0) if ($table->hasCompositePrimaryKey()) { $script .= " - return array(" . implode($pks, ', ') . ");"; + return array(" . implode(', ', $pks) . ");"; } else { $script .= " diff --git a/generator/lib/builder/om/PHP5TableMapBuilder.php b/generator/lib/builder/om/PHP5TableMapBuilder.php index ed5a02c26..711554acb 100644 --- a/generator/lib/builder/om/PHP5TableMapBuilder.php +++ b/generator/lib/builder/om/PHP5TableMapBuilder.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/OMBuilder.php'; /** * Generates the PHP5 table map class for user object model (OM). diff --git a/generator/lib/builder/om/PeerBuilder.php b/generator/lib/builder/om/PeerBuilder.php index d58b644b2..95c6e7d89 100644 --- a/generator/lib/builder/om/PeerBuilder.php +++ b/generator/lib/builder/om/PeerBuilder.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/OMBuilder.php'; /** * Base class for Peer-building classes. diff --git a/generator/lib/builder/om/QueryBuilder.php b/generator/lib/builder/om/QueryBuilder.php index 7875f5bb7..f01d3a623 100644 --- a/generator/lib/builder/om/QueryBuilder.php +++ b/generator/lib/builder/om/QueryBuilder.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/OMBuilder.php'; /** * Generates a PHP5 base Query class for user object model (OM). @@ -415,10 +414,10 @@ protected function addFindPk(&$script) } $pkType = 'array'; $pkDescription = " - A Primary key composition: " . '[' . join($colNames, ', ') . ']'; + A Primary key composition: " . '[' . join(', ', $colNames) . ']'; $script .= " * - * \$obj = \$c->findPk(array(" . join($examplePk, ', ') . "), \$con);"; + * \$obj = \$c->findPk(array(" . join(', ', $examplePk) . "), \$con);"; } else { $pkType = 'mixed'; $script .= " diff --git a/generator/lib/builder/om/QueryInheritanceBuilder.php b/generator/lib/builder/om/QueryInheritanceBuilder.php index b2f2a9029..f28392fdf 100644 --- a/generator/lib/builder/om/QueryInheritanceBuilder.php +++ b/generator/lib/builder/om/QueryInheritanceBuilder.php @@ -8,8 +8,7 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/OMBuilder.php'; -require_once dirname(__FILE__) . '/ClassTools.php'; + /** * Generates the empty PHP5 stub query class for use with single table inheritance. diff --git a/generator/lib/builder/sql/DataSQLBuilder.php b/generator/lib/builder/sql/DataSQLBuilder.php index 16426ed26..fb8b754ca 100644 --- a/generator/lib/builder/sql/DataSQLBuilder.php +++ b/generator/lib/builder/sql/DataSQLBuilder.php @@ -8,8 +8,7 @@ * @license MIT License */ -require_once 'builder/DataModelBuilder.php'; -require_once 'model/PropelTypes.php'; + /** * Baseclass for SQL data dump SQL building classes. diff --git a/generator/lib/builder/sql/mssql/MssqlDataSQLBuilder.php b/generator/lib/builder/sql/mssql/MssqlDataSQLBuilder.php index d839fdac6..4245a43ea 100644 --- a/generator/lib/builder/sql/mssql/MssqlDataSQLBuilder.php +++ b/generator/lib/builder/sql/mssql/MssqlDataSQLBuilder.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once 'builder/sql/DataSQLBuilder.php'; /** * MS SQL Server class for building data dump SQL. diff --git a/generator/lib/builder/sql/mysql/MysqlDataSQLBuilder.php b/generator/lib/builder/sql/mysql/MysqlDataSQLBuilder.php index 5938b6e64..e3b1642f8 100644 --- a/generator/lib/builder/sql/mysql/MysqlDataSQLBuilder.php +++ b/generator/lib/builder/sql/mysql/MysqlDataSQLBuilder.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once 'builder/sql/DataSQLBuilder.php'; /** * MySQL class for building data dump SQL. diff --git a/generator/lib/builder/sql/oracle/OracleDataSQLBuilder.php b/generator/lib/builder/sql/oracle/OracleDataSQLBuilder.php index bf7a35dae..5d03463a8 100644 --- a/generator/lib/builder/sql/oracle/OracleDataSQLBuilder.php +++ b/generator/lib/builder/sql/oracle/OracleDataSQLBuilder.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once 'builder/sql/DataSQLBuilder.php'; /** * Oracle class for building data dump SQL. diff --git a/generator/lib/builder/sql/pgsql/PgsqlDataSQLBuilder.php b/generator/lib/builder/sql/pgsql/PgsqlDataSQLBuilder.php index ee986d62c..192efb03b 100644 --- a/generator/lib/builder/sql/pgsql/PgsqlDataSQLBuilder.php +++ b/generator/lib/builder/sql/pgsql/PgsqlDataSQLBuilder.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once 'builder/sql/DataSQLBuilder.php'; /** * PostgreSQL class for building data dump SQL. diff --git a/generator/lib/builder/sql/sqlite/SqliteDataSQLBuilder.php b/generator/lib/builder/sql/sqlite/SqliteDataSQLBuilder.php index 498856ffc..ff295f24f 100644 --- a/generator/lib/builder/sql/sqlite/SqliteDataSQLBuilder.php +++ b/generator/lib/builder/sql/sqlite/SqliteDataSQLBuilder.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once 'builder/sql/DataSQLBuilder.php'; /** * SQLite class for building data dump SQL. diff --git a/generator/lib/builder/sql/sqlsrv/SqlsrvDataSQLBuilder.php b/generator/lib/builder/sql/sqlsrv/SqlsrvDataSQLBuilder.php index 84e4688d7..2fd8c4616 100644 --- a/generator/lib/builder/sql/sqlsrv/SqlsrvDataSQLBuilder.php +++ b/generator/lib/builder/sql/sqlsrv/SqlsrvDataSQLBuilder.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once 'builder/sql/DataSQLBuilder.php'; /** * MS SQL Server using pdo_sqlsrv driver class for building data dump SQL. diff --git a/generator/lib/builder/util/DefaultEnglishPluralizer.php b/generator/lib/builder/util/DefaultEnglishPluralizer.php index 8d53b7794..53c8bfbbe 100644 --- a/generator/lib/builder/util/DefaultEnglishPluralizer.php +++ b/generator/lib/builder/util/DefaultEnglishPluralizer.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/Pluralizer.php'; /** * The default English pluralizer class. diff --git a/generator/lib/builder/util/StandardEnglishPluralizer.php b/generator/lib/builder/util/StandardEnglishPluralizer.php index 13f8374ff..be4903895 100644 --- a/generator/lib/builder/util/StandardEnglishPluralizer.php +++ b/generator/lib/builder/util/StandardEnglishPluralizer.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/Pluralizer.php'; /** * Standard replacement English pluralizer class. Based on the links below diff --git a/generator/lib/builder/util/XmlToAppData.php b/generator/lib/builder/util/XmlToAppData.php index 76b608a31..60ff72105 100644 --- a/generator/lib/builder/util/XmlToAppData.php +++ b/generator/lib/builder/util/XmlToAppData.php @@ -8,8 +8,7 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/../../model/AppData.php'; -require_once dirname(__FILE__) . '/../../exception/SchemaException.php'; + /** * A class that is used to parse an input xml schema file and creates an AppData diff --git a/generator/lib/builder/util/XmlToDataSQL.php b/generator/lib/builder/util/XmlToDataSQL.php index 1f563cf20..e9750e8d5 100644 --- a/generator/lib/builder/util/XmlToDataSQL.php +++ b/generator/lib/builder/util/XmlToDataSQL.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once 'phing/parser/AbstractHandler.php'; /** * A Class that is used to parse an data dump XML file and create SQL using a DataSQLBuilder class. diff --git a/generator/lib/config/GeneratorConfig.php b/generator/lib/config/GeneratorConfig.php index b2602ed05..dd2166620 100644 --- a/generator/lib/config/GeneratorConfig.php +++ b/generator/lib/config/GeneratorConfig.php @@ -8,9 +8,8 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/GeneratorConfigInterface.php'; // Phing dependencies -require_once 'phing/Phing.php'; + /** * A class that holds build properties and provide a class loading mechanism for the generator. @@ -121,7 +120,7 @@ public function getClassname($propname) // Basically, we want to turn ?.?.?.sqliteDataSQLBuilder into ?.?.?.SqliteDataSQLBuilder $lastdotpos = strrpos($classpath, '.'); if ($lastdotpos !== false) { - $classpath{$lastdotpos + 1} = strtoupper($classpath{$lastdotpos + 1}); + $classpath[$lastdotpos + 1] = strtoupper($classpath[$lastdotpos + 1]); } else { // Allows to configure full classname instead of a dot-path notation if (class_exists($classpath)) { diff --git a/generator/lib/config/QuickGeneratorConfig.php b/generator/lib/config/QuickGeneratorConfig.php index 36405b286..549fba4ec 100644 --- a/generator/lib/config/QuickGeneratorConfig.php +++ b/generator/lib/config/QuickGeneratorConfig.php @@ -8,10 +8,9 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/GeneratorConfig.php'; -require_once dirname(__FILE__) . '/GeneratorConfigInterface.php'; -require_once dirname(__FILE__) . '/../platform/PropelPlatformInterface.php'; -require_once dirname(__FILE__) . '/../platform/SqlitePlatform.php'; + + + /** * @package propel.generator.config @@ -62,7 +61,7 @@ protected function parsePseudoIniFile($filepath) } foreach ($lines as $line) { $line = trim($line); - if ($line == "" || $line{0} == '#' || $line{0} == ';') { + if ($line == "" || $line[0] == '#' || $line[0] == ';') { continue; } $pos = strpos($line, '='); @@ -90,7 +89,7 @@ protected function parsePseudoIniFile($filepath) public function getConfiguredBuilder(Table $table, $type) { $class = $this->builders[$type]; - require_once dirname(__FILE__) . '/../builder/om/' . $class . '.php'; + $builder = new $class($table); $builder->setGeneratorConfig($this); @@ -104,7 +103,7 @@ public function getConfiguredBuilder(Table $table, $type) */ public function getConfiguredPluralizer() { - require_once dirname(__FILE__) . '/../builder/util/DefaultEnglishPluralizer.php'; + return new DefaultEnglishPluralizer(); } diff --git a/generator/lib/exception/EngineException.php b/generator/lib/exception/EngineException.php index c98775d40..a6e6113d2 100644 --- a/generator/lib/exception/EngineException.php +++ b/generator/lib/exception/EngineException.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once 'phing/BuildException.php'; /** * The base class of all exceptions thrown by the engine. diff --git a/generator/lib/model/AppData.php b/generator/lib/model/AppData.php index 1ff393898..427aed1cd 100644 --- a/generator/lib/model/AppData.php +++ b/generator/lib/model/AppData.php @@ -8,8 +8,7 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/../exception/EngineException.php'; -require_once dirname(__FILE__) . '/Database.php'; + /** * A class for holding application data structures. diff --git a/generator/lib/model/Behavior.php b/generator/lib/model/Behavior.php index fb32a8e7c..706ebcfcb 100644 --- a/generator/lib/model/Behavior.php +++ b/generator/lib/model/Behavior.php @@ -8,8 +8,7 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/Index.php'; -require_once dirname(__FILE__) . '/../builder/util/PropelTemplate.php'; + /** * Information about behaviors of a table. diff --git a/generator/lib/model/Column.php b/generator/lib/model/Column.php index cbc159d79..6b30af05f 100644 --- a/generator/lib/model/Column.php +++ b/generator/lib/model/Column.php @@ -8,13 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/XMLElement.php'; -require_once dirname(__FILE__) . '/../exception/EngineException.php'; -require_once dirname(__FILE__) . '/PropelTypes.php'; -require_once dirname(__FILE__) . '/Inheritance.php'; -require_once dirname(__FILE__) . '/Domain.php'; -require_once dirname(__FILE__) . '/ColumnDefaultValue.php'; - /** * A Class for holding data about a column used in an Application. * diff --git a/generator/lib/model/Database.php b/generator/lib/model/Database.php index 747670f02..b1bd8a7f6 100644 --- a/generator/lib/model/Database.php +++ b/generator/lib/model/Database.php @@ -8,11 +8,10 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/ScopedElement.php'; -require_once dirname(__FILE__) . '/IDMethod.php'; -require_once dirname(__FILE__) . '/NameGenerator.php'; -require_once dirname(__FILE__) . '/Table.php'; -require_once dirname(__FILE__) . '/Behavior.php'; + + + + /** * A class for holding application data structures. diff --git a/generator/lib/model/Domain.php b/generator/lib/model/Domain.php index 7d8353bcd..acf23e832 100644 --- a/generator/lib/model/Domain.php +++ b/generator/lib/model/Domain.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/XMLElement.php'; /** * A class for holding data about a domain used in the schema. diff --git a/generator/lib/model/ForeignKey.php b/generator/lib/model/ForeignKey.php index aaf5daa00..949a06f98 100644 --- a/generator/lib/model/ForeignKey.php +++ b/generator/lib/model/ForeignKey.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/XMLElement.php'; /** * A Class for information about foreign keys of a table. diff --git a/generator/lib/model/IdMethodParameter.php b/generator/lib/model/IdMethodParameter.php index 2dc82e076..7c6b9c3cc 100644 --- a/generator/lib/model/IdMethodParameter.php +++ b/generator/lib/model/IdMethodParameter.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/XMLElement.php'; /** * Information related to an ID method. diff --git a/generator/lib/model/Index.php b/generator/lib/model/Index.php index 2812a9ed4..06529ebe6 100644 --- a/generator/lib/model/Index.php +++ b/generator/lib/model/Index.php @@ -8,8 +8,7 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/XMLElement.php'; -require_once dirname(__FILE__) . '/../exception/EngineException.php'; + /** * Information about indices of a table. @@ -181,7 +180,7 @@ public function addColumn($data) } } else { $attrib = $data; - $name = $attrib["name"]; + $name = $attrib["name"] ?? null; $this->indexColumns[] = $name; if (isset($attrib["size"])) { $this->indexColumnSizes[$name] = $attrib["size"]; diff --git a/generator/lib/model/Inheritance.php b/generator/lib/model/Inheritance.php index 5ef1976ce..441185cc3 100644 --- a/generator/lib/model/Inheritance.php +++ b/generator/lib/model/Inheritance.php @@ -8,7 +8,7 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/XMLElement.php'; +//require_once dirname(__FILE__) . '/XMLElement.php'; /** * A Class for information regarding possible objects representing a table diff --git a/generator/lib/model/NameFactory.php b/generator/lib/model/NameFactory.php index 356305036..077899fef 100644 --- a/generator/lib/model/NameFactory.php +++ b/generator/lib/model/NameFactory.php @@ -8,10 +8,9 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/../exception/EngineException.php'; -require_once dirname(__FILE__) . '/NameGenerator.php'; -require_once dirname(__FILE__) . '/PhpNameGenerator.php'; -require_once dirname(__FILE__) . '/ConstraintNameGenerator.php'; + + + /** * A name generation factory. diff --git a/generator/lib/model/PhpNameGenerator.php b/generator/lib/model/PhpNameGenerator.php index 09b592527..46b009f36 100644 --- a/generator/lib/model/PhpNameGenerator.php +++ b/generator/lib/model/PhpNameGenerator.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/NameGenerator.php'; /** * A NameGenerator implementation for PHP-esque names. diff --git a/generator/lib/model/Rule.php b/generator/lib/model/Rule.php index 1b5f22c5c..71bca19f7 100644 --- a/generator/lib/model/Rule.php +++ b/generator/lib/model/Rule.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/XMLElement.php'; /** * Data about a validation rule used in an application. diff --git a/generator/lib/model/ScopedElement.php b/generator/lib/model/ScopedElement.php index bca8cb542..8534d6ef9 100644 --- a/generator/lib/model/ScopedElement.php +++ b/generator/lib/model/ScopedElement.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/XMLElement.php'; /** * Data about an element with a name and optional namespace/schema/package attributes diff --git a/generator/lib/model/Table.php b/generator/lib/model/Table.php index bf47a2b17..578d0ac9c 100644 --- a/generator/lib/model/Table.php +++ b/generator/lib/model/Table.php @@ -8,16 +8,15 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/ScopedElement.php'; -require_once dirname(__FILE__) . '/../exception/EngineException.php'; -require_once dirname(__FILE__) . '/IDMethod.php'; -require_once dirname(__FILE__) . '/NameFactory.php'; -require_once dirname(__FILE__) . '/Column.php'; -require_once dirname(__FILE__) . '/Unique.php'; -require_once dirname(__FILE__) . '/ForeignKey.php'; -require_once dirname(__FILE__) . '/IdMethodParameter.php'; -require_once dirname(__FILE__) . '/Validator.php'; -require_once dirname(__FILE__) . '/Behavior.php'; + + + + + + + + + /** * Data about a table used in an application. diff --git a/generator/lib/model/Unique.php b/generator/lib/model/Unique.php index 5766585d9..1ca201d24 100644 --- a/generator/lib/model/Unique.php +++ b/generator/lib/model/Unique.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/Index.php'; /** * Information about unique columns of a table. This class assumes diff --git a/generator/lib/model/Validator.php b/generator/lib/model/Validator.php index b6b7b395c..c4d3d9532 100644 --- a/generator/lib/model/Validator.php +++ b/generator/lib/model/Validator.php @@ -8,10 +8,9 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/XMLElement.php'; -require_once dirname(__FILE__) . '/../exception/EngineException.php'; -require_once dirname(__FILE__) . '/PropelTypes.php'; -require_once dirname(__FILE__) . '/Rule.php'; + + + /** * Validator. diff --git a/generator/lib/model/VendorInfo.php b/generator/lib/model/VendorInfo.php index 0e0f86aeb..9a5680b4b 100644 --- a/generator/lib/model/VendorInfo.php +++ b/generator/lib/model/VendorInfo.php @@ -8,8 +8,7 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/XMLElement.php'; -require_once dirname(__FILE__) . '/../exception/EngineException.php'; + /** * Object to hold vendor-specific info. diff --git a/generator/lib/model/XMLElement.php b/generator/lib/model/XMLElement.php index 828a30bc2..1d6825c37 100644 --- a/generator/lib/model/XMLElement.php +++ b/generator/lib/model/XMLElement.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/VendorInfo.php'; /** * An abstract class for elements represented by XML tags (e.g. Column, Table). @@ -109,7 +108,7 @@ protected function getDefaultValueForArray($stringValue) $values[] = trim($v); } - $value = implode($values, ' | '); + $value = implode(' | ', $values); if (empty($value) || ' | ' === $value) { return null; } diff --git a/generator/lib/model/diff/PropelColumnComparator.php b/generator/lib/model/diff/PropelColumnComparator.php index 80e1e686f..c3b796ef5 100644 --- a/generator/lib/model/diff/PropelColumnComparator.php +++ b/generator/lib/model/diff/PropelColumnComparator.php @@ -8,8 +8,7 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/../Column.php'; -require_once dirname(__FILE__) . '/PropelColumnDiff.php'; + /** * Service class for comparing Column objects. diff --git a/generator/lib/model/diff/PropelColumnDiff.php b/generator/lib/model/diff/PropelColumnDiff.php index b5ae65a6d..fc6e5357c 100644 --- a/generator/lib/model/diff/PropelColumnDiff.php +++ b/generator/lib/model/diff/PropelColumnDiff.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/../Column.php'; /** * Value object for storing Column object diffs. diff --git a/generator/lib/model/diff/PropelDatabaseComparator.php b/generator/lib/model/diff/PropelDatabaseComparator.php index caef2c853..9013f672e 100644 --- a/generator/lib/model/diff/PropelDatabaseComparator.php +++ b/generator/lib/model/diff/PropelDatabaseComparator.php @@ -8,9 +8,8 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/../Database.php'; -require_once dirname(__FILE__) . '/PropelDatabaseDiff.php'; -require_once dirname(__FILE__) . '/PropelTableComparator.php'; + + /** * Service class for comparing Database objects diff --git a/generator/lib/model/diff/PropelDatabaseDiff.php b/generator/lib/model/diff/PropelDatabaseDiff.php index df531b47f..d102e8226 100644 --- a/generator/lib/model/diff/PropelDatabaseDiff.php +++ b/generator/lib/model/diff/PropelDatabaseDiff.php @@ -8,8 +8,7 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/../Database.php'; -require_once dirname(__FILE__) . '/PropelTableDiff.php'; + /** * Value object for storing Database object diffs diff --git a/generator/lib/model/diff/PropelForeignKeyComparator.php b/generator/lib/model/diff/PropelForeignKeyComparator.php index 46174f00f..1816b3b1b 100644 --- a/generator/lib/model/diff/PropelForeignKeyComparator.php +++ b/generator/lib/model/diff/PropelForeignKeyComparator.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/../ForeignKey.php'; /** * Service class for comparing ForeignKey objects diff --git a/generator/lib/model/diff/PropelIndexComparator.php b/generator/lib/model/diff/PropelIndexComparator.php index 17c2b4eb7..beda5ad1d 100644 --- a/generator/lib/model/diff/PropelIndexComparator.php +++ b/generator/lib/model/diff/PropelIndexComparator.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/../Index.php'; /** * Service class for comparing Index objects diff --git a/generator/lib/model/diff/PropelTableComparator.php b/generator/lib/model/diff/PropelTableComparator.php index 38a323d7e..d75a64869 100644 --- a/generator/lib/model/diff/PropelTableComparator.php +++ b/generator/lib/model/diff/PropelTableComparator.php @@ -8,12 +8,11 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/../Table.php'; -require_once dirname(__FILE__) . '/PropelTableDiff.php'; -require_once dirname(__FILE__) . '/PropelColumnComparator.php'; -require_once dirname(__FILE__) . '/PropelColumnDiff.php'; -require_once dirname(__FILE__) . '/PropelIndexComparator.php'; -require_once dirname(__FILE__) . '/PropelForeignKeyComparator.php'; + + + + + /** * Service class for comparing Table objects diff --git a/generator/lib/model/diff/PropelTableDiff.php b/generator/lib/model/diff/PropelTableDiff.php index 6972ccb6c..22a579c91 100644 --- a/generator/lib/model/diff/PropelTableDiff.php +++ b/generator/lib/model/diff/PropelTableDiff.php @@ -8,8 +8,7 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/../Table.php'; -require_once dirname(__FILE__) . '/PropelColumnDiff.php'; + /** * Value object for storing Table object diffs diff --git a/generator/lib/platform/DefaultPlatform.php b/generator/lib/platform/DefaultPlatform.php index d8ee83fa1..d37c0a5a4 100644 --- a/generator/lib/platform/DefaultPlatform.php +++ b/generator/lib/platform/DefaultPlatform.php @@ -8,11 +8,10 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/PropelPlatformInterface.php'; -require_once dirname(__FILE__) . '/../model/Column.php'; -require_once dirname(__FILE__) . '/../model/Table.php'; -require_once dirname(__FILE__) . '/../model/Domain.php'; -require_once dirname(__FILE__) . '/../model/PropelTypes.php'; + + + + /** * Default implementation for the Platform interface. @@ -1182,7 +1181,7 @@ public function getPhpArrayString($stringValue) $values[] = trim($v); } - $value = implode($values, ' | '); + $value = implode(' | ', $values); if (empty($value) || ' | ' === $value) { return null; } diff --git a/generator/lib/platform/MssqlPlatform.php b/generator/lib/platform/MssqlPlatform.php index fdbb17af3..124f63c93 100644 --- a/generator/lib/platform/MssqlPlatform.php +++ b/generator/lib/platform/MssqlPlatform.php @@ -8,8 +8,7 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/DefaultPlatform.php'; -require_once dirname(__FILE__) . '/../model/Domain.php'; + /** * MS SQL PropelPlatformInterface implementation. diff --git a/generator/lib/platform/MysqlPlatform.php b/generator/lib/platform/MysqlPlatform.php index 6853221e3..be2bcb4d1 100644 --- a/generator/lib/platform/MysqlPlatform.php +++ b/generator/lib/platform/MysqlPlatform.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/DefaultPlatform.php'; /** * MySql PropelPlatformInterface implementation. diff --git a/generator/lib/platform/OraclePlatform.php b/generator/lib/platform/OraclePlatform.php index 44ae559ca..320b5f644 100644 --- a/generator/lib/platform/OraclePlatform.php +++ b/generator/lib/platform/OraclePlatform.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/DefaultPlatform.php'; /** * Oracle PropelPlatformInterface implementation. diff --git a/generator/lib/platform/PgsqlPlatform.php b/generator/lib/platform/PgsqlPlatform.php index 416eb99fc..0e2dac41a 100644 --- a/generator/lib/platform/PgsqlPlatform.php +++ b/generator/lib/platform/PgsqlPlatform.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/DefaultPlatform.php'; /** * Postgresql PropelPlatformInterface implementation. @@ -393,7 +392,7 @@ public function getModifyColumnDDL(PropelColumnDiff $columnDiff) foreach ($changedProperties as $key => $property) { switch ($key) { case 'defaultValueType': - continue; + continue 2; case 'size': case 'type': case 'scale': diff --git a/generator/lib/platform/SqlitePlatform.php b/generator/lib/platform/SqlitePlatform.php index 5e6709f00..e58708617 100644 --- a/generator/lib/platform/SqlitePlatform.php +++ b/generator/lib/platform/SqlitePlatform.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/DefaultPlatform.php'; /** * SQLite PropelPlatformInterface implementation. diff --git a/generator/lib/platform/SqlsrvPlatform.php b/generator/lib/platform/SqlsrvPlatform.php index 867075b04..ec4ebd788 100644 --- a/generator/lib/platform/SqlsrvPlatform.php +++ b/generator/lib/platform/SqlsrvPlatform.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/MssqlPlatform.php'; /** * MS SQL Server using pdo_sqlsrv implementation. diff --git a/generator/lib/reverse/BaseSchemaParser.php b/generator/lib/reverse/BaseSchemaParser.php index e35bd36d5..a12a64e52 100644 --- a/generator/lib/reverse/BaseSchemaParser.php +++ b/generator/lib/reverse/BaseSchemaParser.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/SchemaParser.php'; /** * Base class for reverse engineering a database schema. diff --git a/generator/lib/reverse/mssql/MssqlSchemaParser.php b/generator/lib/reverse/mssql/MssqlSchemaParser.php index c76d0e0a3..f9e697526 100644 --- a/generator/lib/reverse/mssql/MssqlSchemaParser.php +++ b/generator/lib/reverse/mssql/MssqlSchemaParser.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/../BaseSchemaParser.php'; /** * Microsoft SQL Server database schema parser. diff --git a/generator/lib/reverse/mysql/MysqlSchemaParser.php b/generator/lib/reverse/mysql/MysqlSchemaParser.php index 7dfbc14bb..e95709079 100644 --- a/generator/lib/reverse/mysql/MysqlSchemaParser.php +++ b/generator/lib/reverse/mysql/MysqlSchemaParser.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/../BaseSchemaParser.php'; /** * Mysql database schema parser. diff --git a/generator/lib/reverse/oracle/OracleSchemaParser.php b/generator/lib/reverse/oracle/OracleSchemaParser.php index c7c073623..addccc832 100644 --- a/generator/lib/reverse/oracle/OracleSchemaParser.php +++ b/generator/lib/reverse/oracle/OracleSchemaParser.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/../BaseSchemaParser.php'; /** * Oracle database schema parser. diff --git a/generator/lib/reverse/pgsql/PgsqlSchemaParser.php b/generator/lib/reverse/pgsql/PgsqlSchemaParser.php index 091284edb..ef98f6f60 100644 --- a/generator/lib/reverse/pgsql/PgsqlSchemaParser.php +++ b/generator/lib/reverse/pgsql/PgsqlSchemaParser.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/../BaseSchemaParser.php'; /** * Postgresql database schema parser. diff --git a/generator/lib/reverse/sqlite/SqliteSchemaParser.php b/generator/lib/reverse/sqlite/SqliteSchemaParser.php index d90bd4097..a05f8151d 100644 --- a/generator/lib/reverse/sqlite/SqliteSchemaParser.php +++ b/generator/lib/reverse/sqlite/SqliteSchemaParser.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/../BaseSchemaParser.php'; /** * SQLite database schema parser. diff --git a/generator/lib/reverse/sqlsrv/SqlsrvSchemaParser.php b/generator/lib/reverse/sqlsrv/SqlsrvSchemaParser.php index b79c127bb..712d33150 100644 --- a/generator/lib/reverse/sqlsrv/SqlsrvSchemaParser.php +++ b/generator/lib/reverse/sqlsrv/SqlsrvSchemaParser.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once 'reverse/mssql/MssqlSchemaParser.php'; /** * Microsoft SQL Server database schema parser. diff --git a/generator/lib/task/AbstractPropelDataModelTask.php b/generator/lib/task/AbstractPropelDataModelTask.php index b1c1fa564..11f5d8c58 100644 --- a/generator/lib/task/AbstractPropelDataModelTask.php +++ b/generator/lib/task/AbstractPropelDataModelTask.php @@ -9,7 +9,7 @@ */ //include_once 'phing/tasks/ext/CapsuleTask.php'; -require_once 'task/AbstractPropelTask.php'; + include_once 'config/GeneratorConfig.php'; include_once 'model/AppData.php'; include_once 'model/Database.php'; diff --git a/generator/lib/task/AbstractPropelTask.php b/generator/lib/task/AbstractPropelTask.php index 4343e21ef..b6df8b79c 100644 --- a/generator/lib/task/AbstractPropelTask.php +++ b/generator/lib/task/AbstractPropelTask.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once 'phing/Task.php'; require_once __DIR__ . '/../../stubs/functions.php'; abstract class AbstractPropelTask extends Task diff --git a/generator/lib/task/BasePropelMigrationTask.php b/generator/lib/task/BasePropelMigrationTask.php index dba36a282..742b1e8fc 100644 --- a/generator/lib/task/BasePropelMigrationTask.php +++ b/generator/lib/task/BasePropelMigrationTask.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once 'task/AbstractPropelTask.php'; /** * This Task lists the migrations yet to be executed diff --git a/generator/lib/task/PropelConvertConfTask.php b/generator/lib/task/PropelConvertConfTask.php index 2db5e2712..e210e8f55 100644 --- a/generator/lib/task/PropelConvertConfTask.php +++ b/generator/lib/task/PropelConvertConfTask.php @@ -8,10 +8,9 @@ * @license MIT License */ -require_once 'task/AbstractPropelTask.php'; -require_once 'task/AbstractPropelDataModelTask.php'; -require_once 'builder/om/OMBuilder.php'; -require_once 'builder/om/ClassTools.php'; + + + /** * This Task converts the XML runtime configuration file into a PHP array for faster performance. diff --git a/generator/lib/task/PropelDataSQLTask.php b/generator/lib/task/PropelDataSQLTask.php index 5c645c7db..8fba3b59a 100644 --- a/generator/lib/task/PropelDataSQLTask.php +++ b/generator/lib/task/PropelDataSQLTask.php @@ -8,10 +8,9 @@ * @license MIT License */ -require_once 'model/AppData.php'; -require_once 'model/Database.php'; -require_once 'builder/util/XmlToAppData.php'; -require_once 'builder/util/XmlToDataSQL.php'; + + + /** * Task that transforms XML datadump files into files containing SQL INSERT statements. diff --git a/generator/lib/task/PropelGraphvizTask.php b/generator/lib/task/PropelGraphvizTask.php index 6493d728e..b9c62e9a1 100644 --- a/generator/lib/task/PropelGraphvizTask.php +++ b/generator/lib/task/PropelGraphvizTask.php @@ -8,9 +8,8 @@ * @license MIT License */ -require_once 'task/AbstractPropelDataModelTask.php'; -require_once 'model/AppData.php'; -require_once 'util/PropelDotGenerator.php'; + + /** * A task to generate Graphviz dot files from Propel datamodel. diff --git a/generator/lib/task/PropelMigrationDownTask.php b/generator/lib/task/PropelMigrationDownTask.php index ff2b37581..539ae704f 100644 --- a/generator/lib/task/PropelMigrationDownTask.php +++ b/generator/lib/task/PropelMigrationDownTask.php @@ -8,8 +8,7 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/BasePropelMigrationTask.php'; -require_once dirname(__FILE__) . '/../util/PropelMigrationManager.php'; + /** * This Task executes the next migration down diff --git a/generator/lib/task/PropelMigrationStatusTask.php b/generator/lib/task/PropelMigrationStatusTask.php index 7c3a1319b..21939ef81 100644 --- a/generator/lib/task/PropelMigrationStatusTask.php +++ b/generator/lib/task/PropelMigrationStatusTask.php @@ -8,8 +8,7 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/BasePropelMigrationTask.php'; -require_once dirname(__FILE__) . '/../util/PropelMigrationManager.php'; + /** * This Task lists the migrations yet to be executed diff --git a/generator/lib/task/PropelMigrationTask.php b/generator/lib/task/PropelMigrationTask.php index 8f8347114..e059f1bf3 100644 --- a/generator/lib/task/PropelMigrationTask.php +++ b/generator/lib/task/PropelMigrationTask.php @@ -8,8 +8,7 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/BasePropelMigrationTask.php'; -require_once dirname(__FILE__) . '/../util/PropelMigrationManager.php'; + /** * This Task executes the next migrations up diff --git a/generator/lib/task/PropelMigrationUpTask.php b/generator/lib/task/PropelMigrationUpTask.php index 5a0e13ff7..ab814a566 100644 --- a/generator/lib/task/PropelMigrationUpTask.php +++ b/generator/lib/task/PropelMigrationUpTask.php @@ -8,8 +8,7 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/BasePropelMigrationTask.php'; -require_once dirname(__FILE__) . '/../util/PropelMigrationManager.php'; + /** * This Task executes the next migration up diff --git a/generator/lib/task/PropelOMTask.php b/generator/lib/task/PropelOMTask.php index f9c850e49..67bcefda0 100644 --- a/generator/lib/task/PropelOMTask.php +++ b/generator/lib/task/PropelOMTask.php @@ -8,9 +8,8 @@ * @license MIT License */ -require_once 'task/AbstractPropelDataModelTask.php'; -require_once 'builder/om/ClassTools.php'; -require_once 'builder/om/OMBuilder.php'; + + /** * This Task creates the OM classes based on the XML schema file. diff --git a/generator/lib/task/PropelSQLDiffTask.php b/generator/lib/task/PropelSQLDiffTask.php index dfb2991c2..407c08e73 100644 --- a/generator/lib/task/PropelSQLDiffTask.php +++ b/generator/lib/task/PropelSQLDiffTask.php @@ -8,11 +8,10 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/AbstractPropelDataModelTask.php'; -require_once dirname(__FILE__) . '/../builder/om/ClassTools.php'; -require_once dirname(__FILE__) . '/../builder/om/OMBuilder.php'; -require_once dirname(__FILE__) . '/../model/diff/PropelDatabaseComparator.php'; -require_once dirname(__FILE__) . '/../util/PropelMigrationManager.php'; + + + + /** * This Task creates the OM classes based on the XML schema file. diff --git a/generator/lib/task/PropelSQLExec.php b/generator/lib/task/PropelSQLExec.php index 158e5b0ce..36dfb40b2 100644 --- a/generator/lib/task/PropelSQLExec.php +++ b/generator/lib/task/PropelSQLExec.php @@ -8,8 +8,7 @@ * @license MIT License */ -require_once 'task/AbstractPropelTask.php'; -require_once dirname(__FILE__) . '/../util/PropelSQLParser.php'; + /** * Executes all SQL files referenced in the sqldbmap file against their mapped databases. diff --git a/generator/lib/task/PropelSQLTask.php b/generator/lib/task/PropelSQLTask.php index 010e7b4a4..b4f8f39f4 100644 --- a/generator/lib/task/PropelSQLTask.php +++ b/generator/lib/task/PropelSQLTask.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once 'model/AppData.php'; /** * The task for building SQL DDL based on the XML datamodel. diff --git a/generator/lib/task/PropelSchemaReverseTask.php b/generator/lib/task/PropelSchemaReverseTask.php index c67eea7f1..7bad58875 100644 --- a/generator/lib/task/PropelSchemaReverseTask.php +++ b/generator/lib/task/PropelSchemaReverseTask.php @@ -8,9 +8,8 @@ * @license MIT License */ -require_once 'phing/tasks/ext/pdo/PDOTask.php'; -require_once 'config/GeneratorConfig.php'; -require_once 'model/PropelTypes.php'; + + /** * This class generates an XML schema of an existing database from diff --git a/generator/lib/task/PropelSqlBuildTask.php b/generator/lib/task/PropelSqlBuildTask.php index d66dc091b..00a9bc356 100644 --- a/generator/lib/task/PropelSqlBuildTask.php +++ b/generator/lib/task/PropelSqlBuildTask.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once 'util/PropelSqlManager.php'; /** * The new task for building SQL DDL based on the XML datamodel. diff --git a/generator/lib/util/PropelMigrationManager.php b/generator/lib/util/PropelMigrationManager.php index 7b58f7575..96674c6d7 100644 --- a/generator/lib/util/PropelMigrationManager.php +++ b/generator/lib/util/PropelMigrationManager.php @@ -8,10 +8,9 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/../model/Table.php'; -require_once dirname(__FILE__) . '/../model/Column.php'; -require_once dirname(__FILE__) . '/PropelSQLParser.php'; -require_once dirname(__FILE__) . '/../../../runtime/lib/Propel.php'; + + + /** * Service class for preparing and executing migrations diff --git a/generator/lib/util/PropelQuickBuilder.php b/generator/lib/util/PropelQuickBuilder.php index 1043a226b..84412cb30 100644 --- a/generator/lib/util/PropelQuickBuilder.php +++ b/generator/lib/util/PropelQuickBuilder.php @@ -8,8 +8,7 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/../builder/util/XmlToAppData.php'; -require_once dirname(__FILE__) . '/PropelSQLParser.php'; + class PropelQuickBuilder { @@ -45,7 +44,7 @@ public function setPlatform($platform) public function getPlatform() { if (null === $this->platform) { - require_once dirname(__FILE__) . '/../platform/SqlitePlatform.php'; + $this->platform = new SqlitePlatform(); } @@ -70,7 +69,7 @@ public function setConfig(GeneratorConfigInterface $config) public function getConfig() { if (null === $this->config) { - require_once dirname(__FILE__) . '/../config/QuickGeneratorConfig.php'; + $this->config = new QuickGeneratorConfig($this->getPlatform()); } diff --git a/generator/lib/util/PropelSqlManager.php b/generator/lib/util/PropelSqlManager.php index 5820683e4..c597c1086 100644 --- a/generator/lib/util/PropelSqlManager.php +++ b/generator/lib/util/PropelSqlManager.php @@ -8,8 +8,7 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/../config/GeneratorConfigInterface.php'; -require_once dirname(__FILE__) . '/../util/PropelSQLParser.php'; + /** * Service class for managing SQL. diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 4b1811a2c..e733fdf27 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,27 +1,14 @@ - - - - - - ./test/testsuite/ - - - - - - ./runtime/lib/ - ./generator/lib/ - - + + + + ./runtime/lib/ + ./generator/lib/ + + + + + ./test/testsuite/ + + diff --git a/runtime/lib/collection/PropelOnDemandCollection.php b/runtime/lib/collection/PropelOnDemandCollection.php index dc8a993c5..b1bd8c073 100644 --- a/runtime/lib/collection/PropelOnDemandCollection.php +++ b/runtime/lib/collection/PropelOnDemandCollection.php @@ -148,7 +148,7 @@ public function prepend($value) throw new PropelException('The On Demand Collection is read only'); } - public function asort() + public function asort(int $flags = SORT_REGULAR): bool { throw new PropelException('The On Demand Collection is read only'); } @@ -168,7 +168,7 @@ public function getFlags() throw new PropelException('The On Demand Collection does not allow access by offset'); } - public function ksort() + public function ksort(int $flags = SORT_REGULAR) { throw new PropelException('The On Demand Collection is read only'); } diff --git a/runtime/lib/connection/DebugPDOStatement.php b/runtime/lib/connection/DebugPDOStatement.php index 9e8e557be..390ddea77 100644 --- a/runtime/lib/connection/DebugPDOStatement.php +++ b/runtime/lib/connection/DebugPDOStatement.php @@ -81,6 +81,11 @@ public function getExecutedQueryString(array $values = array()) $boundValue = trim($boundValue, "'"); $boundValue = $this->pdo->quote($boundValue); } + + if (is_resource($boundValue)) { + $boundValue = '[BLOB]'; + } + $sql = str_replace($pos, $boundValue, $sql); } } @@ -101,7 +106,7 @@ public function execute($input_parameters = null) $debug = $this->pdo->getDebugSnapshot(); $return = parent::execute($input_parameters); - $sql = $this->getExecutedQueryString($input_parameters?$input_parameters:array()); + $sql = $this->getExecutedQueryString($input_parameters ? $input_parameters : []); $this->pdo->log($sql, null, __METHOD__, $debug); $this->pdo->setLastExecutedQuery($sql); $this->pdo->incrementQueryCount(); diff --git a/runtime/lib/connection/PropelPDO.php b/runtime/lib/connection/PropelPDO.php index 7d30a08f1..5236e0107 100644 --- a/runtime/lib/connection/PropelPDO.php +++ b/runtime/lib/connection/PropelPDO.php @@ -448,18 +448,16 @@ public function exec($sql) * * @return PDOStatement */ - public function query() + public function query(string $statement, ?int $fetchMode = null, ...$fetchModeArgs) { + $debug = null; + if ($this->useDebug) { $debug = $this->getDebugSnapshot(); } $args = func_get_args(); - if (version_compare(PHP_VERSION, '5.3', '<')) { - $return = call_user_func_array(array($this, 'parent::query'), $args); - } else { - $return = call_user_func_array('parent::query', $args); - } + $return = parent::query(...$args); if ($this->useDebug) { $sql = $args[0]; diff --git a/runtime/lib/formatter/PropelArrayFormatter.php b/runtime/lib/formatter/PropelArrayFormatter.php index a8dd8edbc..87ba24cf9 100644 --- a/runtime/lib/formatter/PropelArrayFormatter.php +++ b/runtime/lib/formatter/PropelArrayFormatter.php @@ -32,18 +32,29 @@ public function format(PDOStatement $stmt) } else { $collection = array(); } + + /** + * @var $collection PropelArrayCollection + */ + if ($this->isWithOneToMany() && $this->hasLimit) { throw new PropelException('Cannot use limit() in conjunction with with() on a one-to-many relationship. Please remove the with() call, or the limit() call.'); } + + $data = []; + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { - if ($object = &$this->getStructuredArrayFromRow($row)) { - $collection[] = $object; + $object = &$this->getStructuredArrayFromRow($row); + if ($object) { + $data[] = &$object; } } $this->currentObjects = array(); $this->alreadyHydratedObjects = array(); $stmt->closeCursor(); + $collection->setData($data); + return $collection; } @@ -163,7 +174,7 @@ public function &getStructuredArrayFromRow($row) return $this->alreadyHydratedObjects[$this->class][$mainKey]; } else { // we still need to return a reference to something to avoid a warning - return $emptyVariable; + return $this->emptyVariable; } } } diff --git a/runtime/lib/map/TableMap.php b/runtime/lib/map/TableMap.php index 8ec8a521f..fea362c69 100644 --- a/runtime/lib/map/TableMap.php +++ b/runtime/lib/map/TableMap.php @@ -786,6 +786,10 @@ public function setPrefix($prefix) */ protected function hasPrefix($data) { + if (!$this->prefix) { + return false; + } + return (strpos($data, $this->prefix) === 0); } diff --git a/runtime/lib/parser/PropelCSVParser.php b/runtime/lib/parser/PropelCSVParser.php index 37e213f71..005457847 100644 --- a/runtime/lib/parser/PropelCSVParser.php +++ b/runtime/lib/parser/PropelCSVParser.php @@ -45,19 +45,19 @@ public function fromArray($array, $isList = false, $includeHeading = true) $rows = array(); if ($isList) { if ($includeHeading) { - $rows[] = implode($this->formatRow(array_keys(reset($array))), $this->delimiter); + $rows[] = implode($this->delimiter, $this->formatRow(array_keys(reset($array)))); } foreach ($array as $row) { - $rows[] = implode($this->formatRow($row), $this->delimiter); + $rows[] = implode($this->delimiter, $this->formatRow($row)); } } else { if ($includeHeading) { - $rows[] = implode($this->formatRow(array_keys($array)), $this->delimiter); + $rows[] = implode($this->delimiter, $this->formatRow(array_keys($array))); } - $rows[] = implode($this->formatRow($array), $this->delimiter); + $rows[] = implode($this->delimiter, $this->formatRow($array)); } - return implode($rows, $this->lineTerminator) . $this->lineTerminator; + return implode($this->lineTerminator, $rows) . $this->lineTerminator; } public function listFromArray($array) diff --git a/runtime/lib/parser/yaml/sfYamlInline.php b/runtime/lib/parser/yaml/sfYamlInline.php index b39a945f7..331802a00 100644 --- a/runtime/lib/parser/yaml/sfYamlInline.php +++ b/runtime/lib/parser/yaml/sfYamlInline.php @@ -37,10 +37,8 @@ public static function load($value) return ''; } - if (function_exists('mb_internal_encoding') && ((int) ini_get('mbstring.func_overload')) & 2) { - $mbEncoding = mb_internal_encoding(); - mb_internal_encoding('ASCII'); - } + $mbEncoding = mb_internal_encoding(); + mb_internal_encoding('ASCII'); switch ($value[0]) { case '[': @@ -124,10 +122,8 @@ protected static function dumpArray($value) { // array $keys = array_keys($value); - if ( - (1 == count($keys) && '0' == $keys[0]) - || - (count($keys) > 1 && array_reduce($keys, create_function('$v,$w', 'return (integer) $v + $w;'), 0) == count($keys) * (count($keys) - 1) / 2)) + + if (count($value) > 0 && array_values($value) === $value) { $output = array(); foreach ($value as $val) { diff --git a/runtime/lib/parser/yaml/sfYamlParser.php b/runtime/lib/parser/yaml/sfYamlParser.php index a0363608c..b3f67576f 100644 --- a/runtime/lib/parser/yaml/sfYamlParser.php +++ b/runtime/lib/parser/yaml/sfYamlParser.php @@ -56,10 +56,8 @@ public function parse($value) $this->currentLine = ''; $this->lines = explode("\n", $this->cleanup($value)); - if (function_exists('mb_internal_encoding') && ((int) ini_get('mbstring.func_overload')) & 2) { - $mbEncoding = mb_internal_encoding(); - mb_internal_encoding('UTF-8'); - } + $mbEncoding = mb_internal_encoding(); + mb_internal_encoding('UTF-8'); $data = array(); while ($this->moveToNextLine()) { @@ -327,7 +325,7 @@ protected function parseValue($value) if (preg_match('/^(?P\||>)(?P\+|\-|\d+|\+\d+|\-\d+|\d+\+|\d+\-)?(?P +#.*)?$/', $value, $matches)) { $modifiers = isset($matches['modifiers']) ? $matches['modifiers'] : ''; - return $this->parseFoldedScalar($matches['separator'], preg_replace('#\d+#', '', $modifiers), intval(abs($modifiers))); + return $this->parseFoldedScalar($matches['separator'], preg_replace('#\d+#', '', $modifiers), abs((int)$modifiers)); } else { return sfYamlInline::load($value); } diff --git a/runtime/lib/query/Join.php b/runtime/lib/query/Join.php index b9a78ab5b..be3f37784 100644 --- a/runtime/lib/query/Join.php +++ b/runtime/lib/query/Join.php @@ -537,7 +537,7 @@ public function getClause(&$params) for ($i = 0; $i < $this->count; $i++) { $conditions [] = $this->getLeftColumn($i) . $this->getOperator($i) . $this->getRightColumn($i); } - $joinCondition = sprintf('(%s)', implode($conditions, ' AND ')); + $joinCondition = sprintf('(%s)', implode(' AND ', $conditions)); } else { $joinCondition = ''; $this->getJoinCondition()->appendPsTo($joinCondition, $params); diff --git a/runtime/lib/query/ModelCriteria.php b/runtime/lib/query/ModelCriteria.php index e68c0836b..5ea69007b 100644 --- a/runtime/lib/query/ModelCriteria.php +++ b/runtime/lib/query/ModelCriteria.php @@ -525,7 +525,7 @@ public function offset($offset) */ public function select($columnArray) { - if (!count($columnArray) || $columnArray == '') { + if (empty($columnArray)) { throw new PropelException('You must ask for at least one column'); } diff --git a/runtime/lib/util/BasePeer.php b/runtime/lib/util/BasePeer.php index 8b71b88ee..156271f6e 100644 --- a/runtime/lib/util/BasePeer.php +++ b/runtime/lib/util/BasePeer.php @@ -397,10 +397,10 @@ public static function doUpdate(Criteria $selectCriteria, Criteria $updateValues $rawcvt = ''; // parse the $params['raw'] for ? chars for ($r = 0, $len = strlen($raw); $r < $len; $r++) { - if ($raw{$r} == '?') { + if ($raw[$r] == '?') { $rawcvt .= ':p' . $p++; } else { - $rawcvt .= $raw{$r}; + $rawcvt .= $raw[$r]; } } $sql .= $rawcvt . ', '; diff --git a/runtime/lib/validator/MatchValidator.php b/runtime/lib/validator/MatchValidator.php index 924e6b845..69d62c33f 100644 --- a/runtime/lib/validator/MatchValidator.php +++ b/runtime/lib/validator/MatchValidator.php @@ -50,7 +50,7 @@ class MatchValidator implements BasicValidator private function prepareRegexp($exp) { // remove surrounding '/' marks so that they don't get escaped in next step - if ($exp{0} !== '/' || $exp{strlen($exp) - 1} !== '/') { + if ($exp[0] !== '/' || $exp[strlen($exp) - 1] !== '/') { $exp = '/' . $exp . '/'; } diff --git a/runtime/lib/validator/NotMatchValidator.php b/runtime/lib/validator/NotMatchValidator.php index 1adb6047f..a214ca7a2 100644 --- a/runtime/lib/validator/NotMatchValidator.php +++ b/runtime/lib/validator/NotMatchValidator.php @@ -48,7 +48,7 @@ class NotMatchValidator implements BasicValidator private function prepareRegexp($exp) { // remove surrounding '/' marks so that they don't get escaped in next step - if ($exp{0} !== '/' || $exp{strlen($exp) - 1} !== '/') { + if ($exp[0] !== '/' || $exp[strlen($exp) - 1] !== '/') { $exp = '/' . $exp . '/'; } diff --git a/test/testsuite/generator/behavior/AlternativeCodingStandardsBehaviorTest.php b/test/testsuite/generator/behavior/AlternativeCodingStandardsBehaviorTest.php index 10c8df1ba..6b400075a 100644 --- a/test/testsuite/generator/behavior/AlternativeCodingStandardsBehaviorTest.php +++ b/test/testsuite/generator/behavior/AlternativeCodingStandardsBehaviorTest.php @@ -19,7 +19,7 @@ * @version $Revision$ * @package generator.behavior */ -class AlternativeCodingStandardsBehaviorTest extends PHPUnit_Framework_TestCase +class AlternativeCodingStandardsBehaviorTest extends \PHPUnit\Framework\TestCase { public function convertBracketsNewlineDataProvider() { diff --git a/test/testsuite/generator/behavior/DelegateBehaviorTest.php b/test/testsuite/generator/behavior/DelegateBehaviorTest.php index a0d814755..761300586 100644 --- a/test/testsuite/generator/behavior/DelegateBehaviorTest.php +++ b/test/testsuite/generator/behavior/DelegateBehaviorTest.php @@ -20,10 +20,10 @@ * @version $Revision$ * @package generator.behavior */ -class DelegateBehaviorTest extends PHPUnit_Framework_TestCase +class DelegateBehaviorTest extends \PHPUnit\Framework\TestCase { - public function setUp() + protected function setUp(): void { if (!class_exists('DelegateDelegate')) { $schema = <<expectException(PropelException::class); $main = new DelegateMain(); $main->setSummary('bar'); $main->setBody('baz'); diff --git a/test/testsuite/generator/behavior/NamespacedBehaviorTest.php b/test/testsuite/generator/behavior/NamespacedBehaviorTest.php index b9d58caf7..5c541ea30 100644 --- a/test/testsuite/generator/behavior/NamespacedBehaviorTest.php +++ b/test/testsuite/generator/behavior/NamespacedBehaviorTest.php @@ -1,7 +1,7 @@ con = Propel::getConnection(BookstoreSchemasBookstorePeer::DATABASE_NAME); $this->con->beginTransaction(); } - protected function tearDown() + protected function tearDown(): void { $this->con->commit(); parent::tearDown(); diff --git a/test/testsuite/generator/behavior/archivable/ArchivableAndConcreteInheritanceBehaviorTest.php b/test/testsuite/generator/behavior/archivable/ArchivableAndConcreteInheritanceBehaviorTest.php index 1987a7eb7..bdd5cf0a9 100644 --- a/test/testsuite/generator/behavior/archivable/ArchivableAndConcreteInheritanceBehaviorTest.php +++ b/test/testsuite/generator/behavior/archivable/ArchivableAndConcreteInheritanceBehaviorTest.php @@ -16,11 +16,11 @@ /** * Tests for the combination of ArchivableBehavior and ConcreteInheritanceBehavior classes */ -class ArchivableAndConcreteInheritanceBehaviorTest extends PHPUnit_Framework_TestCase +class ArchivableAndConcreteInheritanceBehaviorTest extends \PHPUnit\Framework\TestCase { protected static $generatedSQL; - public function setUp() + public function setUp(): void { if (!class_exists('ArchivableConcretePagePeer')) { $schema = <<expectException(PropelException::class); + $this->expectException(PropelException::class); $a = new ArchivableTest10(); $a->archive(); } @@ -196,6 +198,7 @@ public function testHasRestoreFromArchiveMethod() */ public function testRestoreFromArchiveThrowsExceptionOnUnarchivedObjects() { + $this->expectException(PropelException::class); $a = new ArchivableTest10(); $a->setTitle('foo'); $a->setAge(12); diff --git a/test/testsuite/generator/behavior/archivable/ArchivableBehaviorQueryBuilderModifierTest.php b/test/testsuite/generator/behavior/archivable/ArchivableBehaviorQueryBuilderModifierTest.php index e605080f4..7b3a2cd3f 100644 --- a/test/testsuite/generator/behavior/archivable/ArchivableBehaviorQueryBuilderModifierTest.php +++ b/test/testsuite/generator/behavior/archivable/ArchivableBehaviorQueryBuilderModifierTest.php @@ -20,9 +20,9 @@ * @version $Revision$ * @package generator.behavior.archivable */ -class ArchivableBehaviorQueryBuilderModifierTest extends PHPUnit_Framework_TestCase +class ArchivableBehaviorQueryBuilderModifierTest extends \PHPUnit\Framework\TestCase { - public function setUp() + public function setUp(): void { if (!class_exists('ArchivableTest100')) { $schema = <<assertTrue($table->hasColumn('id')); - $this->assertContains('[id] INTEGER NOT NULL,', self::$generatedSQL, 'copied columns are not autoincremented'); + $this->assertStringContainsString('[id] INTEGER NOT NULL,', self::$generatedSQL, 'copied columns are not autoincremented'); $this->assertTrue($table->hasColumn('title')); $this->assertTrue($table->hasColumn('age')); $this->assertTrue($table->hasColumn('foo_id')); @@ -153,7 +153,7 @@ public function testCopiesIndices() $table = ArchivableTest1ArchivePeer::getTableMap(); $expected = "CREATE INDEX [archivable_test_1_archive_I_1] ON [archivable_test_1_archive] ([title],[age]);"; - $this->assertContains($expected, self::$generatedSQL); + $this->assertStringContainsString($expected, self::$generatedSQL); } public function testCopiesUniquesToIndices() @@ -161,7 +161,7 @@ public function testCopiesUniquesToIndices() $table = ArchivableTest2ArchivePeer::getTableMap(); $expected = "CREATE INDEX [my_old_archivable_test_3_I_1] ON [my_old_archivable_test_3] ([title]);"; - $this->assertContains($expected, self::$generatedSQL); + $this->assertStringContainsString($expected, self::$generatedSQL); } public function testAddsArchivedAtColumnToArchiveTableByDefault() diff --git a/test/testsuite/generator/behavior/concrete_inheritance/ConcreteInheritanceBehaviorTest.php b/test/testsuite/generator/behavior/concrete_inheritance/ConcreteInheritanceBehaviorTest.php index 70610079d..ff4f96904 100644 --- a/test/testsuite/generator/behavior/concrete_inheritance/ConcreteInheritanceBehaviorTest.php +++ b/test/testsuite/generator/behavior/concrete_inheritance/ConcreteInheritanceBehaviorTest.php @@ -23,7 +23,7 @@ */ class ConcreteInheritanceBehaviorTest extends BookstoreTestBase { - public function setUp() + public function setUp(): void { parent::setUp(); @@ -125,6 +125,7 @@ public function testModifyTableCopyDataRemovesAutoIncrement() */ public function testModifyTableNoCopyDataKeepsAutoIncrement() { + $this->expectException(PropelException::class); $content = new ConcreteContent(); $content->save(); $c = new Criteria; diff --git a/test/testsuite/generator/behavior/concrete_inheritance/ConcreteInheritanceExcludedParentBehaviorTest.php b/test/testsuite/generator/behavior/concrete_inheritance/ConcreteInheritanceExcludedParentBehaviorTest.php index 6a6be079c..cc2a7992a 100644 --- a/test/testsuite/generator/behavior/concrete_inheritance/ConcreteInheritanceExcludedParentBehaviorTest.php +++ b/test/testsuite/generator/behavior/concrete_inheritance/ConcreteInheritanceExcludedParentBehaviorTest.php @@ -26,14 +26,14 @@ public function testHasChildObjectAddChildMethod() $article = new ConcreteTag(); // to autoload the BaseConcreteArticle class $r = new ReflectionClass('BaseConcreteTag'); $p =$r->getMethod('addChild')->getParameters(); - $this->assertEquals('ConcreteCategory', $p[0]->getClass()->getName(), 'concrete_inheritance does not generate addChild method child object class'); + $this->assertEquals('ConcreteCategory', $p[0]->getType()->getName(), 'concrete_inheritance does not generate addChild method child object class'); } public function testHasChildPeerIsValidMethod() { $r = new ReflectionClass('BaseConcreteTagPeer'); $p =$r->getMethod('isValid')->getParameters(); - $this->assertEquals('ConcreteCategory', $p[0]->getClass()->getName(), 'concrete_inheritance does not generate isValid method child peer class'); + $this->assertEquals('ConcreteCategory', $p[0]->getType()->getName(), 'concrete_inheritance does not generate isValid method child peer class'); } } diff --git a/test/testsuite/generator/behavior/i18n/I18nBehaviorObjectBuilderModifierTest.php b/test/testsuite/generator/behavior/i18n/I18nBehaviorObjectBuilderModifierTest.php index 7a6cd8e82..5fc0b3bf6 100644 --- a/test/testsuite/generator/behavior/i18n/I18nBehaviorObjectBuilderModifierTest.php +++ b/test/testsuite/generator/behavior/i18n/I18nBehaviorObjectBuilderModifierTest.php @@ -20,9 +20,9 @@ * @version $Revision$ * @package generator.behavior.i18n */ -class I18nBehaviorObjectBuilderModifierTest extends PHPUnit_Framework_TestCase +class I18nBehaviorObjectBuilderModifierTest extends \PHPUnit\Framework\TestCase { - public function setUp() + public function setUp(): void { if (!class_exists('I18nBehaviorTest1')) { $schema = <<assertContains($expected, $builder->getSQL()); + $this->assertStringContainsString($expected, $builder->getSQL()); } public function testModifyDatabaseDoesNotOverrideTableLocale() @@ -85,7 +85,7 @@ public function testModifyDatabaseDoesNotOverrideTableLocale() PRIMARY KEY ([id],[locale]) ); EOF; - $this->assertContains($expected, $builder->getSQL()); + $this->assertStringContainsString($expected, $builder->getSQL()); } public function schemaDataProvider() @@ -139,7 +139,7 @@ public function testModifyTableAddsI18nTable($schema) CREATE TABLE [i18n_behavior_test_0_i18n] EOF; - $this->assertContains($expected, $builder->getSQL()); + $this->assertStringContainsString($expected, $builder->getSQL()); } /** @@ -152,7 +152,7 @@ public function testModifyTableRelatesI18nTableToMainTable($schema) $expected = <<assertContains($expected, $builder->getSQL()); + $this->assertStringContainsString($expected, $builder->getSQL()); } /** @@ -168,7 +168,7 @@ public function testModifyTableAddsLocaleColumnToI18n($schema) [id] INTEGER NOT NULL, [locale] VARCHAR(5) DEFAULT 'en_US' NOT NULL, EOF; - $this->assertContains($expected, $builder->getSQL()); + $this->assertStringContainsString($expected, $builder->getSQL()); } /** @@ -187,7 +187,7 @@ public function testModifyTableMovesI18nColumns($schema) PRIMARY KEY ([id],[locale]) ); EOF; - $this->assertContains($expected, $builder->getSQL()); + $this->assertStringContainsString($expected, $builder->getSQL()); } /** @@ -204,7 +204,7 @@ public function testModifyTableDoesNotMoveNonI18nColumns($schema) [foo] INTEGER ); EOF; - $this->assertContains($expected, $builder->getSQL()); + $this->assertStringContainsString($expected, $builder->getSQL()); } public function testModifyTableMovesValidatorsOnI18nColumns() @@ -285,7 +285,7 @@ public function testModifyTableUsesCustomI18nTableName() PRIMARY KEY ([id],[locale]) ); EOF; - $this->assertContains($expected, $builder->getSQL()); + $this->assertStringContainsString($expected, $builder->getSQL()); } public function testModiFyTableUsesCustomLocaleColumnName() @@ -316,7 +316,7 @@ public function testModiFyTableUsesCustomLocaleColumnName() PRIMARY KEY ([id],[culture]) ); EOF; - $this->assertContains($expected, $builder->getSQL()); + $this->assertStringContainsString($expected, $builder->getSQL()); } public function testModiFyTableUsesCustomLocaleDefault() @@ -347,7 +347,7 @@ public function testModiFyTableUsesCustomLocaleDefault() PRIMARY KEY ([id],[locale]) ); EOF; - $this->assertContains($expected, $builder->getSQL()); + $this->assertStringContainsString($expected, $builder->getSQL()); } /** @@ -398,7 +398,7 @@ public function testModifyTableUseCustomPkName() PRIMARY KEY ([custom_id],[locale]) ); EOF; - $this->assertContains($expected, $builder->getSQL()); + $this->assertStringContainsString($expected, $builder->getSQL()); } diff --git a/test/testsuite/generator/behavior/nestedset/NestedSetBehaviorObjectBuilderModifierTest.php b/test/testsuite/generator/behavior/nestedset/NestedSetBehaviorObjectBuilderModifierTest.php index cf36b755c..9ef196400 100644 --- a/test/testsuite/generator/behavior/nestedset/NestedSetBehaviorObjectBuilderModifierTest.php +++ b/test/testsuite/generator/behavior/nestedset/NestedSetBehaviorObjectBuilderModifierTest.php @@ -92,6 +92,7 @@ public function testSaveOutOfTree() */ public function testSaveRootInTreeWithExistingRoot() { + $this->expectException(PropelException::class); Table9Peer::doDeleteAll(); $t1 = new Table9(); $t1->makeRoot(); diff --git a/test/testsuite/generator/behavior/nestedset/NestedSetBehaviorObjectBuilderModifierWithScopeTest.php b/test/testsuite/generator/behavior/nestedset/NestedSetBehaviorObjectBuilderModifierWithScopeTest.php index 6b78c99c5..5ad070691 100644 --- a/test/testsuite/generator/behavior/nestedset/NestedSetBehaviorObjectBuilderModifierWithScopeTest.php +++ b/test/testsuite/generator/behavior/nestedset/NestedSetBehaviorObjectBuilderModifierWithScopeTest.php @@ -33,6 +33,7 @@ protected function getByTitle($title) */ public function testSaveRootInTreeWithExistingRootWithSameScope() { + $this->expectException(PropelException::class); Table10Peer::doDeleteAll(); $t1 = new Table10(); $t1->setScopeValue(1); diff --git a/test/testsuite/generator/behavior/nestedset/NestedSetBehaviorWithNamespaceTest.php b/test/testsuite/generator/behavior/nestedset/NestedSetBehaviorWithNamespaceTest.php index 7040c5404..8d1f42139 100644 --- a/test/testsuite/generator/behavior/nestedset/NestedSetBehaviorWithNamespaceTest.php +++ b/test/testsuite/generator/behavior/nestedset/NestedSetBehaviorWithNamespaceTest.php @@ -15,7 +15,7 @@ class NestedSetBehaviorWithNamespaceTest extends BookstoreTestBase { - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/test/testsuite/generator/behavior/sluggable/SluggableBehaviorTest.php b/test/testsuite/generator/behavior/sluggable/SluggableBehaviorTest.php index f1b07987c..5b56d08c9 100644 --- a/test/testsuite/generator/behavior/sluggable/SluggableBehaviorTest.php +++ b/test/testsuite/generator/behavior/sluggable/SluggableBehaviorTest.php @@ -87,6 +87,7 @@ public static function cleanupSlugProvider() */ public function testObjectCleanupSlugPart($in, $out) { + setlocale(LC_CTYPE, 'en_US.utf8'); $t = new TestableTable13(); $this->assertEquals($out, $t->cleanupSlugPart($in), 'cleanupSlugPart() cleans up the slug part'); } diff --git a/test/testsuite/generator/behavior/sortable/SortableBehaviorObjectBuilderModifierTest.php b/test/testsuite/generator/behavior/sortable/SortableBehaviorObjectBuilderModifierTest.php index c43383654..5f9d2383a 100644 --- a/test/testsuite/generator/behavior/sortable/SortableBehaviorObjectBuilderModifierTest.php +++ b/test/testsuite/generator/behavior/sortable/SortableBehaviorObjectBuilderModifierTest.php @@ -20,7 +20,7 @@ */ class SortableBehaviorObjectBuilderModifierTest extends BookstoreSortableTestBase { - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->populateTable11(); @@ -116,6 +116,7 @@ public function testInsertAtMaxRankPlusOne() */ public function testInsertAtNegativeRank() { + $this->expectException(PropelException::class); $t = new Table11(); $t->insertAtRank(0); } @@ -125,6 +126,7 @@ public function testInsertAtNegativeRank() */ public function testInsertAtOverMaxRank() { + $this->expectException(PropelException::class); $t = new Table11(); $t->insertAtRank(6); } @@ -175,6 +177,7 @@ public function testMoveToRank() */ public function testMoveToNewObject() { + $this->expectException(PropelException::class); $t = new Table11(); $t->moveToRank(2); } @@ -184,6 +187,7 @@ public function testMoveToNewObject() */ public function testMoveToNegativeRank() { + $this->expectException(PropelException::class); $t = Table11Peer::retrieveByRank(2); $t->moveToRank(0); } @@ -193,6 +197,7 @@ public function testMoveToNegativeRank() */ public function testMoveToOverMaxRank() { + $this->expectException(PropelException::class); $t = Table11Peer::retrieveByRank(2); $t->moveToRank(5); } diff --git a/test/testsuite/generator/behavior/sortable/SortableBehaviorObjectBuilderModifierWithScopeTest.php b/test/testsuite/generator/behavior/sortable/SortableBehaviorObjectBuilderModifierWithScopeTest.php index 2fcaef7ee..a89d92518 100644 --- a/test/testsuite/generator/behavior/sortable/SortableBehaviorObjectBuilderModifierWithScopeTest.php +++ b/test/testsuite/generator/behavior/sortable/SortableBehaviorObjectBuilderModifierWithScopeTest.php @@ -21,7 +21,7 @@ */ class SortableBehaviorObjectBuilderModifierWithScopeTest extends BookstoreSortableTestBase { - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->populateTable12(); @@ -166,6 +166,7 @@ public function testInsertAtRankNoScope() */ public function testInsertAtNegativeRank() { + $this->expectException(PropelException::class); $t = new Table12(); $t->setScopeValue(1); $t->insertAtRank(0); @@ -176,6 +177,7 @@ public function testInsertAtNegativeRank() */ public function testInsertAtOverMaxRank() { + $this->expectException(PropelException::class); $t = new Table12(); $t->setScopeValue(1); $t->insertAtRank(6); @@ -288,6 +290,7 @@ public function testMoveToRankNoScope() */ public function testMoveToNewObject() { + $this->expectException(PropelException::class); $t = new Table12(); $t->moveToRank(2); } @@ -297,6 +300,7 @@ public function testMoveToNewObject() */ public function testMoveToNegativeRank() { + $this->expectException(PropelException::class); $t = Table12Peer::retrieveByRank(2, 1); $t->moveToRank(0); } @@ -306,6 +310,7 @@ public function testMoveToNegativeRank() */ public function testMoveToOverMaxRank() { + $this->expectException(PropelException::class); $t = Table12Peer::retrieveByRank(2, 1); $t->moveToRank(5); } @@ -419,6 +424,7 @@ public function testRemoveFromList() */ public function testRemoveFromListNoScope() { + $this->expectException(PropelException::class); $t2 = Table12Peer::retrieveByRank(2); $t2->removeFromList(); } diff --git a/test/testsuite/generator/behavior/sortable/SortableBehaviorPeerBuilderModifierTest.php b/test/testsuite/generator/behavior/sortable/SortableBehaviorPeerBuilderModifierTest.php index c1674ed8a..fc7d1d4d0 100644 --- a/test/testsuite/generator/behavior/sortable/SortableBehaviorPeerBuilderModifierTest.php +++ b/test/testsuite/generator/behavior/sortable/SortableBehaviorPeerBuilderModifierTest.php @@ -20,7 +20,7 @@ */ class SortableBehaviorPeerBuilderModifierTest extends BookstoreSortableTestBase { - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->populateTable11(); diff --git a/test/testsuite/generator/behavior/sortable/SortableBehaviorPeerBuilderModifierWithScopeTest.php b/test/testsuite/generator/behavior/sortable/SortableBehaviorPeerBuilderModifierWithScopeTest.php index 69a66a2fc..132a4d8a4 100644 --- a/test/testsuite/generator/behavior/sortable/SortableBehaviorPeerBuilderModifierWithScopeTest.php +++ b/test/testsuite/generator/behavior/sortable/SortableBehaviorPeerBuilderModifierWithScopeTest.php @@ -21,7 +21,7 @@ */ class SortableBehaviorPeerBuilderModifierWithScopeTest extends BookstoreSortableTestBase { - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->populateTable12(); diff --git a/test/testsuite/generator/behavior/sortable/SortableBehaviorQueryBuilderModifierTest.php b/test/testsuite/generator/behavior/sortable/SortableBehaviorQueryBuilderModifierTest.php index 37ac007f8..54de45a43 100644 --- a/test/testsuite/generator/behavior/sortable/SortableBehaviorQueryBuilderModifierTest.php +++ b/test/testsuite/generator/behavior/sortable/SortableBehaviorQueryBuilderModifierTest.php @@ -20,7 +20,7 @@ */ class SortableBehaviorQueryBuilderModifierTest extends BookstoreSortableTestBase { - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->populateTable11(); @@ -56,6 +56,7 @@ public function testOrderByRank() */ public function testOrderByRankIncorrectDirection() { + $this->expectException(PropelException::class); Table11Query::create()->orderByRank('foo'); } diff --git a/test/testsuite/generator/behavior/sortable/SortableBehaviorQueryBuilderModifierWithScopeTest.php b/test/testsuite/generator/behavior/sortable/SortableBehaviorQueryBuilderModifierWithScopeTest.php index 98a6a16d8..e189ff843 100644 --- a/test/testsuite/generator/behavior/sortable/SortableBehaviorQueryBuilderModifierWithScopeTest.php +++ b/test/testsuite/generator/behavior/sortable/SortableBehaviorQueryBuilderModifierWithScopeTest.php @@ -20,7 +20,7 @@ */ class SortableBehaviorQueryBuilderModifierWithScopeTest extends BookstoreSortableTestBase { - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->populateTable12(); diff --git a/test/testsuite/generator/behavior/sortable/SortableBehaviorTest.php b/test/testsuite/generator/behavior/sortable/SortableBehaviorTest.php index 771b80425..a8977c210 100644 --- a/test/testsuite/generator/behavior/sortable/SortableBehaviorTest.php +++ b/test/testsuite/generator/behavior/sortable/SortableBehaviorTest.php @@ -22,7 +22,7 @@ */ class SortableBehaviorTest extends BookstoreTestBase { - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/test/testsuite/generator/behavior/versionable/VersionableBehaviorObjectBuilderModifierTest.php b/test/testsuite/generator/behavior/versionable/VersionableBehaviorObjectBuilderModifierTest.php index 6cfb3d43f..234dd139a 100644 --- a/test/testsuite/generator/behavior/versionable/VersionableBehaviorObjectBuilderModifierTest.php +++ b/test/testsuite/generator/behavior/versionable/VersionableBehaviorObjectBuilderModifierTest.php @@ -20,9 +20,9 @@ * @version $Revision$ * @package generator.behavior.versionable */ -class VersionableBehaviorObjectBuilderModifierTest extends PHPUnit_Framework_TestCase +class VersionableBehaviorObjectBuilderModifierTest extends \PHPUnit\Framework\TestCase { - public function setUp() + public function setUp(): void { if (!class_exists('VersionableBehaviorTest1')) { $schema = <<expectException(PropelException::class); $o = new VersionableBehaviorTest1(); $o->setBar(123); // version 1 $o->save(); diff --git a/test/testsuite/generator/behavior/versionable/VersionableBehaviorPeerBuilderModifierTest.php b/test/testsuite/generator/behavior/versionable/VersionableBehaviorPeerBuilderModifierTest.php index bbcada332..65cac4e13 100644 --- a/test/testsuite/generator/behavior/versionable/VersionableBehaviorPeerBuilderModifierTest.php +++ b/test/testsuite/generator/behavior/versionable/VersionableBehaviorPeerBuilderModifierTest.php @@ -20,10 +20,10 @@ * @version $Revision$ * @package generator.behavior.versionable */ -class VersionableBehaviorPeerBuilderModifierTest extends PHPUnit_Framework_TestCase +class VersionableBehaviorPeerBuilderModifierTest extends \PHPUnit\Framework\TestCase { - public function setUp() + public function setUp(): void { if (!class_exists('VersionableBehaviorTest10')) { $schema = <<assertContains($expected, $builder->getSQL()); + $this->assertStringContainsString($expected, $builder->getSQL()); } public function testModifyTableAddsVersionColumnCustomName() @@ -90,7 +90,7 @@ public function testModifyTableAddsVersionColumnCustomName() [foo_ver] INTEGER DEFAULT 0 ); EOF; - $this->assertContains($expected, $builder->getSQL()); + $this->assertStringContainsString($expected, $builder->getSQL()); } public function testModifyTableDoesNotAddVersionColumnIfExists() @@ -121,7 +121,7 @@ public function testModifyTableDoesNotAddVersionColumnIfExists() [version] BIGINT ); EOF; - $this->assertContains($expected, $builder->getSQL()); + $this->assertStringContainsString($expected, $builder->getSQL()); } public function foreignTableSchemaDataProvider() @@ -170,7 +170,7 @@ public function testModifyTableAddsVersionColumnForForeignKeysIfForeignTableIsVe [version] INTEGER DEFAULT 0 ); EOF; - $this->assertContains($expected, $builder->getSQL()); + $this->assertStringContainsString($expected, $builder->getSQL()); $expected = <<assertContains($expected, $builder->getSQL()); + $this->assertStringContainsString($expected, $builder->getSQL()); } /** @@ -216,7 +216,7 @@ public function testModifyTableAddsVersionColumnForReferrersIfForeignTableIsVers [version] INTEGER DEFAULT 0 ); EOF; - $this->assertContains($expected, $builder->getSQL()); + $this->assertStringContainsString($expected, $builder->getSQL()); $expected = <<assertContains($expected, $builder->getSQL()); + $this->assertStringContainsString($expected, $builder->getSQL()); } /** @@ -266,7 +266,7 @@ public function testModifyTableAddsVersionTable($schema) -- SQLite does not support foreign keys; this is just for reference -- FOREIGN KEY ([id]) REFERENCES versionable_behavior_test_0 ([id]) EOF; - $this->assertContains($expected, $builder->getSQL()); + $this->assertStringContainsString($expected, $builder->getSQL()); } public function testModifyTableAddsVersionTableCustomName() @@ -302,7 +302,7 @@ public function testModifyTableAddsVersionTableCustomName() -- SQLite does not support foreign keys; this is just for reference -- FOREIGN KEY ([id]) REFERENCES versionable_behavior_test_0 ([id]) EOF; - $this->assertContains($expected, $builder->getSQL()); + $this->assertStringContainsString($expected, $builder->getSQL()); } public function testModifyTableDoesNotAddVersionTableIfExists() @@ -396,7 +396,7 @@ public function testModifyTableAddsLogColumns($schema) [version_comment] VARCHAR(255) ); EOF; - $this->assertContains($expected, $builder->getSQL()); + $this->assertStringContainsString($expected, $builder->getSQL()); } /** @@ -427,7 +427,7 @@ public function testModifyTableAddsVersionTableLogColumns($schema) -- SQLite does not support foreign keys; this is just for reference -- FOREIGN KEY ([id]) REFERENCES versionable_behavior_test_0 ([id]) EOF; - $this->assertContains($expected, $builder->getSQL()); + $this->assertStringContainsString($expected, $builder->getSQL()); } public function testDatabaseLevelBehavior() @@ -461,7 +461,7 @@ public function testDatabaseLevelBehavior() -- SQLite does not support foreign keys; this is just for reference -- FOREIGN KEY ([id]) REFERENCES versionable_behavior_test_0 ([id]) EOF; - $this->assertContains($expected, $builder->getSQL()); + $this->assertStringContainsString($expected, $builder->getSQL()); } } diff --git a/test/testsuite/generator/builder/NamespaceTest.php b/test/testsuite/generator/builder/NamespaceTest.php index c95b4b4af..c28cd3e1e 100644 --- a/test/testsuite/generator/builder/NamespaceTest.php +++ b/test/testsuite/generator/builder/NamespaceTest.php @@ -18,9 +18,9 @@ * @version $Revision$ * @package generator.builder */ -class NamespaceTest extends PHPUnit_Framework_TestCase +class NamespaceTest extends \PHPUnit\Framework\TestCase { - protected function setUp() + protected function setUp(): void { if (version_compare(PHP_VERSION, '5.3.0') < 0) { $this->markTestSkipped('Namespace support requires PHP 5.3'); @@ -29,7 +29,7 @@ protected function setUp() Propel::init(dirname(__FILE__) . '/../../../fixtures/namespaced/build/conf/bookstore_namespaced-conf.php'); } - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); Propel::init(dirname(__FILE__) . '/../../../fixtures/bookstore/build/conf/bookstore-conf.php'); diff --git a/test/testsuite/generator/builder/om/GeneratedNestedSetObjectTest.php b/test/testsuite/generator/builder/om/GeneratedNestedSetObjectTest.php index 1b318a859..79180b34a 100644 --- a/test/testsuite/generator/builder/om/GeneratedNestedSetObjectTest.php +++ b/test/testsuite/generator/builder/om/GeneratedNestedSetObjectTest.php @@ -137,6 +137,7 @@ public function testObjectMakeRoot() */ public function testObjectMakeRootException() { + $this->expectException(PropelException::class); $c = new Criteria(); $c->add(PagePeer::TITLE, 'home', Criteria::EQUAL); diff --git a/test/testsuite/generator/builder/om/GeneratedNestedSetPeerTest.php b/test/testsuite/generator/builder/om/GeneratedNestedSetPeerTest.php index 5598cb647..666f23e09 100644 --- a/test/testsuite/generator/builder/om/GeneratedNestedSetPeerTest.php +++ b/test/testsuite/generator/builder/om/GeneratedNestedSetPeerTest.php @@ -178,6 +178,7 @@ public function testPeerCreateRoot() */ public function testPeerCreateRootException() { + $this->expectException(PropelException::class); $c = new Criteria(); $c->add(PagePeer::TITLE, 'home', Criteria::EQUAL); diff --git a/test/testsuite/generator/builder/om/GeneratedObjectArrayColumnTypeTest.php b/test/testsuite/generator/builder/om/GeneratedObjectArrayColumnTypeTest.php index 3a0555af5..62b466931 100644 --- a/test/testsuite/generator/builder/om/GeneratedObjectArrayColumnTypeTest.php +++ b/test/testsuite/generator/builder/om/GeneratedObjectArrayColumnTypeTest.php @@ -17,9 +17,9 @@ * @author Francois Zaninotto * @package generator.builder.om */ -class GeneratedObjectArrayColumnTypeTest extends PHPUnit_Framework_TestCase +class GeneratedObjectArrayColumnTypeTest extends \PHPUnit\Framework\TestCase { - public function setUp() + public function setUp(): void { if (!class_exists('ComplexColumnTypeEntity2')) { $schema = << * @package generator.builder.om */ -class GeneratedObjectConstantNameTest extends PHPUnit_Framework_TestCase +class GeneratedObjectConstantNameTest extends \PHPUnit\Framework\TestCase { /** * Test normal string as single inheritance key diff --git a/test/testsuite/generator/builder/om/GeneratedObjectDateTimeColumnTypeTest.php b/test/testsuite/generator/builder/om/GeneratedObjectDateTimeColumnTypeTest.php index 156d52a4f..b4d6a97cd 100644 --- a/test/testsuite/generator/builder/om/GeneratedObjectDateTimeColumnTypeTest.php +++ b/test/testsuite/generator/builder/om/GeneratedObjectDateTimeColumnTypeTest.php @@ -18,9 +18,9 @@ * @author Francois Zaninotto * @package generator.builder.om */ -class GeneratedObjectDateTimeColumnTypeTest extends PHPUnit_Framework_TestCase +class GeneratedObjectDateTimeColumnTypeTest extends \PHPUnit\Framework\TestCase { - public function setUp() + public function setUp(): void { if (!class_exists('DateTimeColumnTypeEntity')) { $schema = <<expectException(PropelException::class); $e = new PublicComplexColumnTypeEntity3(); $e->bar = 156; $e->getBar(); @@ -92,6 +93,7 @@ public function testSetter() */ public function testSetterThrowsExceptionOnUnknownValue() { + $this->expectException(PropelException::class); $e = new ComplexColumnTypeEntity3(); $e->setBar('bazz'); } diff --git a/test/testsuite/generator/builder/om/GeneratedObjectLazyLoadTest.php b/test/testsuite/generator/builder/om/GeneratedObjectLazyLoadTest.php index d589add8b..a3d59a92c 100644 --- a/test/testsuite/generator/builder/om/GeneratedObjectLazyLoadTest.php +++ b/test/testsuite/generator/builder/om/GeneratedObjectLazyLoadTest.php @@ -16,9 +16,9 @@ * * @package generator.builder.om */ -class GeneratedObjectLazyLoadTest extends PHPUnit_Framework_TestCase +class GeneratedObjectLazyLoadTest extends \PHPUnit\Framework\TestCase { - public function setUp() + public function setUp(): void { if (!class_exists('LazyLoadActiveRecord')) { $schema = <<getCoverImage(); $txt = $m1->getExcerpt(); - $this->assertInternalType('resource', $img, "Expected results of BLOB method to be a resource."); - $this->assertInternalType('string', $txt, "Expected results of CLOB method to be a string."); + $this->assertIsResource($img, "Expected results of BLOB method to be a resource."); + $this->assertIsString($txt, "Expected results of CLOB method to be a string."); $stat = fstat($img); $size = $stat['size']; @@ -134,7 +134,7 @@ public function testLobRepeatRead() // 1) Assert that we've got a valid stream to start with - $this->assertInternalType('resource', $img, "Expected results of BLOB method to be a resource."); + $this->assertIsResource($img, "Expected results of BLOB method to be a resource."); // read first 100 bytes $firstBytes = fread($img, 100); @@ -197,18 +197,18 @@ public function testLobSetting() // 1) Assert that we've got a valid stream to start with $img = $m1->getCoverImage(); - $this->assertInternalType('resource', $img, "Expected results of BLOB method to be a resource."); + $this->assertIsResource($img, "Expected results of BLOB method to be a resource."); // 2) Test setting a BLOB column with file contents $m1->setCoverImage(file_get_contents($blob2_path)); - $this->assertInternalType('resource', $m1->getCoverImage(), "Expected to get a resource back after setting BLOB with file contents."); + $this->assertIsResource($m1->getCoverImage(), "Expected to get a resource back after setting BLOB with file contents."); // commit those changes & reload $m1->save(); // 3) Verify that we've got a valid resource after reload $m1->reload(); - $this->assertInternalType('resource', $m1->getCoverImage(), "Expected to get a resource back after setting reloading object."); + $this->assertIsResource($m1->getCoverImage(), "Expected to get a resource back after setting reloading object."); // 4) Test isModified() behavior $fp = fopen("php://temp", "r+"); diff --git a/test/testsuite/generator/builder/om/GeneratedObjectMoreRelationTest.php b/test/testsuite/generator/builder/om/GeneratedObjectMoreRelationTest.php index a6c0935a0..4961ab4ce 100644 --- a/test/testsuite/generator/builder/om/GeneratedObjectMoreRelationTest.php +++ b/test/testsuite/generator/builder/om/GeneratedObjectMoreRelationTest.php @@ -16,13 +16,13 @@ * @version $Revision$ * @package generator.builder.om */ -class GeneratedObjectMoreRelationTest extends PHPUnit_Framework_TestCase +class GeneratedObjectMoreRelationTest extends \PHPUnit\Framework\TestCase { /** * Setup schema und some default data */ - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/test/testsuite/generator/builder/om/GeneratedObjectObjectColumnTypeTest.php b/test/testsuite/generator/builder/om/GeneratedObjectObjectColumnTypeTest.php index e69490520..ac1200519 100644 --- a/test/testsuite/generator/builder/om/GeneratedObjectObjectColumnTypeTest.php +++ b/test/testsuite/generator/builder/om/GeneratedObjectObjectColumnTypeTest.php @@ -17,9 +17,9 @@ * @author Francois Zaninotto * @package generator.builder.om */ -class GeneratedObjectObjectColumnTypeTest extends PHPUnit_Framework_TestCase +class GeneratedObjectObjectColumnTypeTest extends \PHPUnit\Framework\TestCase { - public function setUp() + public function setUp(): void { if (!class_exists('ComplexColumnTypeEntity1')) { $schema = << * @package generator.builder.om */ -class GeneratedObjectPhpNameTest extends PHPUnit_Framework_TestCase +class GeneratedObjectPhpNameTest extends \PHPUnit\Framework\TestCase { - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/test/testsuite/generator/builder/om/GeneratedObjectRelTest.php b/test/testsuite/generator/builder/om/GeneratedObjectRelTest.php index 2bd9f39f5..4a3ba54c4 100644 --- a/test/testsuite/generator/builder/om/GeneratedObjectRelTest.php +++ b/test/testsuite/generator/builder/om/GeneratedObjectRelTest.php @@ -29,7 +29,7 @@ class GeneratedObjectRelTest extends BookstoreEmptyTestBase { - protected function setUp() + protected function setUp(): void { parent::setUp(); } @@ -845,7 +845,8 @@ public function testRemoveObjectOneToMany() $books = $author->getBooks(); $this->assertCount(1, $books); - $this->assertEquals('Propel2 Book', reset($books)->getTitle()); + + $this->assertEquals('Propel2 Book', $books->getCurrent()->getTitle()); $author->save(); $book->save(); @@ -891,7 +892,7 @@ public function testRemoveObjectOneToManyWithFkRequired() $bookSummaries = $book->getBookSummarys(); $this->assertCount(1, $bookSummaries); - $this->assertEquals('summary2 Propel Book', reset($bookSummaries)->getSummary()); + $this->assertEquals('summary2 Propel Book', $bookSummaries->getCurrent()->getSummary()); $book->save(); $bookSummary2->save(); @@ -934,7 +935,7 @@ public function testRefIsOnlySavedWhenRequired() BookPeer::clearInstancePool(); - $summary = $this->getMock('BookSummary'); + $summary = $this->createMock('BookSummary'); $summary ->expects($this->once()) ->method('isDeleted') diff --git a/test/testsuite/generator/builder/om/GeneratedObjectTemporalColumnTypeTest.php b/test/testsuite/generator/builder/om/GeneratedObjectTemporalColumnTypeTest.php index e1336a4e0..e295f471d 100644 --- a/test/testsuite/generator/builder/om/GeneratedObjectTemporalColumnTypeTest.php +++ b/test/testsuite/generator/builder/om/GeneratedObjectTemporalColumnTypeTest.php @@ -18,9 +18,9 @@ * @author Francois Zaninotto * @package generator.builder.om */ -class GeneratedObjectTemporalColumnTypeTest extends PHPUnit_Framework_TestCase +class GeneratedObjectTemporalColumnTypeTest extends \PHPUnit\Framework\TestCase { - public function setUp() + public function setUp(): void { if (!class_exists('ComplexColumnTypeEntity5')) { $schema = <<expectException(PropelException::class); $r = new ComplexColumnTypeEntity5(); $r->setBar1("Invalid Date"); } diff --git a/test/testsuite/generator/builder/om/GeneratedObjectTest.php b/test/testsuite/generator/builder/om/GeneratedObjectTest.php index 1883f8c7a..3f930cd67 100644 --- a/test/testsuite/generator/builder/om/GeneratedObjectTest.php +++ b/test/testsuite/generator/builder/om/GeneratedObjectTest.php @@ -29,7 +29,7 @@ */ class GeneratedObjectTest extends BookstoreTestBase { - protected function setUp() + protected function setUp(): void { parent::setUp(); require_once dirname(__FILE__) . '/../../../../tools/helpers/bookstore/behavior/TestAuthor.php'; @@ -779,7 +779,7 @@ public function testReplace_RelationWithCompositePK() $this->assertEquals(1, BookOpinionQuery::create()->count(), 'Only 1 BookOpinion; the new one got inserted and the previously associated one got deleted'); $this->assertEquals(1, count($b->getBookOpinions()), 'Book has 1 BookOpinion'); - $this->assertEquals(1, count($op2->getBook()), 'BookOpinion2 has a relation to the Book'); + $this->assertEquals(1, count([$op2->getBook()]), 'BookOpinion2 has a relation to the Book'); $this->assertEquals(1, count($br1->getBookOpinions()), 'BookReader1 has 1 BookOpinion (BookOpinion1)'); $this->assertEquals(1, count($br2->getBookOpinions()), 'BookReader2 has 1 BookOpinion (BookOpinion2)'); @@ -1255,6 +1255,7 @@ public function testMagicVirtualColumnGetter() */ public function testMagicCallUndefined() { + $this->expectException(PropelException::class); $book = new Book(); $book->fooMethodName(); } @@ -1695,6 +1696,7 @@ public function testHooksCall() */ public function testDoInsert() { + $this->expectException(PropelException::class); if (!class_exists('Unexistent')) { $schema = << diff --git a/test/testsuite/generator/builder/om/GeneratedObjectWithFixturesTest.php b/test/testsuite/generator/builder/om/GeneratedObjectWithFixturesTest.php index 3f30c21dd..4959f7417 100644 --- a/test/testsuite/generator/builder/om/GeneratedObjectWithFixturesTest.php +++ b/test/testsuite/generator/builder/om/GeneratedObjectWithFixturesTest.php @@ -24,7 +24,7 @@ */ class GeneratedObjectWithFixturesTest extends BookstoreEmptyTestBase { - protected function setUp() + protected function setUp(): void { parent::setUp(); require_once dirname(__FILE__) . '/../../../../tools/helpers/bookstore/behavior/TestAuthor.php'; @@ -151,11 +151,11 @@ public function testTypeSensitive() // reload and verify that the types are the same $r2 = ReviewPeer::retrieveByPK($id); - $this->assertInternalType('integer', $r2->getId(), "Expected getId() to return an integer."); - $this->assertInternalType('string', $r2->getReviewedBy(), "Expected getReviewedBy() to return a string."); - $this->assertInternalType('boolean', $r2->getRecommended(), "Expected getRecommended() to return a boolean."); + $this->assertIsInt($r2->getId(), "Expected getId() to return an integer."); + $this->assertIsString($r2->getReviewedBy(), "Expected getReviewedBy() to return a string."); + $this->assertIsBool($r2->getRecommended(), "Expected getRecommended() to return a boolean."); $this->assertInstanceOf('Book', $r2->getBook(), "Expected getBook() to return a Book."); - $this->assertInternalType('float', $r2->getBook()->getPrice(), "Expected Book->getPrice() to return a float."); + $this->assertIsFloat($r2->getBook()->getPrice(), "Expected Book->getPrice() to return a float."); $this->assertInstanceOf('DateTime', $r2->getReviewDate(null), "Expected Book->getReviewDate() to return a DateTime."); } @@ -288,7 +288,7 @@ public function testToArrayLazyLoad() $arr1 = $m->toArray(BasePeer::TYPE_COLNAME); $this->assertNotNull($arr1[MediaPeer::COVER_IMAGE]); - $this->assertInternalType('resource', $arr1[MediaPeer::COVER_IMAGE]); + $this->assertIsResource($arr1[MediaPeer::COVER_IMAGE]); $arr2 = $m->toArray(BasePeer::TYPE_COLNAME, false); $this->assertNull($arr2[MediaPeer::COVER_IMAGE]); diff --git a/test/testsuite/generator/builder/om/GeneratedObjectWithInterfaceTest.php b/test/testsuite/generator/builder/om/GeneratedObjectWithInterfaceTest.php index f593faa78..aba2f0319 100644 --- a/test/testsuite/generator/builder/om/GeneratedObjectWithInterfaceTest.php +++ b/test/testsuite/generator/builder/om/GeneratedObjectWithInterfaceTest.php @@ -10,9 +10,9 @@ require_once dirname(__FILE__) . '/../../../../../generator/lib/util/PropelQuickBuilder.php'; -class GeneratedObjectWithInterfaceTest extends PHPUnit_Framework_TestCase +class GeneratedObjectWithInterfaceTest extends \PHPUnit\Framework\TestCase { - public function setUp() + public function setUp(): void { if (!class_exists('Foo\MyClassWithInterface')) { $schema = <<assertInternalType('integer', BookPeer::doCount($c), "Expected doCount() to return an integer."); - $this->assertInternalType('integer', BookPeer::doCountJoinAll($c), "Expected doCountJoinAll() to return an integer."); - $this->assertInternalType('integer', BookPeer::doCountJoinAuthor($c), "Expected doCountJoinAuthor() to return an integer."); + $this->assertIsInt(BookPeer::doCount($c), "Expected doCount() to return an integer."); + $this->assertIsInt(BookPeer::doCountJoinAll($c), "Expected doCountJoinAll() to return an integer."); + $this->assertIsInt(BookPeer::doCountJoinAuthor($c), "Expected doCountJoinAuthor() to return an integer."); } /** diff --git a/test/testsuite/generator/builder/om/GeneratedPeerDoSelectTest.php b/test/testsuite/generator/builder/om/GeneratedPeerDoSelectTest.php index 85acaf0d1..bf7e3a5bb 100644 --- a/test/testsuite/generator/builder/om/GeneratedPeerDoSelectTest.php +++ b/test/testsuite/generator/builder/om/GeneratedPeerDoSelectTest.php @@ -27,7 +27,7 @@ */ class GeneratedPeerDoSelectTest extends BookstoreEmptyTestBase { - protected function setUp() + protected function setUp(): void { parent::setUp(); BookstoreDataPopulator::populate(); diff --git a/test/testsuite/generator/builder/om/GeneratedPeerEnumColumnTypeTest.php b/test/testsuite/generator/builder/om/GeneratedPeerEnumColumnTypeTest.php index 9b2d18c23..179ca38a4 100644 --- a/test/testsuite/generator/builder/om/GeneratedPeerEnumColumnTypeTest.php +++ b/test/testsuite/generator/builder/om/GeneratedPeerEnumColumnTypeTest.php @@ -17,9 +17,9 @@ * @author Francois Zaninotto * @package generator.builder.om */ -class GeneratedPeerEnumColumnTypeTest extends PHPUnit_Framework_TestCase +class GeneratedPeerEnumColumnTypeTest extends \PHPUnit\Framework\TestCase { - public function setUp() + public function setUp(): void { if (!class_exists('ComplexColumnTypeEntity103Peer')) { $schema = <<expectException(PropelException::class); ComplexColumnTypeEntity103Peer::getValueSet(ComplexColumnTypeEntity103Peer::ID); } diff --git a/test/testsuite/generator/builder/om/GeneratedPeerLazyLoadTest.php b/test/testsuite/generator/builder/om/GeneratedPeerLazyLoadTest.php index 0bab38840..f49fd73f2 100644 --- a/test/testsuite/generator/builder/om/GeneratedPeerLazyLoadTest.php +++ b/test/testsuite/generator/builder/om/GeneratedPeerLazyLoadTest.php @@ -16,9 +16,9 @@ * * @package generator.builder.om */ -class GeneratedPeerLazyLoadTest extends PHPUnit_Framework_TestCase +class GeneratedPeerLazyLoadTest extends \PHPUnit\Framework\TestCase { - public function setUp() + public function setUp(): void { if (!class_exists('LazyLoadActiveRecord2')) { $schema = <<c1 = new FooColumnValue2(); $this->c1->bar = 1234; diff --git a/test/testsuite/generator/builder/om/OMBuilderNamespaceTest.php b/test/testsuite/generator/builder/om/OMBuilderNamespaceTest.php index 61fe611b6..637c256b9 100644 --- a/test/testsuite/generator/builder/om/OMBuilderNamespaceTest.php +++ b/test/testsuite/generator/builder/om/OMBuilderNamespaceTest.php @@ -20,7 +20,7 @@ * @version $Id: OMBuilderBuilderTest.php 1347 2009-12-03 21:06:36Z francois $ * @package generator.builder.om */ -class OMBuilderNamespaceTest extends PHPUnit_Framework_TestCase +class OMBuilderNamespaceTest extends \PHPUnit\Framework\TestCase { public function testNoNamespace() { diff --git a/test/testsuite/generator/builder/om/OMBuilderRelatedByTest.php b/test/testsuite/generator/builder/om/OMBuilderRelatedByTest.php index 9bd541dbe..c5772f388 100644 --- a/test/testsuite/generator/builder/om/OMBuilderRelatedByTest.php +++ b/test/testsuite/generator/builder/om/OMBuilderRelatedByTest.php @@ -20,11 +20,11 @@ * @version $Id: OMBuilderBuilderTest.php 1347 2009-12-03 21:06:36Z francois $ * @package generator.builder.om */ -class OMBuilderRelatedByTest extends PHPUnit_Framework_TestCase +class OMBuilderRelatedByTest extends \PHPUnit\Framework\TestCase { public static $database; - public function setUp() + public function setUp(): void { // run only once to save execution time if (null == self::$database) { diff --git a/test/testsuite/generator/builder/om/OMBuilderTest.php b/test/testsuite/generator/builder/om/OMBuilderTest.php index a88eee98e..6d4dcee77 100644 --- a/test/testsuite/generator/builder/om/OMBuilderTest.php +++ b/test/testsuite/generator/builder/om/OMBuilderTest.php @@ -18,7 +18,7 @@ * @version $Id: OMBuilderBuilderTest.php 1347 2009-12-03 21:06:36Z francois $ * @package generator.builder.om */ -class OMBuilderTest extends PHPUnit_Framework_TestCase +class OMBuilderTest extends \PHPUnit\Framework\TestCase { public function testClear() diff --git a/test/testsuite/generator/builder/om/PHP5ObjectBuilderTest.php b/test/testsuite/generator/builder/om/PHP5ObjectBuilderTest.php index e88174059..83f008331 100644 --- a/test/testsuite/generator/builder/om/PHP5ObjectBuilderTest.php +++ b/test/testsuite/generator/builder/om/PHP5ObjectBuilderTest.php @@ -21,11 +21,11 @@ * @version $Id$ * @package generator.builder.om */ -class PHP5ObjectBuilderTest extends PHPUnit_Framework_TestCase +class PHP5ObjectBuilderTest extends \PHPUnit\Framework\TestCase { protected $builder; - public function setUp() + public function setUp(): void { $builder = new TestablePHP5ObjectBuilder(new Table('Foo')); $builder->setPlatform(new MysqlPlatform()); diff --git a/test/testsuite/generator/builder/om/PHP5TableMapBuilderTest.php b/test/testsuite/generator/builder/om/PHP5TableMapBuilderTest.php index 59893d797..e8912c9f9 100644 --- a/test/testsuite/generator/builder/om/PHP5TableMapBuilderTest.php +++ b/test/testsuite/generator/builder/om/PHP5TableMapBuilderTest.php @@ -21,7 +21,7 @@ class PHP5TableMapBuilderTest extends BookstoreTestBase { protected $databaseMap; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->databaseMap = Propel::getDatabaseMap('bookstore'); diff --git a/test/testsuite/generator/builder/util/DefaultEnglishPluralizerTest.php b/test/testsuite/generator/builder/util/DefaultEnglishPluralizerTest.php index 5d94085d9..420faa38f 100644 --- a/test/testsuite/generator/builder/util/DefaultEnglishPluralizerTest.php +++ b/test/testsuite/generator/builder/util/DefaultEnglishPluralizerTest.php @@ -16,7 +16,7 @@ * @version $Revision$ * @package generator.builder.util */ -class DefaultEnglishPluralizerTest extends PHPUnit_Framework_TestCase +class DefaultEnglishPluralizerTest extends \PHPUnit\Framework\TestCase { public function getPluralFormDataProvider() { diff --git a/test/testsuite/generator/builder/util/PropelTemplateTest.php b/test/testsuite/generator/builder/util/PropelTemplateTest.php index 89b5560a4..346c0c53a 100644 --- a/test/testsuite/generator/builder/util/PropelTemplateTest.php +++ b/test/testsuite/generator/builder/util/PropelTemplateTest.php @@ -16,7 +16,7 @@ * @version $Revision$ * @package generator.builder.util */ -class PropelTemplateTest extends PHPUnit_Framework_TestCase +class PropelTemplateTest extends \PHPUnit\Framework\TestCase { public function testRenderStringNoParam() { diff --git a/test/testsuite/generator/builder/util/StandardEnglishPluralizerTest.php b/test/testsuite/generator/builder/util/StandardEnglishPluralizerTest.php index dc5c52dea..e8306598b 100644 --- a/test/testsuite/generator/builder/util/StandardEnglishPluralizerTest.php +++ b/test/testsuite/generator/builder/util/StandardEnglishPluralizerTest.php @@ -16,7 +16,7 @@ * @version $Revision$ * @package generator.builder.util */ -class StandardEnglishPluralizerTest extends PHPUnit_Framework_TestCase +class StandardEnglishPluralizerTest extends \PHPUnit\Framework\TestCase { public function getPluralFormDataProvider() { diff --git a/test/testsuite/generator/builder/util/XmlToAppDataTest.php b/test/testsuite/generator/builder/util/XmlToAppDataTest.php index 94af5a9cc..6c72661cb 100644 --- a/test/testsuite/generator/builder/util/XmlToAppDataTest.php +++ b/test/testsuite/generator/builder/util/XmlToAppDataTest.php @@ -16,7 +16,7 @@ * @version $Revision$ * @package generator.builder.util */ -class XmlToAppDataTest extends PHPUnit_Framework_TestCase +class XmlToAppDataTest extends \PHPUnit\Framework\TestCase { public function testParseStringEmptySchema() @@ -44,6 +44,7 @@ public function testParseStringSchemaWithoutXmlDeclaration() */ public function testParseStringIncorrectSchema() { + $this->expectException(SchemaException::class); $schema = ''; $xtad = new XmlToAppData(); $appData = $xtad->parseString($schema); diff --git a/test/testsuite/generator/config/GeneratorConfigTest.php b/test/testsuite/generator/config/GeneratorConfigTest.php index b13ff6381..952b32a86 100644 --- a/test/testsuite/generator/config/GeneratorConfigTest.php +++ b/test/testsuite/generator/config/GeneratorConfigTest.php @@ -14,11 +14,11 @@ * @author William Durand * @package propel.generator.config */ -class GeneratorConfigTest extends PHPUnit_Framework_TestCase +class GeneratorConfigTest extends \PHPUnit\Framework\TestCase { protected $pathToFixtureFiles; - public function setUp() + public function setUp(): void { $this->pathToFixtureFiles = dirname(__FILE__) . '/../../../fixtures/generator/config'; } @@ -62,6 +62,7 @@ public function testGetClassnameWithClassAndNamespace() */ public function testGetClassnameOnInexistantProperty() { + $this->expectException(BuildException::class); $generator = new GeneratorConfig(); $generator->getClassname('propel.foo.bar'); } diff --git a/test/testsuite/generator/model/BehaviorTest.php b/test/testsuite/generator/model/BehaviorTest.php index 8d527dbaa..b4b7b3433 100644 --- a/test/testsuite/generator/model/BehaviorTest.php +++ b/test/testsuite/generator/model/BehaviorTest.php @@ -20,7 +20,7 @@ * @version $Revision$ * @package generator.model */ -class BehaviorTest extends PHPUnit_Framework_TestCase +class BehaviorTest extends \PHPUnit\Framework\TestCase { private $xmlToAppData; private $appData; @@ -100,6 +100,7 @@ public function testXmlToAppData() */ public function testUnknownBehavior() { + $this->expectException(InvalidArgumentException::class); $xmlToAppData = new XmlToAppData(); $schema = << diff --git a/test/testsuite/generator/model/ColumnDefaultValueTest.php b/test/testsuite/generator/model/ColumnDefaultValueTest.php index 8e1d01142..45c88df7d 100644 --- a/test/testsuite/generator/model/ColumnDefaultValueTest.php +++ b/test/testsuite/generator/model/ColumnDefaultValueTest.php @@ -16,7 +16,7 @@ * @version $Revision$ * @package generator.model */ -class ColumnDefaultValueTest extends PHPUnit_Framework_TestCase +class ColumnDefaultValueTest extends \PHPUnit\Framework\TestCase { public function equalsProvider() { diff --git a/test/testsuite/generator/model/ColumnTest.php b/test/testsuite/generator/model/ColumnTest.php index 0e6c23cfc..ac9b2364a 100644 --- a/test/testsuite/generator/model/ColumnTest.php +++ b/test/testsuite/generator/model/ColumnTest.php @@ -20,7 +20,7 @@ * @version $Revision$ * @package generator.model */ -class ColumnTest extends PHPUnit_Framework_TestCase +class ColumnTest extends \PHPUnit\Framework\TestCase { /** diff --git a/test/testsuite/generator/model/DatabaseTest.php b/test/testsuite/generator/model/DatabaseTest.php index a5fa903f2..18d4477e3 100644 --- a/test/testsuite/generator/model/DatabaseTest.php +++ b/test/testsuite/generator/model/DatabaseTest.php @@ -18,7 +18,7 @@ * @version $Revision$ * @package generator.model */ -class DatabaseTest extends PHPUnit_Framework_TestCase +class DatabaseTest extends \PHPUnit\Framework\TestCase { public function providerForTestHasTable() { diff --git a/test/testsuite/generator/model/NameFactoryTest.php b/test/testsuite/generator/model/NameFactoryTest.php index b8b052356..06c858d1a 100644 --- a/test/testsuite/generator/model/NameFactoryTest.php +++ b/test/testsuite/generator/model/NameFactoryTest.php @@ -8,7 +8,6 @@ * @license MIT License */ -require_once dirname(__FILE__) . '/../../../tools/helpers/BaseTestCase.php'; require_once dirname(__FILE__) . '/../../../../generator/lib/model/NameFactory.php'; require_once dirname(__FILE__) . '/../../../../generator/lib/platform/MysqlPlatform.php'; require_once dirname(__FILE__) . '/../../../../generator/lib/model/AppData.php'; @@ -29,7 +28,7 @@ * @version $Id$ * @package generator.model */ -class NameFactoryTest extends BaseTestCase +class NameFactoryTest extends \PHPUnit\Framework\TestCase { /** The database to mimic in generating the SQL. */ const DATABASE_TYPE = "mysql"; @@ -57,39 +56,6 @@ class NameFactoryTest extends BaseTestCase */ private $database; - /** - * Creates a new instance. - * - */ - public function __construct() - { - self::$INPUTS = array( - array( array(self::makeString(61), "I", 1), - array(self::makeString(61), "I", 2), - array(self::makeString(65), "I", 3), - array(self::makeString(4), "FK", 1), - array(self::makeString(5), "FK", 2) - ), - array( - array("MY_USER", NameGenerator::CONV_METHOD_UNDERSCORE), - array("MY_USER", NameGenerator::CONV_METHOD_PHPNAME), - array("MY_USER", NameGenerator::CONV_METHOD_NOCHANGE) - ) - ); - - - self::$OUTPUTS = array( - array( - self::makeString(60) . "_I_1", - self::makeString(60) . "_I_2", - self::makeString(60) . "_I_3", - self::makeString(4) . "_FK_1", - self::makeString(5) . "_FK_2"), - array("MyUser", "MYUSER", "MY_USER") - ); - - } - /** * Creates a string of the specified length consisting entirely of * the character A. Useful for simulating table @@ -108,17 +74,38 @@ private static function makeString($len) return $buf; } - /** Sets up the Propel model. */ - public function setUp() + protected function setUp(): void { + self::$INPUTS = array( + array( array(self::makeString(61), "I", 1), + array(self::makeString(61), "I", 2), + array(self::makeString(65), "I", 3), + array(self::makeString(4), "FK", 1), + array(self::makeString(5), "FK", 2) + ), + array( + array("MY_USER", NameGenerator::CONV_METHOD_UNDERSCORE), + array("MY_USER", NameGenerator::CONV_METHOD_PHPNAME), + array("MY_USER", NameGenerator::CONV_METHOD_NOCHANGE) + ) + ); + + + self::$OUTPUTS = array( + array( + self::makeString(60) . "_I_1", + self::makeString(60) . "_I_2", + self::makeString(60) . "_I_3", + self::makeString(4) . "_FK_1", + self::makeString(5) . "_FK_2"), + array("MyUser", "MYUSER", "MY_USER") + ); + $appData = new AppData(new MysqlPlatform()); $this->database = new Database(); $appData->addDatabase($this->database); } - /** - * @throws Exception on fail - */ public function testNames() { for ($algoIndex = 0; $algoIndex < count(self::$ALGORITHMS); $algoIndex++) { @@ -141,7 +128,7 @@ public function testNames() * create an argument list for. * @param inputs The (possibly partial) list inputs from which to * generate the final list. - * @return the list of arguments to pass to the NameGenerator + * @return array the list of arguments to pass to the NameGenerator */ private function makeInputs($algo, $inputs) { diff --git a/test/testsuite/generator/model/PhpNameGeneratorTest.php b/test/testsuite/generator/model/PhpNameGeneratorTest.php index 264000dc0..e723b0ec7 100644 --- a/test/testsuite/generator/model/PhpNameGeneratorTest.php +++ b/test/testsuite/generator/model/PhpNameGeneratorTest.php @@ -17,7 +17,7 @@ * @version $Revision$ * @package generator.model */ -class PhpNameGeneratorTest extends PHPUnit_Framework_TestCase +class PhpNameGeneratorTest extends \PHPUnit\Framework\TestCase { public static function phpnameMethodDataProvider() { diff --git a/test/testsuite/generator/model/TableTest.php b/test/testsuite/generator/model/TableTest.php index ab90b21ad..83ab93df5 100644 --- a/test/testsuite/generator/model/TableTest.php +++ b/test/testsuite/generator/model/TableTest.php @@ -21,7 +21,7 @@ * @author Martin Poeschl (mpoeschl@marmot.at) * @package generator.model */ -class TableTest extends PHPUnit_Framework_TestCase +class TableTest extends \PHPUnit\Framework\TestCase { /** @@ -167,6 +167,7 @@ public function testAddExtraIndicesForeignKeys() */ public function testUniqueColumnName() { + $this->expectException(EngineException::class); $xmlToAppData = new XmlToAppData(); $schema = << @@ -186,6 +187,7 @@ public function testUniqueColumnName() */ public function testUniqueTableName() { + $this->expectException(EngineException::class); $xmlToAppData = new XmlToAppData(); $schema = << diff --git a/test/testsuite/generator/model/XMLElementTest.php b/test/testsuite/generator/model/XMLElementTest.php index 2e953b4bf..7941388ee 100644 --- a/test/testsuite/generator/model/XMLElementTest.php +++ b/test/testsuite/generator/model/XMLElementTest.php @@ -13,7 +13,7 @@ /** * @author William Durand */ -class XMLElementTest extends PHPUnit_Framework_TestCase +class XMLElementTest extends \PHPUnit\Framework\TestCase { /** * @dataProvider providerForGetDefaultValueForArray diff --git a/test/testsuite/generator/model/diff/PropelColumnComparatorTest.php b/test/testsuite/generator/model/diff/PropelColumnComparatorTest.php index f8b69dc1a..7add41b65 100644 --- a/test/testsuite/generator/model/diff/PropelColumnComparatorTest.php +++ b/test/testsuite/generator/model/diff/PropelColumnComparatorTest.php @@ -17,9 +17,9 @@ * * @package generator.model.diff */ -class PropelColumnComparatorTest extends PHPUnit_Framework_TestCase +class PropelColumnComparatorTest extends \PHPUnit\Framework\TestCase { - public function setUp() + public function setUp(): void { $this->platform = new MysqlPlatform(); } diff --git a/test/testsuite/generator/model/diff/PropelDatabaseTableComparatorTest.php b/test/testsuite/generator/model/diff/PropelDatabaseTableComparatorTest.php index 85b9d09a4..6899d3511 100644 --- a/test/testsuite/generator/model/diff/PropelDatabaseTableComparatorTest.php +++ b/test/testsuite/generator/model/diff/PropelDatabaseTableComparatorTest.php @@ -18,9 +18,9 @@ * * @package generator.model.diff */ -class PropelDatabaseTableComparatorTest extends PHPUnit_Framework_TestCase +class PropelDatabaseTableComparatorTest extends \PHPUnit\Framework\TestCase { - public function setUp() + public function setUp(): void { $this->platform = new MysqlPlatform(); } diff --git a/test/testsuite/generator/model/diff/PropelForeignKeyComparatorTest.php b/test/testsuite/generator/model/diff/PropelForeignKeyComparatorTest.php index 3a6a6dbb4..8b235d5b4 100644 --- a/test/testsuite/generator/model/diff/PropelForeignKeyComparatorTest.php +++ b/test/testsuite/generator/model/diff/PropelForeignKeyComparatorTest.php @@ -16,7 +16,7 @@ * * @package generator.model.diff */ -class PropelForeignComparatorTest extends PHPUnit_Framework_TestCase +class PropelForeignComparatorTest extends \PHPUnit\Framework\TestCase { public function testCompareNoDifference() { diff --git a/test/testsuite/generator/model/diff/PropelIndexComparatorTest.php b/test/testsuite/generator/model/diff/PropelIndexComparatorTest.php index 23b860796..15e31cc2e 100644 --- a/test/testsuite/generator/model/diff/PropelIndexComparatorTest.php +++ b/test/testsuite/generator/model/diff/PropelIndexComparatorTest.php @@ -16,7 +16,7 @@ * * @package generator.model.diff */ -class PropelIndexComparatorTest extends PHPUnit_Framework_TestCase +class PropelIndexComparatorTest extends \PHPUnit\Framework\TestCase { public function testCompareNoDifference() { diff --git a/test/testsuite/generator/model/diff/PropelTableColumnComparatorTest.php b/test/testsuite/generator/model/diff/PropelTableColumnComparatorTest.php index 5fa0dfe32..9669c95a7 100644 --- a/test/testsuite/generator/model/diff/PropelTableColumnComparatorTest.php +++ b/test/testsuite/generator/model/diff/PropelTableColumnComparatorTest.php @@ -18,9 +18,9 @@ * * @package generator.model.diff */ -class PropelTableColumnComparatorTest extends PHPUnit_Framework_TestCase +class PropelTableColumnComparatorTest extends \PHPUnit\Framework\TestCase { - public function setUp() + public function setUp(): void { $this->platform = new MysqlPlatform(); } diff --git a/test/testsuite/generator/model/diff/PropelTableForeignKeyComparatorTest.php b/test/testsuite/generator/model/diff/PropelTableForeignKeyComparatorTest.php index 1b668e7ef..d6a1c9438 100644 --- a/test/testsuite/generator/model/diff/PropelTableForeignKeyComparatorTest.php +++ b/test/testsuite/generator/model/diff/PropelTableForeignKeyComparatorTest.php @@ -19,9 +19,9 @@ * * @package generator.model.diff */ -class PropelTableForeignKeyComparatorTest extends PHPUnit_Framework_TestCase +class PropelTableForeignKeyComparatorTest extends \PHPUnit\Framework\TestCase { - public function setUp() + public function setUp(): void { $this->platform = new MysqlPlatform(); } diff --git a/test/testsuite/generator/model/diff/PropelTableIndexComparatorTest.php b/test/testsuite/generator/model/diff/PropelTableIndexComparatorTest.php index 3dc37befb..2cc9a4fca 100644 --- a/test/testsuite/generator/model/diff/PropelTableIndexComparatorTest.php +++ b/test/testsuite/generator/model/diff/PropelTableIndexComparatorTest.php @@ -18,9 +18,9 @@ * * @package generator.model.diff */ -class PropelTableIndexComparatorTest extends PHPUnit_Framework_TestCase +class PropelTableIndexComparatorTest extends \PHPUnit\Framework\TestCase { - public function setUp() + public function setUp(): void { $this->platform = new MysqlPlatform(); } diff --git a/test/testsuite/generator/model/diff/PropelTablePkColumnComparatorTest.php b/test/testsuite/generator/model/diff/PropelTablePkColumnComparatorTest.php index 94846aa29..a595fcd28 100644 --- a/test/testsuite/generator/model/diff/PropelTablePkColumnComparatorTest.php +++ b/test/testsuite/generator/model/diff/PropelTablePkColumnComparatorTest.php @@ -19,9 +19,9 @@ * * @package generator.model.diff */ -class PropelTablePkColumnComparatorTest extends PHPUnit_Framework_TestCase +class PropelTablePkColumnComparatorTest extends \PHPUnit\Framework\TestCase { - public function setUp() + public function setUp(): void { $this->platform = new MysqlPlatform(); } diff --git a/test/testsuite/generator/platform/CustomPlatformTest.php b/test/testsuite/generator/platform/CustomPlatformTest.php index df026e8af..0ec6fa218 100644 --- a/test/testsuite/generator/platform/CustomPlatformTest.php +++ b/test/testsuite/generator/platform/CustomPlatformTest.php @@ -1,13 +1,13 @@ platform; } - protected function tearDown() + protected function tearDown(): void { $this->platform = null; } diff --git a/test/testsuite/generator/platform/PlatformTestBase.php b/test/testsuite/generator/platform/PlatformTestBase.php index e8af0f8b2..d91abac7a 100644 --- a/test/testsuite/generator/platform/PlatformTestBase.php +++ b/test/testsuite/generator/platform/PlatformTestBase.php @@ -14,7 +14,7 @@ * Base class for all Platform tests * @package generator.platform */ -abstract class PlatformTestBase extends PHPUnit_Framework_TestCase +abstract class PlatformTestBase extends \PHPUnit\Framework\TestCase { abstract protected function getPlatform(); diff --git a/test/testsuite/generator/reverse/mssql/MssqlSchemaParserTest.php b/test/testsuite/generator/reverse/mssql/MssqlSchemaParserTest.php index 8cca85ac4..048893d7f 100644 --- a/test/testsuite/generator/reverse/mssql/MssqlSchemaParserTest.php +++ b/test/testsuite/generator/reverse/mssql/MssqlSchemaParserTest.php @@ -18,7 +18,7 @@ * @version $Revision$ * @package propel.generator.reverse.mssql */ -class MssqlSchemaParserTest extends PHPUnit_Framework_TestCase +class MssqlSchemaParserTest extends \PHPUnit\Framework\TestCase { public function testCleanDelimitedIdentifiers() { diff --git a/test/testsuite/generator/reverse/mysql/MysqlSchemaParserTest.php b/test/testsuite/generator/reverse/mysql/MysqlSchemaParserTest.php index b9c85640e..9a6380a17 100644 --- a/test/testsuite/generator/reverse/mysql/MysqlSchemaParserTest.php +++ b/test/testsuite/generator/reverse/mysql/MysqlSchemaParserTest.php @@ -26,9 +26,9 @@ * @version $Revision$ * @package propel.generator.reverse.mysql */ -class MysqlSchemaParserTest extends PHPUnit_Framework_TestCase +class MysqlSchemaParserTest extends \PHPUnit\Framework\TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -41,7 +41,7 @@ protected function setUp() Propel::initialize(); } - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); Propel::init(dirname(__FILE__) . '/../../../../fixtures/bookstore/build/conf/bookstore-conf.php'); diff --git a/test/testsuite/generator/reverse/pgsql/PgsqlSchemaParserTest.php b/test/testsuite/generator/reverse/pgsql/PgsqlSchemaParserTest.php index 78615009e..32a0f66ab 100644 --- a/test/testsuite/generator/reverse/pgsql/PgsqlSchemaParserTest.php +++ b/test/testsuite/generator/reverse/pgsql/PgsqlSchemaParserTest.php @@ -26,9 +26,9 @@ * @version $Revision$ * @package propel.generator.reverse.pgsql */ -class PgsqlSchemaParserTest extends PHPUnit_Framework_TestCase +class PgsqlSchemaParserTest extends \PHPUnit\Framework\TestCase { - protected function setUp() + protected function setUp(): void { $this->markTestSkipped('PGSQL unit test'); @@ -46,7 +46,7 @@ protected function setUp() $this->con->beginTransaction(); } - protected function tearDown() + protected function tearDown(): void { if ($this->con) { $this->con->rollback(); diff --git a/test/testsuite/generator/util/PropelDotGeneratorTest.php b/test/testsuite/generator/util/PropelDotGeneratorTest.php index fdeb43c65..d7c3a4bea 100644 --- a/test/testsuite/generator/util/PropelDotGeneratorTest.php +++ b/test/testsuite/generator/util/PropelDotGeneratorTest.php @@ -15,7 +15,7 @@ * * @package generator.util */ -class PropelDotGeneratorTest extends PHPUnit_Framework_TestCase +class PropelDotGeneratorTest extends \PHPUnit\Framework\TestCase { public function testEmptyDatabase() { diff --git a/test/testsuite/generator/util/PropelPHPParserTest.php b/test/testsuite/generator/util/PropelPHPParserTest.php index de8d6fb84..1463752ea 100644 --- a/test/testsuite/generator/util/PropelPHPParserTest.php +++ b/test/testsuite/generator/util/PropelPHPParserTest.php @@ -14,7 +14,7 @@ * * @package generator.util */ -class PropelPHPParserTest extends PHPUnit_Framework_TestCase +class PropelPHPParserTest extends \PHPUnit\Framework\TestCase { public function basicClassCodeProvider() { diff --git a/test/testsuite/generator/util/PropelQuickBuilderTest.php b/test/testsuite/generator/util/PropelQuickBuilderTest.php index f31f8e5a4..a1ef8f4e5 100644 --- a/test/testsuite/generator/util/PropelQuickBuilderTest.php +++ b/test/testsuite/generator/util/PropelQuickBuilderTest.php @@ -15,7 +15,7 @@ * * @package generator.util */ -class PropelQuickBuilderTest extends PHPUnit_Framework_TestCase +class PropelQuickBuilderTest extends \PHPUnit\Framework\TestCase { public function testGetPlatform() { @@ -83,12 +83,12 @@ public function testGetSQL($builder) public function testGetClasses($builder) { $script = $builder->getClasses(); - $this->assertContains('class QuickBuildFoo1 extends BaseQuickBuildFoo1', $script); - $this->assertContains('class QuickBuildFoo1Peer extends BaseQuickBuildFoo1Peer', $script); - $this->assertContains('class QuickBuildFoo1Query extends BaseQuickBuildFoo1Query', $script); - $this->assertContains('class BaseQuickBuildFoo1 extends BaseObject', $script); - $this->assertContains('class BaseQuickBuildFoo1Peer', $script); - $this->assertContains('class BaseQuickBuildFoo1Query extends ModelCriteria', $script); + $this->assertStringContainsString('class QuickBuildFoo1 extends BaseQuickBuildFoo1', $script); + $this->assertStringContainsString('class QuickBuildFoo1Peer extends BaseQuickBuildFoo1Peer', $script); + $this->assertStringContainsString('class QuickBuildFoo1Query extends BaseQuickBuildFoo1Query', $script); + $this->assertStringContainsString('class BaseQuickBuildFoo1 extends BaseObject', $script); + $this->assertStringContainsString('class BaseQuickBuildFoo1Peer', $script); + $this->assertStringContainsString('class BaseQuickBuildFoo1Query extends ModelCriteria', $script); } /** @@ -108,12 +108,12 @@ public function testBuildClasses($builder) public function testGetClassesLimitedClassTargets($builder) { $script = $builder->getClasses(array('tablemap', 'peer', 'object', 'query')); - $this->assertNotContains('class QuickBuildFoo1 extends BaseQuickBuildFoo1', $script); - $this->assertNotContains('class QuickBuildFoo1Peer extends BaseQuickBuildFoo1Peer', $script); - $this->assertNotContains('class QuickBuildFoo1Query extends BaseQuickBuildFoo1Query', $script); - $this->assertContains('class BaseQuickBuildFoo1 extends BaseObject', $script); - $this->assertContains('class BaseQuickBuildFoo1Peer', $script); - $this->assertContains('class BaseQuickBuildFoo1Query extends ModelCriteria', $script); + $this->assertStringNotContainsString('class QuickBuildFoo1 extends BaseQuickBuildFoo1', $script); + $this->assertStringNotContainsString('class QuickBuildFoo1Peer extends BaseQuickBuildFoo1Peer', $script); + $this->assertStringNotContainsString('class QuickBuildFoo1Query extends BaseQuickBuildFoo1Query', $script); + $this->assertStringContainsString('class BaseQuickBuildFoo1 extends BaseObject', $script); + $this->assertStringContainsString('class BaseQuickBuildFoo1Peer', $script); + $this->assertStringContainsString('class BaseQuickBuildFoo1Query extends ModelCriteria', $script); } public function testBuild() diff --git a/test/testsuite/generator/util/PropelSQLParserTest.php b/test/testsuite/generator/util/PropelSQLParserTest.php index 8df935959..195057b5d 100644 --- a/test/testsuite/generator/util/PropelSQLParserTest.php +++ b/test/testsuite/generator/util/PropelSQLParserTest.php @@ -14,7 +14,7 @@ * * @package generator.util */ -class PropelSQLParserTest extends PHPUnit_Framework_TestCase +class PropelSQLParserTest extends \PHPUnit\Framework\TestCase { public function stripSqlCommentsDataProvider() { diff --git a/test/testsuite/generator/util/PropelSchemaValidatorTest.php b/test/testsuite/generator/util/PropelSchemaValidatorTest.php index bbf4789f4..308be92d4 100644 --- a/test/testsuite/generator/util/PropelSchemaValidatorTest.php +++ b/test/testsuite/generator/util/PropelSchemaValidatorTest.php @@ -16,7 +16,7 @@ * * @package generator.util */ -class SchemaValidatorTest extends PHPUnit_Framework_TestCase +class SchemaValidatorTest extends \PHPUnit\Framework\TestCase { private $xsdFile = 'generator/resources/xsd/database.xsd'; diff --git a/test/testsuite/misc/BookstoreTest.php b/test/testsuite/misc/BookstoreTest.php index f7df815f0..88cabd072 100644 --- a/test/testsuite/misc/BookstoreTest.php +++ b/test/testsuite/misc/BookstoreTest.php @@ -273,7 +273,7 @@ public function testScenario() $this->assertEquals(1, count($failures), '1 validation message was returned'); $el = array_shift($failures); - $this->assertContains("must be more than", $el->getMessage(), 'Expected validation message was returned'); + $this->assertStringContainsString("must be more than", $el->getMessage(), 'Expected validation message was returned'); $bk2 = new Book(); $bk2->setTitle("Don Juan"); @@ -285,7 +285,7 @@ public function testScenario() $this->assertEquals(1, count($failures), '1 validation message was returned'); $el = array_shift($failures); - $this->assertContains("Book title already in database.", $el->getMessage(), 'Expected validation message was returned'); + $this->assertStringContainsString("Book title already in database.", $el->getMessage(), 'Expected validation message was returned'); //Now trying some more complex validation. $auth1 = new Author(); @@ -695,7 +695,7 @@ public function testScenarioUsingQuery() $this->assertEquals(1, count($failures), '1 validation message was returned'); $el = array_shift($failures); - $this->assertContains("must be more than", $el->getMessage(), 'Expected validation message was returned'); + $this->assertStringContainsString("must be more than", $el->getMessage(), 'Expected validation message was returned'); $bk2 = new Book(); $bk2->setTitle("Don Juan"); @@ -707,7 +707,7 @@ public function testScenarioUsingQuery() $this->assertEquals(1, count($failures), '1 validation message was returned'); $el = array_shift($failures); - $this->assertContains("Book title already in database.", $el->getMessage(), 'Expected validation message was returned'); + $this->assertStringContainsString("Book title already in database.", $el->getMessage(), 'Expected validation message was returned'); //Now trying some more complex validation. $auth1 = new Author(); diff --git a/test/testsuite/misc/CharacterEncodingTest.php b/test/testsuite/misc/CharacterEncodingTest.php index 4c0a4c1a2..679387971 100644 --- a/test/testsuite/misc/CharacterEncodingTest.php +++ b/test/testsuite/misc/CharacterEncodingTest.php @@ -33,7 +33,7 @@ class CharacterEncodingTest extends BookstoreTestBase */ private $adapter; - public function setUp() + public function setUp(): void { parent::setUp(); if (!extension_loaded('iconv')) { diff --git a/test/testsuite/misc/FieldnameRelatedTest.php b/test/testsuite/misc/FieldnameRelatedTest.php index fd2d80f3d..0fc1a5aee 100644 --- a/test/testsuite/misc/FieldnameRelatedTest.php +++ b/test/testsuite/misc/FieldnameRelatedTest.php @@ -27,9 +27,9 @@ * @author Sven Fuchs * @package misc */ -class FieldnameRelatedTest extends PHPUnit_Framework_TestCase +class FieldnameRelatedTest extends \PHPUnit\Framework\TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/test/testsuite/misc/Issue617Test.php b/test/testsuite/misc/Issue617Test.php index 8df3faa45..68103d932 100644 --- a/test/testsuite/misc/Issue617Test.php +++ b/test/testsuite/misc/Issue617Test.php @@ -18,13 +18,13 @@ class Issue617Test extends PlatformDatabaseBuildTimeBase */ private $updatedBuilder; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->removeTables(); } - protected function tearDown() + protected function tearDown(): void { $this->removeTables(); parent::tearDown(); diff --git a/test/testsuite/misc/Issue651Test.php b/test/testsuite/misc/Issue651Test.php index 9e199f02a..7bc070364 100644 --- a/test/testsuite/misc/Issue651Test.php +++ b/test/testsuite/misc/Issue651Test.php @@ -1,6 +1,6 @@ assertTrue(Propel::isInstancePoolingEnabled()); diff --git a/test/testsuite/runtime/adapter/DBMySQLTest.php b/test/testsuite/runtime/adapter/DBMySQLTest.php index 72300a747..cbb7c359e 100644 --- a/test/testsuite/runtime/adapter/DBMySQLTest.php +++ b/test/testsuite/runtime/adapter/DBMySQLTest.php @@ -41,6 +41,7 @@ public static function getConParams() */ public function testPrepareParamsThrowsException($conparams) { + $this->expectException(PropelException::class); if (version_compare(PHP_VERSION, '5.3.6', '>=')) { $this->markTestSkipped('PHP_VERSION >= 5.3.6, no need to throw an exception.'); } diff --git a/test/testsuite/runtime/collection/PropelArrayCollectionTest.php b/test/testsuite/runtime/collection/PropelArrayCollectionTest.php index 90f5dc70b..489090508 100644 --- a/test/testsuite/runtime/collection/PropelArrayCollectionTest.php +++ b/test/testsuite/runtime/collection/PropelArrayCollectionTest.php @@ -19,7 +19,7 @@ */ class PropelArrayCollectionTest extends BookstoreEmptyTestBase { - protected function setUp() + protected function setUp(): void { parent::setUp(); BookstoreDataPopulator::populate($this->con); @@ -45,6 +45,7 @@ public function testSave() */ public function testSaveOnReadOnlyEntityThrowsException() { + $this->expectException(PropelException::class); $col = new PropelArrayCollection(); $col->setModel('ContestView'); $cv = new ContestView(); @@ -67,6 +68,7 @@ public function testDelete() */ public function testDeleteOnReadOnlyEntityThrowsException() { + $this->expectException(PropelException::class); $col = new PropelArrayCollection(); $col->setModel('ContestView'); $cv = new ContestView(); @@ -199,6 +201,7 @@ public function getWorkerObject() */ public function testGetWorkerObjectNoModel() { + $this->expectException(PropelException::class); $col = new TestablePropelArrayCollection(); $col->getWorkerObject(); } diff --git a/test/testsuite/runtime/collection/PropelCollectionConvertTest.php b/test/testsuite/runtime/collection/PropelCollectionConvertTest.php index 21f0cfd19..05e40e291 100644 --- a/test/testsuite/runtime/collection/PropelCollectionConvertTest.php +++ b/test/testsuite/runtime/collection/PropelCollectionConvertTest.php @@ -19,7 +19,7 @@ */ class PropelCollectionConvertTest extends BookstoreTestBase { - protected function setUp() + protected function setUp(): void { parent::setUp(); $book1 = new Book(); diff --git a/test/testsuite/runtime/collection/PropelCollectionTest.php b/test/testsuite/runtime/collection/PropelCollectionTest.php index 3e32ebdba..4083b3ba8 100644 --- a/test/testsuite/runtime/collection/PropelCollectionTest.php +++ b/test/testsuite/runtime/collection/PropelCollectionTest.php @@ -226,6 +226,7 @@ public function testGet() */ public function testGetUnknownOffset() { + $this->expectException(PropelException::class); $col = new PropelCollection(); $bar = $col->get('foo'); } @@ -286,6 +287,7 @@ public function testRemove() */ public function testRemoveUnknownOffset() { + $this->expectException(PropelException::class); $col = new PropelCollection(); $col->remove(2); } @@ -364,6 +366,7 @@ public function testGetPeerClass() */ public function testGetPeerClassNoModel() { + $this->expectException(PropelException::class); $col = new PropelCollection(); $col->getPeerClass(); } @@ -383,6 +386,7 @@ public function testGetConnection() */ public function testGetConnectionNoModel() { + $this->expectException(PropelException::class); $col = new PropelCollection(); $col->getConnection(); } diff --git a/test/testsuite/runtime/collection/PropelObjectCollectionTest.php b/test/testsuite/runtime/collection/PropelObjectCollectionTest.php index cdfc127c9..0f96b5ca4 100644 --- a/test/testsuite/runtime/collection/PropelObjectCollectionTest.php +++ b/test/testsuite/runtime/collection/PropelObjectCollectionTest.php @@ -40,6 +40,7 @@ public function testContains() */ public function testSaveOnReadOnlyEntityThrowsException() { + $this->expectException(PropelException::class); $col = new PropelObjectCollection(); $col->setModel('ContestView'); $cv = new ContestView(); @@ -52,6 +53,7 @@ public function testSaveOnReadOnlyEntityThrowsException() */ public function testDeleteOnReadOnlyEntityThrowsException() { + $this->expectException(PropelException::class); $col = new PropelObjectCollection(); $col->setModel('ContestView'); $cv = new ContestView(); diff --git a/test/testsuite/runtime/collection/PropelObjectCollectionWithFixturesTest.php b/test/testsuite/runtime/collection/PropelObjectCollectionWithFixturesTest.php index 2b15f8ecf..21147422b 100644 --- a/test/testsuite/runtime/collection/PropelObjectCollectionWithFixturesTest.php +++ b/test/testsuite/runtime/collection/PropelObjectCollectionWithFixturesTest.php @@ -19,7 +19,7 @@ */ class PropelObjectCollectionWithFixturesTest extends BookstoreEmptyTestBase { - protected function setUp() + protected function setUp(): void { parent::setUp(); BookstoreDataPopulator::populate($this->con); diff --git a/test/testsuite/runtime/collection/PropelOnDemandCollectionTest.php b/test/testsuite/runtime/collection/PropelOnDemandCollectionTest.php index 335a4b67e..bcdb5078c 100644 --- a/test/testsuite/runtime/collection/PropelOnDemandCollectionTest.php +++ b/test/testsuite/runtime/collection/PropelOnDemandCollectionTest.php @@ -19,7 +19,7 @@ */ class PropelOnDemandCollectionTest extends BookstoreEmptyTestBase { - protected function setUp() + protected function setUp(): void { parent::setUp(); BookstoreDataPopulator::populate($this->con); @@ -27,7 +27,7 @@ protected function setUp() $this->books = PropelQuery::from('Book')->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)->find(); } - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); Propel::enableInstancePooling(); @@ -44,6 +44,7 @@ public function testSetFormatter() */ public function testClone() { + $this->expectException(PropelException::class); $clone = clone $this->books; } @@ -61,6 +62,7 @@ public function testKeys() */ public function testoffsetExists() { + $this->expectException(PropelException::class); $this->books->offsetExists(2); } @@ -69,6 +71,7 @@ public function testoffsetExists() */ public function testoffsetGet() { + $this->expectException(PropelException::class); $this->books->offsetGet(2); } @@ -77,6 +80,7 @@ public function testoffsetGet() */ public function testoffsetSet() { + $this->expectException(PropelException::class); $this->books->offsetSet(2, 'foo'); } @@ -85,6 +89,7 @@ public function testoffsetSet() */ public function testoffsetUnset() { + $this->expectException(PropelException::class); $this->books->offsetUnset(2); } @@ -99,6 +104,7 @@ public function testToArray() */ public function testFromArray() { + $this->expectException(PropelException::class); $this->books->fromArray(array()); } diff --git a/test/testsuite/runtime/collection/PropelOnDemandIteratorTest.php b/test/testsuite/runtime/collection/PropelOnDemandIteratorTest.php index 0b2e6fd80..6b87875b1 100644 --- a/test/testsuite/runtime/collection/PropelOnDemandIteratorTest.php +++ b/test/testsuite/runtime/collection/PropelOnDemandIteratorTest.php @@ -19,7 +19,7 @@ */ class PropelOnDemandIteratorTest extends BookstoreEmptyTestBase { - protected function setUp() + protected function setUp(): void { parent::setUp(); BookstoreDataPopulator::populate($this->con); diff --git a/test/testsuite/runtime/config/PropelConfigurationTest.php b/test/testsuite/runtime/config/PropelConfigurationTest.php index 3f82841be..1a4ef4876 100644 --- a/test/testsuite/runtime/config/PropelConfigurationTest.php +++ b/test/testsuite/runtime/config/PropelConfigurationTest.php @@ -17,7 +17,7 @@ * @author Francois Zaninotto * @package runtime.config */ -class PropelConfigurationTest extends PHPUnit_Framework_TestCase +class PropelConfigurationTest extends \PHPUnit\Framework\TestCase { public static function configurationProvider() { diff --git a/test/testsuite/runtime/connection/PropelPDOTest.php b/test/testsuite/runtime/connection/PropelPDOTest.php index ad340560c..1d3e62745 100644 --- a/test/testsuite/runtime/connection/PropelPDOTest.php +++ b/test/testsuite/runtime/connection/PropelPDOTest.php @@ -15,7 +15,7 @@ * * @package runtime.connection */ -class PropelPDOTest extends PHPUnit_Framework_TestCase +class PropelPDOTest extends \PHPUnit\Framework\TestCase { public function testSetAttribute() diff --git a/test/testsuite/runtime/exception/PropelExceptionTest.php b/test/testsuite/runtime/exception/PropelExceptionTest.php index 8f31c57dd..8dbeb0841 100644 --- a/test/testsuite/runtime/exception/PropelExceptionTest.php +++ b/test/testsuite/runtime/exception/PropelExceptionTest.php @@ -16,7 +16,7 @@ * @author Francois Zaninotto * @package runtime.exception */ -class PropelExceptionTest extends PHPUnit_Framework_TestCase +class PropelExceptionTest extends \PHPUnit\Framework\TestCase { public function testSimpleConstructor() { @@ -44,6 +44,7 @@ public function testCompositeConstructor() */ public function testIsThrowable() { + $this->expectException(PropelException::class); $e = new PropelException('this is an error'); throw $e; } diff --git a/test/testsuite/runtime/formatter/PropelArrayFormatterTest.php b/test/testsuite/runtime/formatter/PropelArrayFormatterTest.php index 247b713a7..edc4c69b6 100644 --- a/test/testsuite/runtime/formatter/PropelArrayFormatterTest.php +++ b/test/testsuite/runtime/formatter/PropelArrayFormatterTest.php @@ -19,7 +19,7 @@ */ class PropelArrayFormatterTest extends BookstoreEmptyTestBase { - protected function setUp() + protected function setUp(): void { parent::setUp(); BookstoreDataPopulator::populate(); diff --git a/test/testsuite/runtime/formatter/PropelArrayFormatterWithTest.php b/test/testsuite/runtime/formatter/PropelArrayFormatterWithTest.php index 477b7c986..1ed6a1d52 100644 --- a/test/testsuite/runtime/formatter/PropelArrayFormatterWithTest.php +++ b/test/testsuite/runtime/formatter/PropelArrayFormatterWithTest.php @@ -242,6 +242,7 @@ public function testFindOneWithDistantClassRenamedRelation() */ public function testFindOneWithOneToManyAndLimit() { + $this->expectException(PropelException::class); $c = new ModelCriteria('bookstore', 'Book'); $c->setFormatter(ModelCriteria::FORMAT_ARRAY); $c->add(BookPeer::ISBN, '043935806X'); diff --git a/test/testsuite/runtime/formatter/PropelFormatterTest.php b/test/testsuite/runtime/formatter/PropelFormatterTest.php index 4dd013f94..b4b211ab4 100644 --- a/test/testsuite/runtime/formatter/PropelFormatterTest.php +++ b/test/testsuite/runtime/formatter/PropelFormatterTest.php @@ -19,7 +19,7 @@ */ class PropelFormatterTest extends BookstoreEmptyTestBase { - protected function setUp() + protected function setUp(): void { parent::setUp(); BookstoreDataPopulator::populate(); diff --git a/test/testsuite/runtime/formatter/PropelObjectFormatterInheritanceTest.php b/test/testsuite/runtime/formatter/PropelObjectFormatterInheritanceTest.php index 857c608d1..136c1ee6f 100644 --- a/test/testsuite/runtime/formatter/PropelObjectFormatterInheritanceTest.php +++ b/test/testsuite/runtime/formatter/PropelObjectFormatterInheritanceTest.php @@ -19,7 +19,7 @@ */ class PropelObjectFormatterInheritanceTest extends BookstoreEmptyTestBase { - protected function setUp() + protected function setUp(): void { parent::setUp(); $b1 = new BookstoreEmployee(); diff --git a/test/testsuite/runtime/formatter/PropelObjectFormatterTest.php b/test/testsuite/runtime/formatter/PropelObjectFormatterTest.php index e215744fb..8a661c90e 100644 --- a/test/testsuite/runtime/formatter/PropelObjectFormatterTest.php +++ b/test/testsuite/runtime/formatter/PropelObjectFormatterTest.php @@ -19,7 +19,7 @@ */ class PropelObjectFormatterTest extends BookstoreEmptyTestBase { - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/test/testsuite/runtime/formatter/PropelObjectFormatterWithTest.php b/test/testsuite/runtime/formatter/PropelObjectFormatterWithTest.php index aad247dcb..ba5fa5fbf 100644 --- a/test/testsuite/runtime/formatter/PropelObjectFormatterWithTest.php +++ b/test/testsuite/runtime/formatter/PropelObjectFormatterWithTest.php @@ -286,6 +286,7 @@ public function testFindOneWithDistantClassRenamedRelation() */ public function testFindOneWithOneToManyAndLimit() { + $this->expectException(PropelException::class); $c = new ModelCriteria('bookstore', 'Book'); $c->add(BookPeer::ISBN, '043935806X'); $c->leftJoin('Book.Review'); diff --git a/test/testsuite/runtime/formatter/PropelOnDemandFormatterTest.php b/test/testsuite/runtime/formatter/PropelOnDemandFormatterTest.php index e6c3c3465..3784c796d 100644 --- a/test/testsuite/runtime/formatter/PropelOnDemandFormatterTest.php +++ b/test/testsuite/runtime/formatter/PropelOnDemandFormatterTest.php @@ -56,6 +56,7 @@ public function testFormatManyResults() */ public function testFormatManyResultsIteratedTwice() { + $this->expectException(PropelException::class); $con = Propel::getConnection(BookPeer::DATABASE_NAME); BookstoreDataPopulator::populate($con); diff --git a/test/testsuite/runtime/formatter/PropelOnDemandFormatterWithTest.php b/test/testsuite/runtime/formatter/PropelOnDemandFormatterWithTest.php index e5af48ca2..e5c720960 100644 --- a/test/testsuite/runtime/formatter/PropelOnDemandFormatterWithTest.php +++ b/test/testsuite/runtime/formatter/PropelOnDemandFormatterWithTest.php @@ -237,6 +237,7 @@ public function testFindOneWithDistantClassRenamedRelation() */ public function testFindOneWithOneToMany() { + $this->expectException(PropelException::class); BookstoreDataPopulator::populate(); BookPeer::clearInstancePool(); AuthorPeer::clearInstancePool(); diff --git a/test/testsuite/runtime/formatter/PropelSimpleArrayFormatterTest.php b/test/testsuite/runtime/formatter/PropelSimpleArrayFormatterTest.php index d6b00863f..6cb8399e9 100644 --- a/test/testsuite/runtime/formatter/PropelSimpleArrayFormatterTest.php +++ b/test/testsuite/runtime/formatter/PropelSimpleArrayFormatterTest.php @@ -12,7 +12,7 @@ class PropelSimpleArrayFormatterTest extends BookstoreEmptyTestBase { - protected function setUp() + protected function setUp(): void { parent::setUp(); BookstoreDataPopulator::populate(); diff --git a/test/testsuite/runtime/formatter/PropelStatementFormatterTest.php b/test/testsuite/runtime/formatter/PropelStatementFormatterTest.php index 2b8f8aba1..474ccb181 100644 --- a/test/testsuite/runtime/formatter/PropelStatementFormatterTest.php +++ b/test/testsuite/runtime/formatter/PropelStatementFormatterTest.php @@ -19,7 +19,7 @@ */ class PropelStatementFormatterTest extends BookstoreEmptyTestBase { - protected function setUp() + protected function setUp(): void { parent::setUp(); BookstoreDataPopulator::populate(); diff --git a/test/testsuite/runtime/map/ColumnMapTest.php b/test/testsuite/runtime/map/ColumnMapTest.php index cbb8ece6b..7f9e50db6 100644 --- a/test/testsuite/runtime/map/ColumnMapTest.php +++ b/test/testsuite/runtime/map/ColumnMapTest.php @@ -21,7 +21,7 @@ class ColumnMapTest extends BookstoreTestBase { protected $databaseMap; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->dmap = new DatabaseMap('foodb'); @@ -30,7 +30,7 @@ protected function setUp() $this->cmap = new ColumnMap($this->columnName, $this->tmap); } - protected function tearDown() + protected function tearDown(): void { // nothing to do for now parent::tearDown(); diff --git a/test/testsuite/runtime/map/DatabaseMapTest.php b/test/testsuite/runtime/map/DatabaseMapTest.php index 01d27514d..ec9450e17 100644 --- a/test/testsuite/runtime/map/DatabaseMapTest.php +++ b/test/testsuite/runtime/map/DatabaseMapTest.php @@ -21,14 +21,14 @@ class DatabaseMapTest extends BookstoreTestBase { protected $databaseMap; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->databaseName = 'foodb'; $this->databaseMap = TestDatabaseBuilder::getDmap(); } - protected function tearDown() + protected function tearDown(): void { // nothing to do for now parent::tearDown(); diff --git a/test/testsuite/runtime/map/GeneratedRelationMapTest.php b/test/testsuite/runtime/map/GeneratedRelationMapTest.php index 977a18add..2a4a299e4 100644 --- a/test/testsuite/runtime/map/GeneratedRelationMapTest.php +++ b/test/testsuite/runtime/map/GeneratedRelationMapTest.php @@ -21,7 +21,7 @@ class GeneratedRelationMapTest extends BookstoreTestBase { protected $databaseMap; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->databaseMap = Propel::getDatabaseMap('bookstore'); diff --git a/test/testsuite/runtime/map/GeneratedRelationMapWithSchemasTest.php b/test/testsuite/runtime/map/GeneratedRelationMapWithSchemasTest.php index de90f2d32..ab731287d 100644 --- a/test/testsuite/runtime/map/GeneratedRelationMapWithSchemasTest.php +++ b/test/testsuite/runtime/map/GeneratedRelationMapWithSchemasTest.php @@ -21,7 +21,7 @@ class GeneratedRelationMapWithSchemasTest extends SchemasTestBase { protected $databaseMap; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->databaseMap = Propel::getDatabaseMap('bookstore-schemas'); diff --git a/test/testsuite/runtime/map/RelatedMapSymmetricalTest.php b/test/testsuite/runtime/map/RelatedMapSymmetricalTest.php index 586ed477d..389a0a3fd 100644 --- a/test/testsuite/runtime/map/RelatedMapSymmetricalTest.php +++ b/test/testsuite/runtime/map/RelatedMapSymmetricalTest.php @@ -21,7 +21,7 @@ class RelatedMapSymmetricalTest extends BookstoreTestBase { protected $databaseMap; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->databaseMap = Propel::getDatabaseMap('bookstore'); diff --git a/test/testsuite/runtime/map/RelatedMapSymmetricalWithSchemasTest.php b/test/testsuite/runtime/map/RelatedMapSymmetricalWithSchemasTest.php index c672374a7..b5fac12ca 100644 --- a/test/testsuite/runtime/map/RelatedMapSymmetricalWithSchemasTest.php +++ b/test/testsuite/runtime/map/RelatedMapSymmetricalWithSchemasTest.php @@ -21,7 +21,7 @@ class RelatedMapSymmetricalWithSchemasTest extends SchemasTestBase { protected $databaseMap; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->databaseMap = Propel::getDatabaseMap('bookstore-schemas'); diff --git a/test/testsuite/runtime/map/RelationMapTest.php b/test/testsuite/runtime/map/RelationMapTest.php index 31b08fb4f..674b1fbcf 100644 --- a/test/testsuite/runtime/map/RelationMapTest.php +++ b/test/testsuite/runtime/map/RelationMapTest.php @@ -20,11 +20,11 @@ * @version $Id$ * @package runtime.map */ -class RelationMapTest extends PHPUnit_Framework_TestCase +class RelationMapTest extends \PHPUnit\Framework\TestCase { protected $databaseMap, $relationName, $rmap; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->databaseMap = new DatabaseMap('foodb'); diff --git a/test/testsuite/runtime/map/TableMapTest.php b/test/testsuite/runtime/map/TableMapTest.php index 6a7f7b2ba..9c7fc461b 100644 --- a/test/testsuite/runtime/map/TableMapTest.php +++ b/test/testsuite/runtime/map/TableMapTest.php @@ -21,11 +21,11 @@ * @version $Id$ * @package runtime.map */ -class TableMapTest extends PHPUnit_Framework_TestCase +class TableMapTest extends \PHPUnit\Framework\TestCase { protected $databaseMap; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->databaseMap = new DatabaseMap('foodb'); @@ -33,7 +33,7 @@ protected function setUp() $this->tmap = new TableMap($this->tableName, $this->databaseMap); } - protected function tearDown() + protected function tearDown(): void { // nothing to do for now parent::tearDown(); @@ -169,7 +169,8 @@ public function testGetForeignKeys() */ public function testLoadWrongRelations() { - $this->tmap->getRelation('Bar'); + $this->expectException(PropelException::class); + $this->tmap->getRelation('Bar'); } public function testLazyLoadRelations() @@ -258,22 +259,6 @@ public function testContainsColumn() $this->assertTrue($this->tmap->containsColumn('BAR', false), 'containsColumn accepts a $normalize parameter to skip name normalization'); $this->assertTrue($this->tmap->containsColumn($column), 'containsColumn accepts a ColumnMap object as parameter'); } - - // deprecated methods - public function testPrefix() - { - $tmap = new TestableTableMap(); - $this->assertNull($tmap->getPrefix(), 'prefix is empty until set'); - $this->assertFalse($tmap->hasPrefix('barbaz'), 'hasPrefix returns false when prefix is not set'); - $tmap->setPrefix('bar'); - $this->assertEquals('bar', $tmap->getPrefix(), 'prefix is set by setPrefix()'); - $this->assertTrue($tmap->hasPrefix('barbaz'), 'hasPrefix returns true when prefix is set and found in string'); - $this->assertFalse($tmap->hasPrefix('baz'), 'hasPrefix returns false when prefix is set and not found in string'); - $this->assertFalse($tmap->hasPrefix('bazbar'), 'hasPrefix returns false when prefix is set and not found anywhere in string'); - $this->assertEquals('baz', $tmap->removePrefix('barbaz'), 'removePrefix returns string without prefix if found at the beginning'); - $this->assertEquals('bazbaz', $tmap->removePrefix('bazbaz'), 'removePrefix returns original string when prefix is not found'); - $this->assertEquals('bazbar', $tmap->removePrefix('bazbar'), 'removePrefix returns original string when prefix is not found at the beginning'); - } } class TestableTableMap extends TableMap diff --git a/test/testsuite/runtime/om/BaseObjectConvertTest.php b/test/testsuite/runtime/om/BaseObjectConvertTest.php index 151a0523e..06dec1bda 100644 --- a/test/testsuite/runtime/om/BaseObjectConvertTest.php +++ b/test/testsuite/runtime/om/BaseObjectConvertTest.php @@ -19,7 +19,7 @@ */ class BaseObjectConvertTest extends BookstoreTestBase { - protected function setUp() + protected function setUp(): void { parent::setUp(); $publisher = new Publisher(); diff --git a/test/testsuite/runtime/om/BaseObjectTest.php b/test/testsuite/runtime/om/BaseObjectTest.php index 98ccc83d1..30a1c2204 100644 --- a/test/testsuite/runtime/om/BaseObjectTest.php +++ b/test/testsuite/runtime/om/BaseObjectTest.php @@ -17,7 +17,7 @@ * @version $Id: BaseObjectTest.php 1347 2009-12-03 21:06:36Z francois $ * @package runtime.om */ -class BaseObjectTest extends PHPUnit_Framework_TestCase +class BaseObjectTest extends \PHPUnit\Framework\TestCase { public function testGetVirtualColumns() { @@ -40,6 +40,7 @@ public function testHasVirtualColumn() */ public function testGetVirtualColumnWrongKey() { + $this->expectException(PropelException::class); $b = new TestableBaseObject(); $b->getVirtualColumn('foo'); } diff --git a/test/testsuite/runtime/parser/PropelCSVParserTest.php b/test/testsuite/runtime/parser/PropelCSVParserTest.php index 0cf4d8d4c..fce10566f 100644 --- a/test/testsuite/runtime/parser/PropelCSVParserTest.php +++ b/test/testsuite/runtime/parser/PropelCSVParserTest.php @@ -17,7 +17,7 @@ * @author Francois Zaninotto * @package runtime.parser */ -class PropelCSVParserTest extends PHPUnit_Framework_TestCase +class PropelCSVParserTest extends \PHPUnit\Framework\TestCase { public static function arrayCsvConversionDataProvider() { diff --git a/test/testsuite/runtime/parser/PropelJSONParserTest.php b/test/testsuite/runtime/parser/PropelJSONParserTest.php index 383fddc9d..1a834f747 100644 --- a/test/testsuite/runtime/parser/PropelJSONParserTest.php +++ b/test/testsuite/runtime/parser/PropelJSONParserTest.php @@ -17,7 +17,7 @@ * @author Francois Zaninotto * @package runtime.parser */ -class PropelJSONParserTest extends PHPUnit_Framework_TestCase +class PropelJSONParserTest extends \PHPUnit\Framework\TestCase { public static function arrayJsonConversionDataProvider() { diff --git a/test/testsuite/runtime/parser/PropelParserTest.php b/test/testsuite/runtime/parser/PropelParserTest.php index dd0b1253e..c39c94fef 100644 --- a/test/testsuite/runtime/parser/PropelParserTest.php +++ b/test/testsuite/runtime/parser/PropelParserTest.php @@ -18,7 +18,7 @@ * @author Francois Zaninotto * @package runtime.parser */ -class PropelParserTest extends PHPUnit_Framework_TestCase +class PropelParserTest extends \PHPUnit\Framework\TestCase { public function testGetParser() { @@ -31,6 +31,7 @@ public function testGetParser() */ public function testGetParserThrowsExceptionOnWrongParser() { + $this->expectException(PropelException::class); $parser = PropelParser::getParser('Foo'); } diff --git a/test/testsuite/runtime/parser/PropelXMLParserTest.php b/test/testsuite/runtime/parser/PropelXMLParserTest.php index 6d2feee82..327d2f454 100644 --- a/test/testsuite/runtime/parser/PropelXMLParserTest.php +++ b/test/testsuite/runtime/parser/PropelXMLParserTest.php @@ -17,7 +17,7 @@ * @author Francois Zaninotto * @package runtime.parser */ -class PropelXMLParserTest extends PHPUnit_Framework_TestCase +class PropelXMLParserTest extends \PHPUnit\Framework\TestCase { public static function arrayXmlConversionDataProvider() { diff --git a/test/testsuite/runtime/parser/PropelYAMLParserTest.php b/test/testsuite/runtime/parser/PropelYAMLParserTest.php index 9d5b96eb2..4dd957643 100644 --- a/test/testsuite/runtime/parser/PropelYAMLParserTest.php +++ b/test/testsuite/runtime/parser/PropelYAMLParserTest.php @@ -17,7 +17,7 @@ * @author Francois Zaninotto * @package runtime.parser */ -class PropelYAMLParserTest extends PHPUnit_Framework_TestCase +class PropelYAMLParserTest extends \PHPUnit\Framework\TestCase { public static function arrayYAMLConversionDataProvider() { diff --git a/test/testsuite/runtime/query/CriteriaCombineTest.php b/test/testsuite/runtime/query/CriteriaCombineTest.php index df0b47cb1..a5be1c442 100644 --- a/test/testsuite/runtime/query/CriteriaCombineTest.php +++ b/test/testsuite/runtime/query/CriteriaCombineTest.php @@ -37,7 +37,7 @@ class CriteriaCombineTest extends BaseTestCase */ private $savedAdapter; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->c = new Criteria(); @@ -45,7 +45,7 @@ protected function setUp() Propel::setDB(null, new DBSQLite()); } - protected function tearDown() + protected function tearDown(): void { Propel::setDB(null, $this->savedAdapter); parent::tearDown(); diff --git a/test/testsuite/runtime/query/CriteriaMergeTest.php b/test/testsuite/runtime/query/CriteriaMergeTest.php index 9b2561d32..d9516c0d4 100644 --- a/test/testsuite/runtime/query/CriteriaMergeTest.php +++ b/test/testsuite/runtime/query/CriteriaMergeTest.php @@ -151,6 +151,7 @@ public function testMergeWithAsColumns() */ public function testMergeWithAsColumnsThrowsException() { + $this->expectException(PropelException::class); $c1 = new Criteria(); $c1->addAsColumn('foo', BookPeer::TITLE); $c2 = new Criteria(); @@ -390,6 +391,7 @@ public function testMergeWithAliases() */ public function testMergeWithAliasesThrowsException() { + $this->expectException(PropelException::class); $c1 = new Criteria(); $c1->addAlias('b', BookPeer::TABLE_NAME); $c2 = new Criteria(); diff --git a/test/testsuite/runtime/query/CriteriaTest.php b/test/testsuite/runtime/query/CriteriaTest.php index 04a71e6a2..64383851b 100644 --- a/test/testsuite/runtime/query/CriteriaTest.php +++ b/test/testsuite/runtime/query/CriteriaTest.php @@ -34,7 +34,7 @@ class CriteriaTest extends BookstoreTestBase */ private $savedAdapter; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->c = new Criteria(); @@ -42,7 +42,7 @@ protected function setUp() Propel::setDB(null, new DBSQLite()); } - protected function tearDown() + protected function tearDown(): void { Propel::setDB(null, $this->savedAdapter); parent::tearDown(); diff --git a/test/testsuite/runtime/query/JoinTest.php b/test/testsuite/runtime/query/JoinTest.php index 60ef52eaa..3e8367773 100644 --- a/test/testsuite/runtime/query/JoinTest.php +++ b/test/testsuite/runtime/query/JoinTest.php @@ -29,14 +29,14 @@ class JoinTest extends BaseTestCase */ private $savedAdapter; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->savedAdapter = Propel::getDB(null); Propel::setDB(null, new DBSQLite()); } - protected function tearDown() + protected function tearDown(): void { Propel::setDB(null, $this->savedAdapter); parent::tearDown(); diff --git a/test/testsuite/runtime/query/ModelCriteriaHooksTest.php b/test/testsuite/runtime/query/ModelCriteriaHooksTest.php index 18ba6ae75..2285e5603 100644 --- a/test/testsuite/runtime/query/ModelCriteriaHooksTest.php +++ b/test/testsuite/runtime/query/ModelCriteriaHooksTest.php @@ -20,7 +20,7 @@ */ class ModelCriteriaHooksTest extends BookstoreTestBase { - protected function setUp() + protected function setUp(): void { parent::setUp(); BookstoreDataPopulator::depopulate(); diff --git a/test/testsuite/runtime/query/ModelCriteriaSelectTest.php b/test/testsuite/runtime/query/ModelCriteriaSelectTest.php index f96af83c5..0145ddbd1 100644 --- a/test/testsuite/runtime/query/ModelCriteriaSelectTest.php +++ b/test/testsuite/runtime/query/ModelCriteriaSelectTest.php @@ -25,6 +25,7 @@ class ModelCriteriaSelectTest extends BookstoreTestBase */ public function testSelectThrowsExceptionWhenCalledWithAnEmptyString() { + $this->expectException(PropelException::class); $c = new ModelCriteria('bookstore', 'Book'); $c->select(''); } @@ -34,6 +35,7 @@ public function testSelectThrowsExceptionWhenCalledWithAnEmptyString() */ public function testSelectThrowsExceptionWhenCalledWithAnEmptyArray() { + $this->expectException(PropelException::class); $c = new ModelCriteria('bookstore', 'Book'); $c->select(array()); } @@ -111,6 +113,7 @@ public function testSelectStringFind() */ public function testSelectStringFindCalledWithNonExistingColumn() { + $this->expectException(PropelException::class); BookstoreDataPopulator::depopulate($this->con); BookstoreDataPopulator::populate($this->con); @@ -135,7 +138,7 @@ public function testSelectStringFindOne() $c = new ModelCriteria('bookstore', 'Author'); $c->where('Author.FirstName = ?', 'Neal'); $c->select('FirstName'); - $author = $c->findOne($this->con); + $author = [$c->findOne($this->con)]; $this->assertEquals(count($author), 1, 'findOne() called after select(string) allows for where() statements'); $expectedSQL = "SELECT author.first_name AS `FirstName` FROM `author` WHERE author.first_name = 'Neal' LIMIT 1"; $this->assertEquals($expectedSQL, $this->con->getLastExecutedQuery(), 'findOne() called after select(string) allows for where() statements'); @@ -167,7 +170,7 @@ public function testSelectStringJoin() $c->where('Author.FirstName = ?', 'Neal'); $c->select('Title'); $title = $c->findOne($this->con); - $this->assertEquals(count($title), 1, 'findOne() called after select(string) allows for join() statements'); + $this->assertEquals(count([$title]), 1, 'findOne() called after select(string) allows for join() statements'); $expectedSQL = "SELECT book.title AS `Title` FROM `book` INNER JOIN `author` ON (book.author_id=author.id) WHERE author.first_name = 'Neal' LIMIT 1"; $this->assertEquals($expectedSQL, $this->con->getLastExecutedQuery(), 'findOne() called after select(string) allows for where() statements'); diff --git a/test/testsuite/runtime/query/ModelCriteriaTest.php b/test/testsuite/runtime/query/ModelCriteriaTest.php index 0c23967b6..bcfa7988c 100644 --- a/test/testsuite/runtime/query/ModelCriteriaTest.php +++ b/test/testsuite/runtime/query/ModelCriteriaTest.php @@ -92,13 +92,13 @@ public static function conditionsForTestReplaceNames() /** * @dataProvider conditionsForTestReplaceNames */ - public function testReplaceNames($origClause, $columnPhpName = false, $modifiedClause) + public function testReplaceNames($origClause, $columnPhpName, $modifiedClause) { $c = new TestableModelCriteria('bookstore', 'Book'); - $this->doTestReplaceNames($c, BookPeer::getTableMap(), $origClause, $columnPhpName = false, $modifiedClause); + $this->doTestReplaceNames($c, BookPeer::getTableMap(), $origClause, $modifiedClause, $columnPhpName = false); } - public function doTestReplaceNames($c, $tableMap, $origClause, $columnPhpName = false, $modifiedClause) + public function doTestReplaceNames($c, $tableMap, $origClause, $modifiedClause, $columnPhpName = false) { $c->replaceNames($origClause); $columns = $c->replacedColumns; @@ -562,6 +562,7 @@ public function testGroupByAlias() */ public function testGroupByClassThrowsExceptionOnUnknownClass() { + $this->expectException(PropelException::class); $c = new ModelCriteria('bookstore', 'Book'); $c->groupByClass('Author'); } @@ -1068,6 +1069,7 @@ public function testWith() */ public function testWithThrowsExceptionWhenJoinLacks() { + $this->expectException(PropelException::class); $c = new ModelCriteria('bookstore', 'Book'); $c->with('Author'); } @@ -1086,6 +1088,7 @@ public function testWithAlias() */ public function testWithThrowsExceptionWhenNotUsingAlias() { + $this->expectException(PropelException::class); $c = new ModelCriteria('bookstore', 'Book'); $c->join('Book.Author a'); $c->with('Author'); @@ -1582,6 +1585,7 @@ public function testFindOneOrCreateExists() */ public function testFindOneOrCreateThrowsExceptionWhenQueryContainsJoin() { + $this->expectException(PropelException::class); $book = BookQuery::create('b') ->filterByPrice(125) ->useAuthorQuery() @@ -1742,6 +1746,7 @@ public function testFindPkCompositeKey() */ public function testFindPksCompositeKey() { + $this->expectException(PropelException::class); $c = new ModelCriteria('bookstore', 'BookListRel'); $bookListRel = $c->findPks(array(array(1, 2))); diff --git a/test/testsuite/runtime/query/ModelCriteriaWithNamespaceTest.php b/test/testsuite/runtime/query/ModelCriteriaWithNamespaceTest.php index 4ad74f5eb..fd1b93162 100644 --- a/test/testsuite/runtime/query/ModelCriteriaWithNamespaceTest.php +++ b/test/testsuite/runtime/query/ModelCriteriaWithNamespaceTest.php @@ -37,13 +37,13 @@ public static function conditionsForTestReplaceNamesWithNamespaces() /** * @dataProvider conditionsForTestReplaceNamesWithNamespaces */ - public function testReplaceNamesWithNamespaces($origClause, $columnPhpName = false, $modifiedClause) + public function testReplaceNamesWithNamespaces($origClause, $columnPhpName, $modifiedClause) { $c = new TestableModelCriteriaWithNamespace('bookstore_namespaced', 'Foo\\Bar\\NamespacedBook'); - $this->doTestReplaceNames($c, Foo\Bar\NamespacedBookPeer::getTableMap(), $origClause, $columnPhpName = false, $modifiedClause); + $this->doTestReplaceNames($c, Foo\Bar\NamespacedBookPeer::getTableMap(), $origClause, $modifiedClause, $columnPhpName = false); } - public function doTestReplaceNames($c, $tableMap, $origClause, $columnPhpName = false, $modifiedClause) + public function doTestReplaceNames($c, $tableMap, $origClause, $modifiedClause, $columnPhpName = false) { $c->replaceNames($origClause); $columns = $c->replacedColumns; diff --git a/test/testsuite/runtime/query/ModelCriteriaWithSchemaTest.php b/test/testsuite/runtime/query/ModelCriteriaWithSchemaTest.php index 0bbe50110..7be449c29 100644 --- a/test/testsuite/runtime/query/ModelCriteriaWithSchemaTest.php +++ b/test/testsuite/runtime/query/ModelCriteriaWithSchemaTest.php @@ -44,13 +44,13 @@ public static function conditionsForTestReplaceNamesWithSchemas() /** * @dataProvider conditionsForTestReplaceNamesWithSchemas */ - public function testReplaceNamesWithSchemas($origClause, $columnPhpName = false, $modifiedClause) + public function testReplaceNamesWithSchemas($origClause, $columnPhpName, $modifiedClause) { $c = new TestableModelCriteriaWithSchema('bookstore-schemas', 'ContestBookstoreContest'); - $this->doTestReplaceNames($c, ContestBookstoreContestPeer::getTableMap(), $origClause, $columnPhpName = false, $modifiedClause); + $this->doTestReplaceNames($c, ContestBookstoreContestPeer::getTableMap(), $origClause, $modifiedClause, $columnPhpName = false); } - public function doTestReplaceNames($c, $tableMap, $origClause, $columnPhpName = false, $modifiedClause) + public function doTestReplaceNames($c, $tableMap, $origClause, $modifiedClause, $columnPhpName = false) { $c->replaceNames($origClause); $columns = $c->replacedColumns; diff --git a/test/testsuite/runtime/util/BasePeerExceptionsTest.php b/test/testsuite/runtime/util/BasePeerExceptionsTest.php index cffdd7eeb..b844f7f1f 100644 --- a/test/testsuite/runtime/util/BasePeerExceptionsTest.php +++ b/test/testsuite/runtime/util/BasePeerExceptionsTest.php @@ -28,7 +28,7 @@ public function testDoSelect() BookPeer::addSelectColumns($c); BasePeer::doSelect($c); } catch (PropelException $e) { - $this->assertContains('[SELECT book.id, book.title, book.isbn, book.price, book.publisher_id, book.author_id FROM `book` WHERE book.id BAD SQL:p1]', $e->getMessage(), 'SQL query is written in the exception message'); + $this->assertStringContainsString('[SELECT book.id, book.title, book.isbn, book.price, book.publisher_id, book.author_id FROM `book` WHERE book.id BAD SQL:p1]', $e->getMessage(), 'SQL query is written in the exception message'); } } @@ -40,7 +40,7 @@ public function testDoCount() BookPeer::addSelectColumns($c); BasePeer::doCount($c); } catch (PropelException $e) { - $this->assertContains('[SELECT COUNT(*) FROM `book` WHERE book.id BAD SQL:p1]', $e->getMessage(), 'SQL query is written in the exception message'); + $this->assertStringContainsString('[SELECT COUNT(*) FROM `book` WHERE book.id BAD SQL:p1]', $e->getMessage(), 'SQL query is written in the exception message'); } } @@ -52,7 +52,7 @@ public function testDoDelete() $c->add(BookPeer::ID, 12, ' BAD SQL'); BasePeer::doDelete($c, Propel::getConnection()); } catch (PropelException $e) { - $this->assertContains('[DELETE FROM `book` WHERE book.id BAD SQL:p1]', $e->getMessage(), 'SQL query is written in the exception message'); + $this->assertStringContainsString('[DELETE FROM `book` WHERE book.id BAD SQL:p1]', $e->getMessage(), 'SQL query is written in the exception message'); } } @@ -61,7 +61,7 @@ public function testDoDeleteAll() try { BasePeer::doDeleteAll('BAD TABLE', Propel::getConnection()); } catch (PropelException $e) { - $this->assertContains('[DELETE FROM `BAD` `TABLE`]', $e->getMessage(), 'SQL query is written in the exception message'); + $this->assertStringContainsString('[DELETE FROM `BAD` `TABLE`]', $e->getMessage(), 'SQL query is written in the exception message'); } } @@ -75,7 +75,7 @@ public function testDoUpdate() $c2->add(BookPeer::TITLE, 'Foo'); BasePeer::doUpdate($c1, $c2, Propel::getConnection()); } catch (PropelException $e) { - $this->assertContains('[UPDATE `book` SET `title`=:p1 WHERE book.id BAD SQL:p2]', $e->getMessage(), 'SQL query is written in the exception message'); + $this->assertStringContainsString('[UPDATE `book` SET `title`=:p1 WHERE book.id BAD SQL:p2]', $e->getMessage(), 'SQL query is written in the exception message'); } } @@ -87,7 +87,7 @@ public function testDoInsert() $c->add(BookPeer::AUTHOR_ID, 'lkhlkhj'); BasePeer::doInsert($c, Propel::getConnection()); } catch (PropelException $e) { - $this->assertContains('[INSERT INTO `book` (`author_id`) VALUES (:p1)]', $e->getMessage(), 'SQL query is written in the exception message'); + $this->assertStringContainsString('[INSERT INTO `book` (`author_id`) VALUES (:p1)]', $e->getMessage(), 'SQL query is written in the exception message'); } } diff --git a/test/testsuite/runtime/util/BasePeerTest.php b/test/testsuite/runtime/util/BasePeerTest.php index 7a2827424..1f5ce9adf 100644 --- a/test/testsuite/runtime/util/BasePeerTest.php +++ b/test/testsuite/runtime/util/BasePeerTest.php @@ -226,6 +226,7 @@ public function testMssqlApplyLimitWithOffsetMultipleOrderBy() */ public function testDoDeleteNoCondition() { + $this->expectException(PropelException::class); $con = Propel::getConnection(); $c = new Criteria(BookPeer::DATABASE_NAME); BasePeer::doDelete($c, $con); @@ -236,6 +237,7 @@ public function testDoDeleteNoCondition() */ public function testDoDeleteJoin() { + $this->expectException(PropelException::class); $con = Propel::getConnection(); $c = new Criteria(BookPeer::DATABASE_NAME); $c->add(BookPeer::TITLE, 'War And Peace'); diff --git a/test/testsuite/runtime/util/PropelDateTimeTest.php b/test/testsuite/runtime/util/PropelDateTimeTest.php index f71eefe15..61a85301c 100644 --- a/test/testsuite/runtime/util/PropelDateTimeTest.php +++ b/test/testsuite/runtime/util/PropelDateTimeTest.php @@ -18,7 +18,7 @@ * @author Soenke Ruempler * @package runtime.util */ -class PropelDateTimeTest extends PHPUnit_Framework_TestCase +class PropelDateTimeTest extends \PHPUnit\Framework\TestCase { /** @@ -167,6 +167,7 @@ public function testNewInstanceGmt1($value, $expected) */ public function testNewInstanceInvalidValue() { + $this->expectException(PropelException::class); $dt = PropelDateTime::newInstance('some string'); } diff --git a/test/testsuite/runtime/util/PropelModelPagerTest.php b/test/testsuite/runtime/util/PropelModelPagerTest.php index 71b482b4d..9fbb2d8a6 100644 --- a/test/testsuite/runtime/util/PropelModelPagerTest.php +++ b/test/testsuite/runtime/util/PropelModelPagerTest.php @@ -166,7 +166,7 @@ public function testGetLastPage() $this->createBooks(5); $pager = $this->getPager(4, 1); $this->assertEquals(2, $pager->getLastPage(), 'getLastPage() returns the last page number'); - $this->assertInternalType('integer', $pager->getLastPage(), 'getLastPage() returns an integer'); + $this->assertIsInt($pager->getLastPage(), 'getLastPage() returns an integer'); } public function testIsFirstOnFirstPage() diff --git a/test/testsuite/runtime/util/PropelPagerTest.php b/test/testsuite/runtime/util/PropelPagerTest.php index 164b20639..7e7a9dfc2 100644 --- a/test/testsuite/runtime/util/PropelPagerTest.php +++ b/test/testsuite/runtime/util/PropelPagerTest.php @@ -22,7 +22,7 @@ class PropelPagerTest extends BookstoreEmptyTestBase private $authorId; private $books; - protected function setUp() + protected function setUp(): void { parent::setUp(); BookstoreDataPopulator::populate(); @@ -76,7 +76,7 @@ protected function setUp() $this->books[] = $book->getId(); } - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); $cr = new Criteria(); diff --git a/test/testsuite/runtime/validator/ValidatorTest.php b/test/testsuite/runtime/validator/ValidatorTest.php index e642d68e9..0d834e0c2 100644 --- a/test/testsuite/runtime/validator/ValidatorTest.php +++ b/test/testsuite/runtime/validator/ValidatorTest.php @@ -29,7 +29,7 @@ class ValidatorTest extends BookstoreEmptyTestBase { - protected function setUp() + protected function setUp(): void { parent::setUp(); BookstoreDataPopulator::populate(); diff --git a/test/tools/helpers/BaseTestCase.php b/test/tools/helpers/BaseTestCase.php index 7fd35f309..b7a97f2fa 100644 --- a/test/tools/helpers/BaseTestCase.php +++ b/test/tools/helpers/BaseTestCase.php @@ -19,7 +19,7 @@ * @author Christopher Elkins (Torque) * @version $Revision$ */ -abstract class BaseTestCase extends PHPUnit_Framework_TestCase +abstract class BaseTestCase extends \PHPUnit\Framework\TestCase { /** * Conditional compilation flag. diff --git a/test/tools/helpers/PlatformDatabaseBuildTimeBase.php b/test/tools/helpers/PlatformDatabaseBuildTimeBase.php index 0f7fe167e..ed9df5f4a 100644 --- a/test/tools/helpers/PlatformDatabaseBuildTimeBase.php +++ b/test/tools/helpers/PlatformDatabaseBuildTimeBase.php @@ -1,6 +1,6 @@ oldPropelConfiguration = Propel::getConfiguration(); @@ -51,7 +51,7 @@ public function readDatabase() $this->parser->parse($this->database); } - protected function tearDown() + protected function tearDown(): void { if ($this->oldPropelConfiguration) { Propel::setConfiguration($this->oldPropelConfiguration); diff --git a/test/tools/helpers/bookstore/BookstoreEmptyTestBase.php b/test/tools/helpers/bookstore/BookstoreEmptyTestBase.php index 50e322a83..272bd6f2e 100644 --- a/test/tools/helpers/bookstore/BookstoreEmptyTestBase.php +++ b/test/tools/helpers/bookstore/BookstoreEmptyTestBase.php @@ -1,4 +1,3 @@ - con); diff --git a/test/tools/helpers/bookstore/BookstoreTestBase.php b/test/tools/helpers/bookstore/BookstoreTestBase.php index 2991d1a8f..cb260c4a3 100644 --- a/test/tools/helpers/bookstore/BookstoreTestBase.php +++ b/test/tools/helpers/bookstore/BookstoreTestBase.php @@ -15,14 +15,14 @@ /** * Base class contains some methods shared by subclass test cases. */ -abstract class BookstoreTestBase extends PHPUnit_Framework_TestCase +abstract class BookstoreTestBase extends \PHPUnit\Framework\TestCase { protected $con; /** * This is run before each unit test; it populates the database. */ - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->con = Propel::getConnection(BookPeer::DATABASE_NAME); @@ -32,7 +32,7 @@ protected function setUp() /** * This is run after each unit test. It empties the database. */ - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); // Only commit if the transaction hasn't failed. diff --git a/test/tools/helpers/cms/CmsTestBase.php b/test/tools/helpers/cms/CmsTestBase.php index 979f55a43..acd035fc9 100644 --- a/test/tools/helpers/cms/CmsTestBase.php +++ b/test/tools/helpers/cms/CmsTestBase.php @@ -16,14 +16,14 @@ /** * Base class contains some methods shared by subclass test cases. */ -abstract class CmsTestBase extends PHPUnit_Framework_TestCase +abstract class CmsTestBase extends \PHPUnit\Framework\TestCase { protected $con; /** * This is run before each unit test; it populates the database. */ - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->con = Propel::getConnection(PagePeer::DATABASE_NAME); @@ -35,7 +35,7 @@ protected function setUp() /** * This is run after each unit test. It empties the database. */ - protected function tearDown() + protected function tearDown(): void { CmsDataPopulator::depopulate($this->con); $this->con->commit(); diff --git a/test/tools/helpers/namespaces/NamespacesTestBase.php b/test/tools/helpers/namespaces/NamespacesTestBase.php index 5a8433925..44d4dc584 100644 --- a/test/tools/helpers/namespaces/NamespacesTestBase.php +++ b/test/tools/helpers/namespaces/NamespacesTestBase.php @@ -14,10 +14,10 @@ /** * Bse class for tests on the schemas schema */ -abstract class NamespacesTestBase extends PHPUnit_Framework_TestCase +abstract class NamespacesTestBase extends \PHPUnit\Framework\TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); if (!file_exists(dirname(__FILE__) . '/../../../fixtures/namespaced/build/conf/bookstore_namespaced-conf.php')) { @@ -26,7 +26,7 @@ protected function setUp() Propel::init(dirname(__FILE__) . '/../../../fixtures/namespaced/build/conf/bookstore_namespaced-conf.php'); } - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); Propel::init(dirname(__FILE__) . '/../../../fixtures/bookstore/build/conf/bookstore-conf.php'); diff --git a/test/tools/helpers/schemas/SchemasTestBase.php b/test/tools/helpers/schemas/SchemasTestBase.php index f3cdd5d7b..ddb1b3684 100644 --- a/test/tools/helpers/schemas/SchemasTestBase.php +++ b/test/tools/helpers/schemas/SchemasTestBase.php @@ -14,10 +14,10 @@ /** * Bse class for tests on the schemas schema */ -abstract class SchemasTestBase extends PHPUnit_Framework_TestCase +abstract class SchemasTestBase extends \PHPUnit\Framework\TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); if (!file_exists(dirname(__FILE__) . '/../../../fixtures/schemas/build/conf/bookstore-conf.php')) { @@ -26,7 +26,7 @@ protected function setUp() Propel::init(dirname(__FILE__) . '/../../../fixtures/schemas/build/conf/bookstore-conf.php'); } - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); Propel::init(dirname(__FILE__) . '/../../../fixtures/bookstore/build/conf/bookstore-conf.php');