attempt at getting MySQL tests working
This commit is contained in:
parent
03826b87d6
commit
c9938955f9
10 changed files with 47 additions and 35 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -3,4 +3,5 @@ composer.lock
|
||||||
.phpunit.result.cache
|
.phpunit.result.cache
|
||||||
test.php
|
test.php
|
||||||
test.sqlite
|
test.sqlite
|
||||||
|
*.test.sqlite
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
|
@ -1,4 +1,11 @@
|
||||||
image: php:7.1-alpine
|
image: php:7.1-alpine
|
||||||
|
|
||||||
|
services:
|
||||||
|
- mysql:latest
|
||||||
|
|
||||||
|
variables:
|
||||||
|
MYSQL_DATABASE: destructr_test
|
||||||
|
MYSQL_ROOT_PASSWORD: badpassword
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- apk update
|
- apk update
|
||||||
|
@ -11,10 +18,10 @@ test:local:
|
||||||
script:
|
script:
|
||||||
- php composer.phar test-local
|
- php composer.phar test-local
|
||||||
|
|
||||||
# test:db:
|
test:drivers:
|
||||||
# script:
|
script:
|
||||||
# - docker-php-ext-install pdo_mysql
|
- docker-php-ext-install pdo_mysql
|
||||||
# - php composer.phar test-db
|
- php composer.phar test-mysql
|
||||||
|
|
||||||
test:sqlite:
|
test:sqlite:
|
||||||
script:
|
script:
|
||||||
|
|
|
@ -21,8 +21,8 @@
|
||||||
"test-local": [
|
"test-local": [
|
||||||
"phpunit --testsuite Local"
|
"phpunit --testsuite Local"
|
||||||
],
|
],
|
||||||
"test-db": [
|
"test-mysql": [
|
||||||
"phpunit --testsuite DB"
|
"phpunit --testsuite MySQL"
|
||||||
],
|
],
|
||||||
"test-sqlite": [
|
"test-sqlite": [
|
||||||
"phpunit --testsuite SQLite"
|
"phpunit --testsuite SQLite"
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
<exclude>tests/Drivers</exclude>
|
<exclude>tests/Drivers</exclude>
|
||||||
<exclude>tests/LegacyDrivers</exclude>
|
<exclude>tests/LegacyDrivers</exclude>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
<testsuite name="Drivers">
|
<testsuite name="MySQL">
|
||||||
<directory>tests/Drivers</directory>
|
<directory>tests/Drivers/MySQL</directory>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
<testsuite name="SQLite">
|
<testsuite name="SQLite">
|
||||||
<directory>tests/LegacyDrivers/SQLite</directory>
|
<directory>tests/LegacyDrivers/SQLite</directory>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
/* Destructr | https://gitlab.com/byjoby/destructr | MIT License */
|
/* Destructr | https://gitlab.com/byjoby/destructr | MIT License */
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace Destructr\Drivers\IntegrationTests;
|
namespace Destructr\Drivers;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use PHPUnit\DbUnit\TestCaseTrait;
|
use PHPUnit\DbUnit\TestCaseTrait;
|
|
@ -1,16 +0,0 @@
|
||||||
<?php
|
|
||||||
/* Destructr | https://gitlab.com/byjoby/destructr | MIT License */
|
|
||||||
declare(strict_types=1);
|
|
||||||
namespace Destructr\Drivers\IntegrationTests;
|
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
|
||||||
|
|
||||||
class MySQLDriverTest extends AbstractDriverIntegrationTest
|
|
||||||
{
|
|
||||||
const DRIVER_CLASS = \Destructr\Drivers\MySQLDriver::class;
|
|
||||||
const DRIVER_DSN = 'mysql:host=mysql;dbname=ci';
|
|
||||||
const DRIVER_USERNAME = 'ci_password';
|
|
||||||
const DRIVER_PASSWORD = null;
|
|
||||||
const DRIVER_OPTIONS = null;
|
|
||||||
const TEST_TABLE = 'mysqlintegrationtest';
|
|
||||||
}
|
|
18
tests/Drivers/MySQL/MySQLDriverIntegrationTest.php
Normal file
18
tests/Drivers/MySQL/MySQLDriverIntegrationTest.php
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
/* Destructr | https://gitlab.com/byjoby/destructr | MIT License */
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace Destructr\Drivers\MySQL;
|
||||||
|
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
use Destructr\Drivers\AbstractDriverIntegrationTest;
|
||||||
|
use Destructr\Drivers\MySQLDriver;
|
||||||
|
|
||||||
|
class MySQLDriverIntegrationTest extends AbstractDriverIntegrationTest
|
||||||
|
{
|
||||||
|
const DRIVER_CLASS = \Destructr\Drivers\MySQLDriver::class;
|
||||||
|
const DRIVER_DSN = 'mysql:host=mysql;dbname=destructr_test';
|
||||||
|
const DRIVER_USERNAME = 'root';
|
||||||
|
const DRIVER_PASSWORD = 'badpassword';
|
||||||
|
const DRIVER_OPTIONS = null;
|
||||||
|
const TEST_TABLE = 'integrationtest';
|
||||||
|
}
|
|
@ -1,15 +1,17 @@
|
||||||
<?php
|
<?php
|
||||||
/* Destructr | https://gitlab.com/byjoby/destructr | MIT License */
|
/* Destructr | https://gitlab.com/byjoby/destructr | MIT License */
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace Destructr\Drivers;
|
namespace Destructr\Drivers\MySQL;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
use Destructr\Drivers\AbstractDriverTest;
|
||||||
|
use Destructr\Drivers\MySQLDriver;
|
||||||
|
|
||||||
class MySQLDriverTest extends AbstractDriverTest
|
class MySQLDriverTest extends AbstractDriverTest
|
||||||
{
|
{
|
||||||
const DRIVER_CLASS = MySQLDriver::class;
|
const DRIVER_CLASS = MySQLDriver::class;
|
||||||
const DRIVER_DSN = 'mysql:host=mysql;dbname=ci';
|
const DRIVER_DSN = 'mysql:host=mysql;dbname=destructr_test';
|
||||||
const DRIVER_USERNAME = 'ci_password';
|
const DRIVER_USERNAME = 'root';
|
||||||
const DRIVER_PASSWORD = null;
|
const DRIVER_PASSWORD = 'badpassword';
|
||||||
const DRIVER_OPTIONS = null;
|
const DRIVER_OPTIONS = null;
|
||||||
}
|
}
|
|
@ -4,13 +4,13 @@ declare(strict_types=1);
|
||||||
namespace Destructr\LegacyDrivers\SQLite;
|
namespace Destructr\LegacyDrivers\SQLite;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Destructr\Drivers\IntegrationTests\AbstractDriverIntegrationTest;
|
use Destructr\Drivers\AbstractDriverIntegrationTest;
|
||||||
use Destructr\LegacyDrivers\SQLiteDriver;
|
use Destructr\LegacyDrivers\SQLiteDriver;
|
||||||
|
|
||||||
class MySQLDriverTest extends AbstractDriverIntegrationTest
|
class MySQLDriverTest extends AbstractDriverIntegrationTest
|
||||||
{
|
{
|
||||||
const DRIVER_CLASS = SQLiteDriver::class;
|
const DRIVER_CLASS = SQLiteDriver::class;
|
||||||
const DRIVER_DSN = 'sqlite:'.__DIR__.'/test.sqlite';
|
const DRIVER_DSN = 'sqlite:'.__DIR__.'/integration.test.sqlite';
|
||||||
const DRIVER_USERNAME = null;
|
const DRIVER_USERNAME = null;
|
||||||
const DRIVER_PASSWORD = null;
|
const DRIVER_PASSWORD = null;
|
||||||
const DRIVER_OPTIONS = null;
|
const DRIVER_OPTIONS = null;
|
||||||
|
@ -18,6 +18,6 @@ class MySQLDriverTest extends AbstractDriverIntegrationTest
|
||||||
|
|
||||||
public static function setUpBeforeClass()
|
public static function setUpBeforeClass()
|
||||||
{
|
{
|
||||||
@unlink(__DIR__.'/test.sqlite');
|
@unlink(__DIR__.'/integration.test.sqlite');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,13 +10,13 @@ use Destructr\LegacyDrivers\SQLiteDriver;
|
||||||
class SQLiteDriverTest extends AbstractDriverTest
|
class SQLiteDriverTest extends AbstractDriverTest
|
||||||
{
|
{
|
||||||
const DRIVER_CLASS = SQLiteDriver::class;
|
const DRIVER_CLASS = SQLiteDriver::class;
|
||||||
const DRIVER_DSN = 'sqlite:'.__DIR__.'/test.sqlite';
|
const DRIVER_DSN = 'sqlite:'.__DIR__.'/driver.test.sqlite';
|
||||||
const DRIVER_USERNAME = null;
|
const DRIVER_USERNAME = null;
|
||||||
const DRIVER_PASSWORD = null;
|
const DRIVER_PASSWORD = null;
|
||||||
const DRIVER_OPTIONS = null;
|
const DRIVER_OPTIONS = null;
|
||||||
|
|
||||||
public static function setUpBeforeClass()
|
public static function setUpBeforeClass()
|
||||||
{
|
{
|
||||||
@unlink(__DIR__.'/test.sqlite');
|
@unlink(__DIR__.'/driver.test.sqlite');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue