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..a0ee41e26 100644 --- a/composer.json +++ b/composer.json @@ -14,12 +14,15 @@ }, "include-path": ["runtime/lib", "generator/lib"], "require": { - "php": ">=5.2.4", + "php": "^7.1", "phing/phing": "~2.4" + }, "require-dev": { - "pear-pear.php.net/PEAR_PackageFileManager2": "@stable", - "phpunit/phpunit": "~4.0||~5.0" + "pear-pear.php.net/pear_packagefilemanager2": "@stable", + "phpunit/phpunit": "^9.0.0", + "phpcompatibility/php-compatibility": "^9.3", + "squizlabs/php_codesniffer": "^3.5" }, "extra": { "branch-alias": { @@ -32,5 +35,9 @@ "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..3330a01c5 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,11 @@ +FROM thecodingmachine/php:7.4-v3-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..95efc4eeb --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,26 @@ +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 + - STARTUP_COMMAND_1=composer install + - STARTUP_COMMAND_2=bash test/reset_tests.sh + + 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/builder/om/PHP5ObjectBuilder.php b/generator/lib/builder/om/PHP5ObjectBuilder.php index a68e1cd36..da9fd1625 100644 --- a/generator/lib/builder/om/PHP5ObjectBuilder.php +++ b/generator/lib/builder/om/PHP5ObjectBuilder.php @@ -1411,6 +1411,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..176273ffc 100644 --- a/generator/lib/builder/om/PHP5ObjectNoCollectionBuilder.php +++ b/generator/lib/builder/om/PHP5ObjectNoCollectionBuilder.php @@ -111,6 +111,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..4a2effaac 100644 --- a/generator/lib/builder/om/PHP5PeerBuilder.php +++ b/generator/lib/builder/om/PHP5PeerBuilder.php @@ -1200,7 +1200,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/QueryBuilder.php b/generator/lib/builder/om/QueryBuilder.php index 7875f5bb7..c561a85a5 100644 --- a/generator/lib/builder/om/QueryBuilder.php +++ b/generator/lib/builder/om/QueryBuilder.php @@ -415,10 +415,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/config/GeneratorConfig.php b/generator/lib/config/GeneratorConfig.php index b2602ed05..dd468842a 100644 --- a/generator/lib/config/GeneratorConfig.php +++ b/generator/lib/config/GeneratorConfig.php @@ -121,7 +121,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..4bc8efef3 100644 --- a/generator/lib/config/QuickGeneratorConfig.php +++ b/generator/lib/config/QuickGeneratorConfig.php @@ -62,7 +62,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, '='); diff --git a/generator/lib/model/Index.php b/generator/lib/model/Index.php index 2812a9ed4..c6de078dc 100644 --- a/generator/lib/model/Index.php +++ b/generator/lib/model/Index.php @@ -181,7 +181,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/XMLElement.php b/generator/lib/model/XMLElement.php index 828a30bc2..b5a455bb4 100644 --- a/generator/lib/model/XMLElement.php +++ b/generator/lib/model/XMLElement.php @@ -109,7 +109,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/platform/DefaultPlatform.php b/generator/lib/platform/DefaultPlatform.php index d8ee83fa1..1891e5b91 100644 --- a/generator/lib/platform/DefaultPlatform.php +++ b/generator/lib/platform/DefaultPlatform.php @@ -1182,7 +1182,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/PgsqlPlatform.php b/generator/lib/platform/PgsqlPlatform.php index 416eb99fc..d7b94c23e 100644 --- a/generator/lib/platform/PgsqlPlatform.php +++ b/generator/lib/platform/PgsqlPlatform.php @@ -393,7 +393,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/phpunit.xml.dist b/phpunit.xml.dist index 4b1811a2c..2dcb3b3df 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -8,7 +8,7 @@ convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" - syntaxCheck="false" + beStrictAboutTestsThatDoNotTestAnything="false" bootstrap="test/bootstrap.php" > 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..634b5ca37 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()) { 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/fixtures/bookstore/build.properties b/test/fixtures/bookstore/build.properties index 23b1d04c2..6305b4fe8 100644 --- a/test/fixtures/bookstore/build.properties +++ b/test/fixtures/bookstore/build.properties @@ -12,7 +12,7 @@ propel.project = bookstore propel.database = mysql -propel.database.url = mysql:dbname=test +propel.database.url = mysql:host=db;dbname=test propel.mysql.tableType = InnoDB propel.disableIdentifierQuoting = true propel.schema.autoPrefix = true diff --git a/test/fixtures/bookstore/runtime-conf.xml b/test/fixtures/bookstore/runtime-conf.xml index f3fa856a8..1e59f3fde 100644 --- a/test/fixtures/bookstore/runtime-conf.xml +++ b/test/fixtures/bookstore/runtime-conf.xml @@ -16,7 +16,7 @@ DebugPDO - mysql:dbname=test + mysql:host=db;dbname=test @@ -51,7 +51,7 @@ mysql DebugPDO - mysql:dbname=test + mysql:host=db;dbname=test @@ -73,7 +73,7 @@ mysql DebugPDO - mysql:dbname=test + mysql:host=db;dbname=test diff --git a/test/fixtures/namespaced/build.properties b/test/fixtures/namespaced/build.properties index de605d4ad..8f220f1d4 100644 --- a/test/fixtures/namespaced/build.properties +++ b/test/fixtures/namespaced/build.properties @@ -12,7 +12,7 @@ propel.project = bookstore_namespaced propel.database = mysql -propel.database.url = mysql:dbname=test +propel.database.url = mysql:host=db;dbname=test propel.mysql.tableType = InnoDB propel.disableIdentifierQuoting=true diff --git a/test/fixtures/namespaced/runtime-conf.xml b/test/fixtures/namespaced/runtime-conf.xml index 2c351913e..037b84527 100644 --- a/test/fixtures/namespaced/runtime-conf.xml +++ b/test/fixtures/namespaced/runtime-conf.xml @@ -16,7 +16,7 @@ DebugPDO - mysql:dbname=test + mysql:host=db;dbname=test diff --git a/test/fixtures/reverse/mysql/build.properties b/test/fixtures/reverse/mysql/build.properties index 05aaad78a..99ec001cf 100644 --- a/test/fixtures/reverse/mysql/build.properties +++ b/test/fixtures/reverse/mysql/build.properties @@ -13,7 +13,7 @@ propel.project = reverse_bookstore propel.database = mysql -propel.database.url = mysql:dbname=reverse_bookstore +propel.database.url = mysql:host=db;dbname=reverse_bookstore # For MySQL or Oracle, you also need to specify username & password propel.database.user = root diff --git a/test/fixtures/reverse/mysql/runtime-conf.xml b/test/fixtures/reverse/mysql/runtime-conf.xml index c328761a3..d50175fff 100644 --- a/test/fixtures/reverse/mysql/runtime-conf.xml +++ b/test/fixtures/reverse/mysql/runtime-conf.xml @@ -14,7 +14,7 @@ mysql DebugPDO - mysql:dbname=reverse_bookstore + mysql:host=db;dbname=reverse_bookstore diff --git a/test/fixtures/schemas/build.properties b/test/fixtures/schemas/build.properties index 545840036..b089f65c1 100644 --- a/test/fixtures/schemas/build.properties +++ b/test/fixtures/schemas/build.properties @@ -12,7 +12,7 @@ propel.project = bookstore propel.database = mysql -propel.database.url = mysql:dbname=test +propel.database.url = mysql:host=db;dbname=test propel.database.user = root propel.mysql.tableType = InnoDB propel.disableIdentifierQuoting = true diff --git a/test/fixtures/schemas/runtime-conf.xml b/test/fixtures/schemas/runtime-conf.xml index 76f894101..e31bc59ee 100644 --- a/test/fixtures/schemas/runtime-conf.xml +++ b/test/fixtures/schemas/runtime-conf.xml @@ -14,7 +14,7 @@ mysql DebugPDO - mysql:dbname=test + mysql:host=db;dbname=test 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/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..ff7043b0c 100644 --- a/test/testsuite/runtime/query/ModelCriteriaTest.php +++ b/test/testsuite/runtime/query/ModelCriteriaTest.php @@ -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/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..70fcf7356 100644 --- a/test/tools/helpers/bookstore/BookstoreEmptyTestBase.php +++ b/test/tools/helpers/bookstore/BookstoreEmptyTestBase.php @@ -20,7 +20,7 @@ abstract class BookstoreEmptyTestBase extends BookstoreTestBase /** * This is run before each unit test; it empties the database. */ - protected function setUp() + protected function setUp(): void { parent::setUp(); BookstoreDataPopulator::depopulate($this->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');