Page MenuHomeDevCentral

No OneTemporary

diff --git a/workspaces/tests/bootstrap.php b/workspaces/src/includes/autoload_vendor.php
similarity index 81%
rename from workspaces/tests/bootstrap.php
rename to workspaces/src/includes/autoload_vendor.php
index 4a9bd13..421a1d3 100644
--- a/workspaces/tests/bootstrap.php
+++ b/workspaces/src/includes/autoload_vendor.php
@@ -1,53 +1,50 @@
<?php
/* -------------------------------------------------------------
- Bootstrap tests for Obsidian Workspaces
+ Obsidian Workspaces :: Autoloader from vendor/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Project: Nasqueron
Product: Obsidian Workspaces
License: Trivial work, not eligible to copyright
------------------------------------------------------------- */
/* -------------------------------------------------------------
Search relevant vendor/ directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
const VENDOR_DIR_CANDIDATES = [
# Composer packages have been installed directly in workspaces/
- __DIR__ . "/../vendor",
-
- # Composer packages have been installed at monorepo root level
__DIR__ . "/../../vendor",
+ # Composer packages have been installed at monorepo root level
+ __DIR__ . "/../../../vendor",
];
function search_vendor_autoload () : string|null {
foreach (VENDOR_DIR_CANDIDATES as $dir) {
$autoload_path = $dir . "/autoload.php";
- echo "Candidate: $autoload_path\n";
-
if (file_exists($autoload_path)) {
return $autoload_path;
}
}
return null;
}
/* -------------------------------------------------------------
- Entry point for tests
+ Loader
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-function run() : void {
+function require_vendor_autoload() : void {
$vendor_autoload = search_vendor_autoload();
if ($vendor_autoload === null) {
- fwrite(STDERR, "Your first need to install dependencies. Run `composer install` before running tests.");
+ fwrite(STDERR, "You first need to install dependencies. Run `composer install`.");
die;
}
require($vendor_autoload);
}
-run();
+require_vendor_autoload();
diff --git a/workspaces/src/includes/core.php b/workspaces/src/includes/core.php
index 44fbd77..d178ba6 100755
--- a/workspaces/src/includes/core.php
+++ b/workspaces/src/includes/core.php
@@ -1,52 +1,52 @@
<?php
/**
* _, __, _, _ __, _ _, _, _
* / \ |_) (_ | | \ | /_\ |\ |
* \ / |_) , ) | |_/ | | | | \|
* ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
*
* Core global functions
*
* @package ObsidianWorkspaces
* @subpackage Keruald
* @author Sébastien Santoro aka Dereckson <dereckson@espace-win.org>
* @license http://www.opensource.org/licenses/bsd-license.php BSD
* @filesource
*
*/
-require_once(__DIR__ . "/../../vendor/autoload.php");
-
////////////////////////////////////////////////////////////////////////////////
/// ///
/// Configures PHP and loads site-wide used libraries ///
/// ///
////////////////////////////////////////////////////////////////////////////////
+require_once("autoload_vendor.php");
+
//Errors management
include_once("error.php");
error_reporting(E_ALL);
$minorRecoverableErrors = E_NOTICE | E_USER_NOTICE | E_DEPRECATED | E_USER_DEPRECATED;
set_error_handler('throwExceptionErrorHandler', E_ALL ^ $minorRecoverableErrors);
//Loads global functions
include_once("GlobalFunctions.php"); //Global functions
//Loads configuration
if (isset($_SERVER) && array_key_exists('OBSIDIAN_CONFIG', $_SERVER)) {
$configFile = $_SERVER['OBSIDIAN_CONFIG'];
if (file_exists($configFile)) {
include_once($configFile);
unset($configFile);
} else {
die("You've specified a custom configuration file path in the environment, but this file doesn't exist: $configFile");
}
} else {
include_once("config.php");
}
//Loads libraries
include_once("session.php"); //Sessions handler
include_once("autoload.php"); //Autoloader for needed classes
diff --git a/workspaces/tests/phpunit.xml b/workspaces/tests/phpunit.xml
index 07bd49a..e007f8f 100644
--- a/workspaces/tests/phpunit.xml
+++ b/workspaces/tests/phpunit.xml
@@ -1,28 +1,28 @@
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.4/phpunit.xsd"
- bootstrap="bootstrap.php"
+ bootstrap="../src/includes/autoload_vendor.php"
displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnPhpunitDeprecations="true"
>
<php>
<!-- MySQL -->
<const name="UNITTESTING_MYSQL_HOST" value="localhost" />
<const name="UNITTESTING_MYSQL_USERNAME" value="root" />
<const name="UNITTESTING_MYSQL_PASSWORD" value="" />
<const name="UNITTESTING_MYSQL_DATABASE" value="obsidian" />
<const name="UNITTESTING_MYSQL_TABLE" value="collections_unittesting" />
<!-- SQLite -->
<const name="UNITTESTING_SQLITE_FILE" value="/tmp/collections.db" />
<!-- MongoDB -->
<const name="UNITTESTING_MONGODB_HOST" value="localhost" />
<const name="UNITTESTING_MONGODB_PORT" value="27017" />
<const name="UNITTESTING_MONGODB_SSL" value="true" />
<!-- FilesCollection -->
<const name="UNITTESTING_FILESCOLLECTION_PATH" value="/tmp/obsidiancollections" />
</php>
</phpunit>

File Metadata

Mime Type
text/x-diff
Expires
Wed, Mar 18, 12:39 (20 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3539671
Default Alt Text
(5 KB)

Event Timeline