summaryrefslogtreecommitdiffstats
path: root/tests/mocks
diff options
context:
space:
mode:
Diffstat (limited to 'tests/mocks')
-rw-r--r--tests/mocks/ci_testcase.php18
-rw-r--r--tests/mocks/database/schema/skeleton.php10
2 files changed, 21 insertions, 7 deletions
diff --git a/tests/mocks/ci_testcase.php b/tests/mocks/ci_testcase.php
index 8dc4682ef..de46f6df6 100644
--- a/tests/mocks/ci_testcase.php
+++ b/tests/mocks/ci_testcase.php
@@ -1,6 +1,6 @@
<?php
-class CI_TestCase extends PHPUnit_Framework_TestCase {
+class CI_TestCase extends \PHPUnit\Framework\TestCase {
public $ci_vfs_root;
public $ci_app_root;
@@ -35,7 +35,7 @@ class CI_TestCase extends PHPUnit_Framework_TestCase {
public function setUp()
{
// Setup VFS with base directories
- $this->ci_vfs_root = vfsStream::setup();
+ $this->ci_vfs_root = vfsStream::setup('');
$this->ci_app_root = vfsStream::newDirectory('application')->at($this->ci_vfs_root);
$this->ci_base_root = vfsStream::newDirectory('system')->at($this->ci_vfs_root);
$this->ci_view_root = vfsStream::newDirectory('views')->at($this->ci_app_root);
@@ -381,4 +381,18 @@ class CI_TestCase extends PHPUnit_Framework_TestCase {
return parent::__call($method, $args);
}
+ public function setExpectedException($exception_class, $exception_message = '', $exception_code = null)
+ {
+ $use_expect_exception = method_exists($this, 'expectException');
+
+ if ($use_expect_exception)
+ {
+ $this->expectException($exception_class);
+ $exception_message !== '' && $this->expectExceptionMessage($exception_message);
+ }
+ else
+ {
+ parent::setExpectedException($exception_class, $exception_message, $exception_code);
+ }
+ }
}
diff --git a/tests/mocks/database/schema/skeleton.php b/tests/mocks/database/schema/skeleton.php
index 888236ff3..e2b6e7d0e 100644
--- a/tests/mocks/database/schema/skeleton.php
+++ b/tests/mocks/database/schema/skeleton.php
@@ -76,7 +76,7 @@ class Mock_Database_Schema_Skeleton {
)
));
self::$forge->add_key('id', TRUE);
- self::$forge->create_table('user', TRUE);
+ self::$forge->create_table('user', TRUE) OR show_error('Unable to create the `user` table');
// Job Table
self::$forge->add_field(array(
@@ -93,7 +93,7 @@ class Mock_Database_Schema_Skeleton {
)
));
self::$forge->add_key('id', TRUE);
- self::$forge->create_table('job', TRUE);
+ self::$forge->create_table('job', TRUE) OR show_error('Unable to create the `job` table');
// Misc Table
self::$forge->add_field(array(
@@ -110,7 +110,7 @@ class Mock_Database_Schema_Skeleton {
)
));
self::$forge->add_key('id', TRUE);
- self::$forge->create_table('misc', TRUE);
+ self::$forge->create_table('misc', TRUE) OR show_error('Unable to create the `misc` table');
}
/**
@@ -143,11 +143,11 @@ class Mock_Database_Schema_Skeleton {
foreach ($data as $table => $dummy_data)
{
- self::$db->truncate($table);
+ self::$db->truncate($table) OR show_error("Unable to truncate `{$table}` table");
foreach ($dummy_data as $single_dummy_data)
{
- self::$db->insert($table, $single_dummy_data);
+ self::$db->insert($table, $single_dummy_data) OR show_error("Unable to insert data into `{$table}` table");
}
}
}