From 21b54566c15256ced0adb078be65bdf55f464e72 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Tue, 5 Dec 2023 16:03:43 +0100 Subject: [PATCH] fixed tests - removed phpdbg because it generates "Fatal error: Invalid callback , no array or string given in Unknown on line 0" --- .github/workflows/tests.yml | 11 +------- .../Connection.getInsertId().mysql.phpt | 3 --- .../Explorer/bugs/ActiveRow.__isset().phpt | 2 +- .../Explorer/bugs/ZeroPrimaryKey.phpt | 2 -- tests/Database/Explorer/bugs/bug216.phpt | 27 +++---------------- tests/Database/Explorer/bugs/bug49.phpt | 3 +-- tests/Database/connect.inc.php | 8 +++--- 7 files changed, 10 insertions(+), 46 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 749c5ee59..f148c23e7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -104,7 +104,7 @@ jobs: run: docker exec -i mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P 'YourStrong!Passw0rd' -Q 'CREATE DATABASE nette_test' - run: composer install --no-progress --prefer-dist - - run: vendor/bin/tester -p phpdbg tests -s -C --coverage ./coverage.xml --coverage-src ./src + - run: vendor/bin/tester tests -s -C - if: failure() uses: actions/upload-artifact@v3 with: @@ -112,15 +112,6 @@ jobs: path: tests/**/output - - name: Save Code Coverage - if: ${{ matrix.php == '8.0' }} - env: - COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.4.3/php-coveralls.phar - php php-coveralls.phar --verbose --config tests/.coveralls.yml - - lowest_dependencies: name: Lowest Dependencies runs-on: ubuntu-latest diff --git a/tests/Database/Connection.getInsertId().mysql.phpt b/tests/Database/Connection.getInsertId().mysql.phpt index e80b17746..a95bdfb59 100644 --- a/tests/Database/Connection.getInsertId().mysql.phpt +++ b/tests/Database/Connection.getInsertId().mysql.phpt @@ -11,9 +11,6 @@ use Tester\Assert; require __DIR__ . '/connect.inc.php'; // create $connection -$connection->query('CREATE DATABASE IF NOT EXISTS nette_test'); -$connection->query('USE nette_test'); - $connection->query(' CREATE TEMPORARY TABLE noprimarykey ( diff --git a/tests/Database/Explorer/bugs/ActiveRow.__isset().phpt b/tests/Database/Explorer/bugs/ActiveRow.__isset().phpt index 737457116..a45fbb81f 100644 --- a/tests/Database/Explorer/bugs/ActiveRow.__isset().phpt +++ b/tests/Database/Explorer/bugs/ActiveRow.__isset().phpt @@ -1,7 +1,7 @@ query('CREATE DATABASE IF NOT EXISTS nette_test'); -$explorer->query('USE nette_test'); $explorer->query(' CREATE TABLE ships ( diff --git a/tests/Database/Explorer/bugs/bug216.phpt b/tests/Database/Explorer/bugs/bug216.phpt index fe775ef36..8ce0d760b 100644 --- a/tests/Database/Explorer/bugs/bug216.phpt +++ b/tests/Database/Explorer/bugs/bug216.phpt @@ -2,37 +2,16 @@ /** * Test: bug #216 - * @dataProvider? ../databases.ini + * @dataProvider? ../../databases.ini */ declare(strict_types=1); use Tester\Assert; -require __DIR__ . '/../../../bootstrap.php'; +require __DIR__ . '/../../connect.inc.php'; -//Prepare connection -$options = Tester\Environment::loadData() + ['user' => null, 'password' => null]; - -try { - $connection = new Nette\Database\Connection($options['dsn'], $options['user'], $options['password']); -} catch (PDOException $e) { - Tester\Environment::skip("Connection to '$options[dsn]' failed. Reason: " . $e->getMessage()); -} - -if (strpos($options['dsn'], 'sqlite::memory:') === false) { - Tester\Environment::lock($options['dsn'], getTempDir()); -} - -$driverName = $connection->getPdo()->getAttribute(PDO::ATTR_DRIVER_NAME); -$cacheMemoryStorage = new Nette\Caching\Storages\MemoryStorage; - -$structure = new Nette\Database\Structure($connection, $cacheMemoryStorage); -$conventions = new Nette\Database\Conventions\StaticConventions; -$explorer = new Nette\Database\Explorer($connection, $structure, $conventions, $cacheMemoryStorage); - -//Testing -Nette\Database\Helpers::loadFromFile($connection, __DIR__ . "/../files/{$driverName}-nette_test1.sql"); +Nette\Database\Helpers::loadFromFile($connection, __DIR__ . "/../../files/{$driverName}-nette_test1.sql"); $book = $explorer->table('author')->insert([ 'name' => $explorer->literal('LOWER(?)', 'Eddard Stark'), diff --git a/tests/Database/Explorer/bugs/bug49.phpt b/tests/Database/Explorer/bugs/bug49.phpt index 428af14a5..4639b899a 100644 --- a/tests/Database/Explorer/bugs/bug49.phpt +++ b/tests/Database/Explorer/bugs/bug49.phpt @@ -11,8 +11,7 @@ use Tester\Assert; require __DIR__ . '/../../connect.inc.php'; -$explorer->query('CREATE DATABASE IF NOT EXISTS nette_test'); -$explorer->query('USE nette_test'); + $explorer->query('CREATE TABLE `TABLE 30` (id int)'); Assert::same( diff --git a/tests/Database/connect.inc.php b/tests/Database/connect.inc.php index eaa773522..84a57fbca 100644 --- a/tests/Database/connect.inc.php +++ b/tests/Database/connect.inc.php @@ -11,16 +11,16 @@ $options = Tester\Environment::loadData() + ['user' => null, 'password' => null]; +if (strpos($options['dsn'], 'sqlite::memory:') === false) { + Tester\Environment::lock($options['dsn'], getTempDir()); +} + try { $connection = new Nette\Database\Connection($options['dsn'], $options['user'], $options['password']); } catch (PDOException $e) { Tester\Environment::skip("Connection to '$options[dsn]' failed. Reason: " . $e->getMessage()); } -if (strpos($options['dsn'], 'sqlite::memory:') === false) { - Tester\Environment::lock($options['dsn'], getTempDir()); -} - $driverName = $connection->getPdo()->getAttribute(PDO::ATTR_DRIVER_NAME); $cacheMemoryStorage = new Nette\Caching\Storages\MemoryStorage;