Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
- removed phpdbg because it generates "Fatal error: Invalid callback , no array or string given in Unknown on line 0"
  • Loading branch information
dg committed Dec 5, 2023
1 parent 9e21c50 commit 21b5456
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 46 deletions.
11 changes: 1 addition & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,23 +104,14 @@ 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:
name: output
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
Expand Down
3 changes: 0 additions & 3 deletions tests/Database/Connection.getInsertId().mysql.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
2 changes: 1 addition & 1 deletion tests/Database/Explorer/bugs/ActiveRow.__isset().phpt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* @dataProvider? ../databases.ini
* @dataProvider? ../../databases.ini
*/

declare(strict_types=1);
Expand Down
2 changes: 0 additions & 2 deletions tests/Database/Explorer/bugs/ZeroPrimaryKey.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ 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 ships (
Expand Down
27 changes: 3 additions & 24 deletions tests/Database/Explorer/bugs/bug216.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
3 changes: 1 addition & 2 deletions tests/Database/Explorer/bugs/bug49.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
8 changes: 4 additions & 4 deletions tests/Database/connect.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 21b5456

Please sign in to comment.