Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/HuasoFoundries/phpPgAdmin6.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Figueroa <amenadiel@gmail.com>2020-10-16 13:14:40 +0300
committerFelipe Figueroa <amenadiel@gmail.com>2020-10-16 13:14:40 +0300
commit994a04ce3fa7308b3e1db488e36f426a8c8b1330 (patch)
treebba4e0af1cea5b8dfc940d8e38e77f1ed28f3071
parent0b442f70e69e7d9844ff1d666f1c31ba5ef575e1 (diff)
replace usage of subfolder constant
-rw-r--r--tests/_support/Helper/Unit.php28
-rw-r--r--tests/unit/ContainerTest.php10
-rw-r--r--tests/unit/DataEntitiesTest.php2
-rw-r--r--tests/unit/PublicSectionsTest.php2
-rw-r--r--tests/unit/TablesAndViewsTest.php2
-rw-r--r--tests/unit/UserEntitiesTest.php2
-rw-r--r--tests/unit/ViewTest.php2
7 files changed, 16 insertions, 32 deletions
diff --git a/tests/_support/Helper/Unit.php b/tests/_support/Helper/Unit.php
index 447192dd..dc44bc26 100644
--- a/tests/_support/Helper/Unit.php
+++ b/tests/_support/Helper/Unit.php
@@ -9,30 +9,19 @@ namespace Helper;
\defined('IN_TEST') || \define('IN_TEST', true);
use PHPPgAdmin\ContainerUtils;
-if (!\is_readable(ContainerUtils::BASE_PATH . '/src/lib.inc.php')) {
+
+$bootstrapfile= dirname(__DIR__,3) . '/src/lib.inc.php';
+if (!\is_readable($bootstrapfile)) {
die('lib.inc.php is not readable');
}
-\defined('IN_TEST') || \define('IN_TEST', true);
-require_once ContainerUtils::BASE_PATH . '/src/lib.inc.php';
+require_once $bootstrapfile;
// here you can define custom actions
// all public methods declared in helper class will be available in $I
class Unit extends \Codeception\Module
{
- /**
- * @var string
- */
- const BASE_PATH = ContainerUtils::BASE_PATH;
- /**
- * @var string
- */
- const SUBFOLDER = ContainerUtils::SUBFOLDER;
- /**
- * @var string
- */
- const DEBUGMODE = ContainerUtils::DEBUGMODE;
-
+
/**
* @var \PHPPgAdmin
*/
@@ -40,16 +29,13 @@ class Unit extends \Codeception\Module
private static $_conf;
- public static function getDir()
- {
- return self::DIRNAME;
- }
+
public static function getContainer()
{
//$conf = self::getConf();
if (!static::$_container) {
- self::$_container = ContainerUtils::getContainerInstance();
+ self::$_container = containerInstance();
}
//dump(PHP_SAPI);
diff --git a/tests/unit/ContainerTest.php b/tests/unit/ContainerTest.php
index 7f435d94..072dbdc7 100644
--- a/tests/unit/ContainerTest.php
+++ b/tests/unit/ContainerTest.php
@@ -20,8 +20,7 @@ class ContainerTest extends \Codeception\Test\Unit
public function testContainerValidity(): void
{
- $utils = $this->container['utils'];
- self::assertTrue(
+ self::assertTrue(
$this->container instanceof \Psr\Container\ContainerInterface,
'$container must be an instance of \Psr\Container\ContainerInterface'
);
@@ -29,9 +28,8 @@ class ContainerTest extends \Codeception\Test\Unit
public function testContainerUtils(): void
{
- $utils = $this->container['utils'];
- self::assertTrue(
- $this->container->utils instanceof \PHPPgAdmin\ContainerUtils,
+ self::assertTrue(
+ $this->container instanceof \PHPPgAdmin\ContainerUtils,
'$container->utils must be an instance of PHPPgAdmin\ContainerUtils'
);
}
@@ -56,7 +54,7 @@ class ContainerTest extends \Codeception\Test\Unit
{
$Helper = $this->getModule('\Helper\Unit');
$this->container = $Helper::getContainer();
- self::$BASE_PATH = $Helper::BASE_PATH;
+ self::$BASE_PATH = $this->container->BASE_PATH;
$this->container->misc->setNoDBConnection(true);
}
diff --git a/tests/unit/DataEntitiesTest.php b/tests/unit/DataEntitiesTest.php
index a16d5f7e..32449d65 100644
--- a/tests/unit/DataEntitiesTest.php
+++ b/tests/unit/DataEntitiesTest.php
@@ -63,7 +63,7 @@ class DataEntitiesTest extends \Codeception\Test\Unit
{
$Helper = $this->getModule('\Helper\Unit');
$this->container = $Helper::getContainer();
- self::$BASE_PATH = $Helper::BASE_PATH;
+ self::$BASE_PATH = self::$BASE_PATH = $this->container->BASE_PATH;;
$this->container->get('misc')->setNoDBConnection(true);
// Helper
// \Codeception\Util\Debug::debug('BASE_PATH is ' . \BASE_PATH);
diff --git a/tests/unit/PublicSectionsTest.php b/tests/unit/PublicSectionsTest.php
index 4a6bb7da..8621e801 100644
--- a/tests/unit/PublicSectionsTest.php
+++ b/tests/unit/PublicSectionsTest.php
@@ -133,7 +133,7 @@ class PublicSectionsTest extends \Codeception\Test\Unit
{
$Helper = $this->getModule('\Helper\Unit');
$this->container = $Helper::getContainer();
- self::$BASE_PATH = $Helper::BASE_PATH;
+ self::$BASE_PATH = self::$BASE_PATH = $this->container->BASE_PATH;;
$this->container->get('misc')->setNoDBConnection(true);
// Helper
//\Codeception\Util\Debug::debug('BASE_PATH is ' . \BASE_PATH);
diff --git a/tests/unit/TablesAndViewsTest.php b/tests/unit/TablesAndViewsTest.php
index 3d6004a9..983996e5 100644
--- a/tests/unit/TablesAndViewsTest.php
+++ b/tests/unit/TablesAndViewsTest.php
@@ -86,7 +86,7 @@ class TablesAndViewsTest extends \Codeception\Test\Unit
{
$Helper = $this->getModule('\Helper\Unit');
$this->container = $Helper::getContainer();
- self::$BASE_PATH = $Helper::BASE_PATH;
+ self::$BASE_PATH = self::$BASE_PATH = $this->container->BASE_PATH;;
$this->container->get('misc')->setNoDBConnection(true);
//\Codeception\Util\Debug::debug('BASE_PATH is ' . \BASE_PATH);
}
diff --git a/tests/unit/UserEntitiesTest.php b/tests/unit/UserEntitiesTest.php
index bd1345cc..19f17719 100644
--- a/tests/unit/UserEntitiesTest.php
+++ b/tests/unit/UserEntitiesTest.php
@@ -63,7 +63,7 @@ class UserEntitiesTest extends \Codeception\Test\Unit
{
$Helper = $this->getModule('\Helper\Unit');
$this->container = $Helper::getContainer();
- self::$BASE_PATH = $Helper::BASE_PATH;
+ self::$BASE_PATH = self::$BASE_PATH = $this->container->BASE_PATH;;
$this->container->get('misc')->setNoDBConnection(true);
// Helper
//\Codeception\Util\Debug::debug('BASE_PATH is ' . \BASE_PATH);
diff --git a/tests/unit/ViewTest.php b/tests/unit/ViewTest.php
index 77a473b9..48a61cb3 100644
--- a/tests/unit/ViewTest.php
+++ b/tests/unit/ViewTest.php
@@ -178,7 +178,7 @@ class ViewTest extends \Codeception\Test\Unit
{
$Helper = $this->getModule('\Helper\Unit');
$this->container = $Helper::getContainer();
- self::$BASE_PATH = $Helper::BASE_PATH;
+ self::$BASE_PATH = self::$BASE_PATH = $this->container->BASE_PATH;;
$this->container->get('misc')->setNoDBConnection(true);
// Helper
//\Codeception\Util\Debug::debug('BASE_PATH is ' . \BASE_PATH);