Skip to content

Commit

Permalink
#2 Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Juan Pablo Ramirez committed Feb 5, 2021
1 parent 116e89f commit 76a2e4b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
if [ ${{ matrix.db-type }} == 'mysql' ]; then
sudo service mysql start && mysql -h 127.0.0.1 -u root -proot -e 'CREATE DATABASE IF NOT EXISTS test_migrator;';
fi
composer run-tests-${{ matrix.db-type }}
composer ${{ matrix.db-type }}
- name: Run Phpstan
run: composer run-phpstan
run: composer phpstan
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
}
},
"scripts": {
"run-tests-mysql": "bash run_tests.sh Mysql",
"run-tests-pgsql": "bash run_tests.sh Postgres",
"run-tests-sqlite": "bash run_tests.sh Sqlite",
"run-phpstan": "./vendor/bin/phpstan analyse --memory-limit=-1"
"mysql": "bash run_tests.sh Mysql",
"pgsql": "bash run_tests.sh Postgres",
"sqlite": "bash run_tests.sh Sqlite",
"phpstan": "./vendor/bin/phpstan analyse --memory-limit=-1"
},
"config": {
"sort-packages": true
}
}
}
13 changes: 2 additions & 11 deletions tests/TestCase/MigratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@
namespace CakephpTestMigrator\Test\TestCase;


use Cake\Datasource\ConnectionManager;
use Cake\TestSuite\TestCase;
use CakephpTestMigrator\Migrator;
use CakephpTestSuiteLight\FixtureManager;
use CakephpTestSuiteLight\Sniffer\BaseTableSniffer;

class MigratorTest extends TestCase
{
Expand All @@ -26,22 +25,14 @@ class MigratorTest extends TestCase
*/
public $migrator;

/**
* @var BaseTableSniffer
*/
public $sniffer;

public function setUp(): void
{
$this->migrator = new Migrator();

$fm = new FixtureManager();
$this->sniffer = $fm->getSniffer('test');
}

private function fetchMigrationsInDB(string $dbTable): array
{
return $this->sniffer->fetchQuery("SELECT migration_name FROM $dbTable");
return ConnectionManager::get('test')->execute("SELECT migration_name FROM $dbTable")->fetch();
}

public function testGetConfig()
Expand Down

0 comments on commit 76a2e4b

Please sign in to comment.