Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,15 @@
"Dframe\\Database\\": "src/"
}
},
"require": {}
}
"autoload-dev": {
"psr-4": {
"Dframe\\Database\\tests\\": "tests/"
}
},
"require": {
"php": ">=5.6"
},
"require-dev": {
"phpunit/phpunit": "^5.7 || ^6.5"
}
}
3 changes: 0 additions & 3 deletions tests/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,3 @@

# Application configuration
define('APP_DIR', dirname(__FILE__) . '/app/');

$autoloader = include dirname(__FILE__) . '/../vendor/autoload.php';;
$autoloader->addPsr4('Dframe\Database\tests\\', __DIR__);
15 changes: 5 additions & 10 deletions tests/ConnectionTest.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
<?php
use PHPUnit_Framework_Constraint_IsType as PHPUnit_IsType;
namespace Dframe\Database\tests;

use PHPUnit\Framework\Constraint\IsType as PHPUnitIsType;
use Dframe\Database\Database;
use Dframe\Database\Pdohelper;
use \PDO;

// backward compatibility
if (!class_exists('\PHPUnit\Framework\TestCase') and class_exists('\PHPUnit_Framework_TestCase')) {
class_alias('\PHPUnit_Framework_TestCase', '\PHPUnit\Framework\TestCase');
}
//@Todo
//@Todo

Expand Down Expand Up @@ -50,12 +47,10 @@ public function getConnection()

public function testEmptyPdoQuery()
{
try {
$test = $this->getConnection()->pdoQuery();
} catch (Exception $e) {
$this->assertEquals($e->getMessage(), 'SQLSTATE[42000]: Syntax error or access violation: 1065 Query was empty');
}
$this->expectException(\Exception::class);
$this->expectExceptionMessage('SQLSTATE[42000]: Syntax error or access violation: 1065 Query was empty');

$test = $this->getConnection()->pdoQuery();
}

}
4 changes: 2 additions & 2 deletions tests/QueryTest.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
namespace Dframe\Database\tests;

use PHPUnit_Framework_Constraint_IsType as PHPUnit_IsType;
use PHPUnit\Framework\Constraint\IsType as PHPUnitIsType;

use Dframe\Database\Database;
use Dframe\Database\Pdohelper;


class QueryTest extends \Dframe\Database\tests\TestSetUp
class QueryTest extends TestSetUp
{
public function setUp()
{
Expand Down
8 changes: 2 additions & 6 deletions tests/TestSetUp.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@
namespace Dframe\Database\tests;

use Dframe\Database\Database;
use PHPUnit\Framework\TestCase;

// backward compatibility
if (!class_exists('\PHPUnit\Framework\TestCase') and class_exists('\PHPUnit_Framework_TestCase')) {
class_alias('\PHPUnit_Framework_TestCase', '\PHPUnit\Framework\TestCase');
}

abstract class TestSetUp extends \PHPUnit\Framework\TestCase
abstract class TestSetUp extends TestCase
{

public function getConnection()
Expand Down