diff --git a/bin/flextype b/bin/flextype
index 5ca6f0f8..3ddd1a33 100755
--- a/bin/flextype
+++ b/bin/flextype
@@ -23,12 +23,12 @@ define('FLEXTYPE_START_TIME', microtime(true));
/**
* Define the PATH to the root directory (without trailing slash).
*/
-define('ROOT_DIR', str_replace(DIRECTORY_SEPARATOR, '/', getcwd()));
+define('FLEXTYPE_ROOT_DIR', str_replace(DIRECTORY_SEPARATOR, '/', getcwd()));
/**
* Ensure vendor libraries exist
*/
-! is_file($flextypeAutoload = ROOT_DIR . '/vendor/autoload.php') and exit('Please run: composer install for flextype');
+! is_file($flextypeAutoload = FLEXTYPE_ROOT_DIR . '/vendor/autoload.php') and exit('Please run: composer install for flextype');
/**
* Register The Auto Loader
@@ -49,4 +49,4 @@ $flextypeLoader = require_once $flextypeAutoload;
* the responses back to the browser and delight our users.
*/
-require_once ROOT_DIR . '/src/flextype/flextype.php';
\ No newline at end of file
+require_once FLEXTYPE_ROOT_DIR . '/src/flextype/flextype.php';
\ No newline at end of file
diff --git a/index.php b/index.php
index c38dbc50..0bbb40cb 100755
--- a/index.php
+++ b/index.php
@@ -29,7 +29,7 @@ define('FLEXTYPE_START_TIME', microtime(true));
/**
* Define the PATH to the root directory (without trailing slash).
*/
-define('ROOT_DIR', str_replace(DIRECTORY_SEPARATOR, '/', getcwd()));
+define('FLEXTYPE_ROOT_DIR', str_replace(DIRECTORY_SEPARATOR, '/', getcwd()));
/**
* Ensure vendor libraries exist
diff --git a/src/flextype/core/Console/Commands/AboutCommand.php b/src/flextype/core/Console/Commands/AboutCommand.php
index 7cd44c95..2bc7232e 100644
--- a/src/flextype/core/Console/Commands/AboutCommand.php
+++ b/src/flextype/core/Console/Commands/AboutCommand.php
@@ -52,7 +52,7 @@ class AboutCommand extends Command
hr('[b]Constants[/b]', 'my-1') .
div('[b][color=success]FLEXTYPE_PROJECT_NAME[/color][/b]: ' . FLEXTYPE_PROJECT_NAME, '') .
- div('[b][color=success]ROOT_DIR[/color][/b]: ' . ROOT_DIR, '') .
+ div('[b][color=success]FLEXTYPE_ROOT_DIR[/color][/b]: ' . FLEXTYPE_ROOT_DIR, '') .
div('[b][color=success]FLEXTYPE_PATH_PROJECT[/color][/b]: ' . FLEXTYPE_PATH_PROJECT, '') .
div('[b][color=success]FLEXTYPE_PATH_TMP[/color][/b]: ' . FLEXTYPE_PATH_TMP, '') .
div('[b][color=success]FLEXTYPE_MINIMUM_PHP[/color][/b]: ' . FLEXTYPE_MINIMUM_PHP, '') .
diff --git a/src/flextype/core/Entries/Entries.php b/src/flextype/core/Entries/Entries.php
index 37163c49..4c538756 100755
--- a/src/flextype/core/Entries/Entries.php
+++ b/src/flextype/core/Entries/Entries.php
@@ -124,8 +124,8 @@ class Entries
continue;
}
- if (filesystem()->file(ROOT_DIR . '/' . $value['path'])->exists()) {
- include_once ROOT_DIR . '/' . $value['path'];
+ if (filesystem()->file(FLEXTYPE_ROOT_DIR . '/' . $value['path'])->exists()) {
+ include_once FLEXTYPE_ROOT_DIR . '/' . $value['path'];
}
}
}
@@ -140,8 +140,8 @@ class Entries
public function initDirectives(array $directives): void
{
foreach ($directives as $key => $value) {
- if (filesystem()->file(ROOT_DIR . '/' . $value['path'])->exists()) {
- include_once ROOT_DIR . '/' . $value['path'];
+ if (filesystem()->file(FLEXTYPE_ROOT_DIR . '/' . $value['path'])->exists()) {
+ include_once FLEXTYPE_ROOT_DIR . '/' . $value['path'];
}
}
}
@@ -208,7 +208,7 @@ class Entries
continue;
}
- $events[] = ROOT_DIR . '/' . $event['path'];
+ $events[] = FLEXTYPE_ROOT_DIR . '/' . $event['path'];
}
}
@@ -249,7 +249,7 @@ class Entries
continue;
}
- $fields[] = ROOT_DIR . '/' . $field['path'];
+ $fields[] = FLEXTYPE_ROOT_DIR . '/' . $field['path'];
}
}
diff --git a/src/flextype/core/Entries/Fields/Default/CreatedAtField.php b/src/flextype/core/Entries/Fields/Default/CreatedAtField.php
index 9d346ef5..a675958d 100644
--- a/src/flextype/core/Entries/Fields/Default/CreatedAtField.php
+++ b/src/flextype/core/Entries/Fields/Default/CreatedAtField.php
@@ -25,7 +25,7 @@ emitter()->addListener('onEntriesFetchSingleHasResult', static function (): void
}
// Determine is the current field file path is the same.
- if (! strings(__FILE__)->replace(ROOT_DIR, '')->replaceFirst('/', '')->isEqual(entries()->registry()->get('methods.fetch.collection.fields.created_at.path'))) {
+ if (! strings(__FILE__)->replace(FLEXTYPE_ROOT_DIR, '')->replaceFirst('/', '')->isEqual(entries()->registry()->get('methods.fetch.collection.fields.created_at.path'))) {
return;
}
@@ -44,7 +44,7 @@ emitter()->addListener('onEntriesCreate', static function (): void {
}
// Determine is the current field file path is the same.
- if (! strings(__FILE__)->replace(ROOT_DIR, '')->isEqual(entries()->registry()->get('methods.create.collection.fields.created_at.path'))) {
+ if (! strings(__FILE__)->replace(FLEXTYPE_ROOT_DIR, '')->isEqual(entries()->registry()->get('methods.create.collection.fields.created_at.path'))) {
return;
}
diff --git a/src/flextype/core/Entries/Fields/Default/CreatedByField.php b/src/flextype/core/Entries/Fields/Default/CreatedByField.php
index f4a0ad5e..03b9d0fe 100644
--- a/src/flextype/core/Entries/Fields/Default/CreatedByField.php
+++ b/src/flextype/core/Entries/Fields/Default/CreatedByField.php
@@ -24,7 +24,7 @@ emitter()->addListener('onEntriesCreate', static function (): void {
}
// Determine is the current field file path is the same.
- if (! strings(__FILE__)->replace(ROOT_DIR, '')->replaceFirst('/', '')->isEqual(entries()->registry()->get('methods.create.collection.fields.created_by.path'))) {
+ if (! strings(__FILE__)->replace(FLEXTYPE_ROOT_DIR, '')->replaceFirst('/', '')->isEqual(entries()->registry()->get('methods.create.collection.fields.created_by.path'))) {
return;
}
diff --git a/src/flextype/core/Entries/Fields/Default/IdField.php b/src/flextype/core/Entries/Fields/Default/IdField.php
index a6aa42cd..d416a942 100644
--- a/src/flextype/core/Entries/Fields/Default/IdField.php
+++ b/src/flextype/core/Entries/Fields/Default/IdField.php
@@ -24,7 +24,7 @@ emitter()->addListener('onEntriesFetchSingleHasResult', static function (): void
}
// Determine is the current field file path is the same.
- if (! strings(__FILE__)->replace(ROOT_DIR, '')->replaceFirst('/', '')->isEqual(entries()->registry()->get('methods.fetch.collection.fields.id.path'))) {
+ if (! strings(__FILE__)->replace(FLEXTYPE_ROOT_DIR, '')->replaceFirst('/', '')->isEqual(entries()->registry()->get('methods.fetch.collection.fields.id.path'))) {
return;
}
diff --git a/src/flextype/core/Entries/Fields/Default/ModifiedAtField.php b/src/flextype/core/Entries/Fields/Default/ModifiedAtField.php
index 3d9f04bd..b13a6f5d 100644
--- a/src/flextype/core/Entries/Fields/Default/ModifiedAtField.php
+++ b/src/flextype/core/Entries/Fields/Default/ModifiedAtField.php
@@ -25,7 +25,7 @@ emitter()->addListener('onEntriesFetchSingleHasResult', static function (): void
}
// Determine is the current field file path is the same.
- if (! strings(__FILE__)->replace(ROOT_DIR, '')->replaceFirst('/', '')->isEqual(entries()->registry()->get('methods.fetch.collection.fields.modified_at.path'))) {
+ if (! strings(__FILE__)->replace(FLEXTYPE_ROOT_DIR, '')->replaceFirst('/', '')->isEqual(entries()->registry()->get('methods.fetch.collection.fields.modified_at.path'))) {
return;
}
diff --git a/src/flextype/core/Entries/Fields/Default/PublishedAtField.php b/src/flextype/core/Entries/Fields/Default/PublishedAtField.php
index 31d46cb9..ccf3a3d6 100644
--- a/src/flextype/core/Entries/Fields/Default/PublishedAtField.php
+++ b/src/flextype/core/Entries/Fields/Default/PublishedAtField.php
@@ -25,7 +25,7 @@ emitter()->addListener('onEntriesFetchSingleHasResult', static function (): void
}
// Determine is the current field file path is the same.
- if (! strings(__FILE__)->replace(ROOT_DIR, '')->replaceFirst('/', '')->isEqual(entries()->registry()->get('methods.fetch.collection.fields.published_at.path'))) {
+ if (! strings(__FILE__)->replace(FLEXTYPE_ROOT_DIR, '')->replaceFirst('/', '')->isEqual(entries()->registry()->get('methods.fetch.collection.fields.published_at.path'))) {
return;
}
@@ -44,7 +44,7 @@ emitter()->addListener('onEntriesCreate', static function (): void {
}
// Determine is the current field file path is the same.
- if (! strings(__FILE__)->replace(ROOT_DIR, '')->isEqual(entries()->registry()->get('methods.create.collection.fields.published_at.path'))) {
+ if (! strings(__FILE__)->replace(FLEXTYPE_ROOT_DIR, '')->isEqual(entries()->registry()->get('methods.create.collection.fields.published_at.path'))) {
return;
}
diff --git a/src/flextype/core/Entries/Fields/Default/PublishedByField.php b/src/flextype/core/Entries/Fields/Default/PublishedByField.php
index 4a9fe2fe..24617ac2 100644
--- a/src/flextype/core/Entries/Fields/Default/PublishedByField.php
+++ b/src/flextype/core/Entries/Fields/Default/PublishedByField.php
@@ -24,7 +24,7 @@ emitter()->addListener('onEntriesCreate', static function (): void {
}
// Determine is the current field file path is the same.
- if (! strings(__FILE__)->replace(ROOT_DIR, '')->replaceFirst('/', '')->isEqual(entries()->registry()->get('methods.create.collection.fields.published_by.path'))) {
+ if (! strings(__FILE__)->replace(FLEXTYPE_ROOT_DIR, '')->replaceFirst('/', '')->isEqual(entries()->registry()->get('methods.create.collection.fields.published_by.path'))) {
return;
}
diff --git a/src/flextype/core/Entries/Fields/Default/RoutableField.php b/src/flextype/core/Entries/Fields/Default/RoutableField.php
index b5e9ed1f..09ad5127 100644
--- a/src/flextype/core/Entries/Fields/Default/RoutableField.php
+++ b/src/flextype/core/Entries/Fields/Default/RoutableField.php
@@ -24,7 +24,7 @@ emitter()->addListener('onEntriesFetchSingleHasResult', static function (): void
}
// Determine is the current field file path is the same.
- if (! strings(__FILE__)->replace(ROOT_DIR, '')->replaceFirst('/', '')->isEqual(entries()->registry()->get('methods.fetch.collection.fields.routable.path'))) {
+ if (! strings(__FILE__)->replace(FLEXTYPE_ROOT_DIR, '')->replaceFirst('/', '')->isEqual(entries()->registry()->get('methods.fetch.collection.fields.routable.path'))) {
return;
}
@@ -44,7 +44,7 @@ emitter()->addListener('onEntriesCreate', static function (): void {
}
// Determine is the current field file path is the same.
- if (! strings(__FILE__)->replace(ROOT_DIR, '')->isEqual(entries()->registry()->get('methods.create.collection.fields.routable.path'))) {
+ if (! strings(__FILE__)->replace(FLEXTYPE_ROOT_DIR, '')->isEqual(entries()->registry()->get('methods.create.collection.fields.routable.path'))) {
return;
}
diff --git a/src/flextype/core/Entries/Fields/Default/SlugField.php b/src/flextype/core/Entries/Fields/Default/SlugField.php
index 3997747d..39c90d74 100644
--- a/src/flextype/core/Entries/Fields/Default/SlugField.php
+++ b/src/flextype/core/Entries/Fields/Default/SlugField.php
@@ -24,7 +24,7 @@ emitter()->addListener('onEntriesFetchSingleHasResult', static function (): void
}
// Determine is the current field file path is the same.
- if (! strings(__FILE__)->replace(ROOT_DIR, '')->replaceFirst('/', '')->isEqual(entries()->registry()->get('methods.fetch.collection.fields.slug.path'))) {
+ if (! strings(__FILE__)->replace(FLEXTYPE_ROOT_DIR, '')->replaceFirst('/', '')->isEqual(entries()->registry()->get('methods.fetch.collection.fields.slug.path'))) {
return;
}
diff --git a/src/flextype/core/Entries/Fields/Default/UuidField.php b/src/flextype/core/Entries/Fields/Default/UuidField.php
index ea90ac76..a8f54074 100644
--- a/src/flextype/core/Entries/Fields/Default/UuidField.php
+++ b/src/flextype/core/Entries/Fields/Default/UuidField.php
@@ -25,7 +25,7 @@ emitter()->addListener('onEntriesCreate', static function (): void {
}
// Determine is the current field file path is the same.
- if (! strings(__FILE__)->replace(ROOT_DIR, '')->replaceFirst('/', '')->isEqual(entries()->registry()->get('methods.create.collection.fields.uuid.path'))) {
+ if (! strings(__FILE__)->replace(FLEXTYPE_ROOT_DIR, '')->replaceFirst('/', '')->isEqual(entries()->registry()->get('methods.create.collection.fields.uuid.path'))) {
return;
}
diff --git a/src/flextype/core/Entries/Fields/Default/VisibilityField.php b/src/flextype/core/Entries/Fields/Default/VisibilityField.php
index 70830ba5..a7231379 100644
--- a/src/flextype/core/Entries/Fields/Default/VisibilityField.php
+++ b/src/flextype/core/Entries/Fields/Default/VisibilityField.php
@@ -24,7 +24,7 @@ emitter()->addListener('onEntriesFetchSingleHasResult', static function (): void
}
// Determine is the current field file path is the same.
- if (! strings(__FILE__)->replace(ROOT_DIR, '')->replaceFirst('/', '')->isEqual(entries()->registry()->get('methods.fetch.collection.fields.visibility.path'))) {
+ if (! strings(__FILE__)->replace(FLEXTYPE_ROOT_DIR, '')->replaceFirst('/', '')->isEqual(entries()->registry()->get('methods.fetch.collection.fields.visibility.path'))) {
return;
}
@@ -49,7 +49,7 @@ emitter()->addListener('onEntriesCreate', static function (): void {
}
// Determine is the current field file path is the same.
- if (! strings(__FILE__)->replace(ROOT_DIR, '')->isEqual(entries()->registry()->get('methods.create.collection.fields.visibility.path'))) {
+ if (! strings(__FILE__)->replace(FLEXTYPE_ROOT_DIR, '')->isEqual(entries()->registry()->get('methods.create.collection.fields.visibility.path'))) {
return;
}
diff --git a/src/flextype/core/Entries/Fields/Tokens/Items/CallsField.php b/src/flextype/core/Entries/Fields/Tokens/Items/CallsField.php
index ad7a9706..b7562a5b 100644
--- a/src/flextype/core/Entries/Fields/Tokens/Items/CallsField.php
+++ b/src/flextype/core/Entries/Fields/Tokens/Items/CallsField.php
@@ -24,7 +24,7 @@ emitter()->addListener('onEntriesCreate', static function (): void {
}
// Determine is the current field file path is the same.
- if (! strings(__FILE__)->replace(ROOT_DIR, '')->replaceFirst('/', '')->isEqual(entries()->registry()->get('methods.create.collection.fields.calls.path'))) {
+ if (! strings(__FILE__)->replace(FLEXTYPE_ROOT_DIR, '')->replaceFirst('/', '')->isEqual(entries()->registry()->get('methods.create.collection.fields.calls.path'))) {
return;
}
diff --git a/src/flextype/core/Entries/Fields/Tokens/Items/IdField.php b/src/flextype/core/Entries/Fields/Tokens/Items/IdField.php
index 7e40cb8a..2a61f8ef 100644
--- a/src/flextype/core/Entries/Fields/Tokens/Items/IdField.php
+++ b/src/flextype/core/Entries/Fields/Tokens/Items/IdField.php
@@ -24,7 +24,7 @@ emitter()->addListener('onEntriesFetchSingleHasResult', static function (): void
}
// Determine is the current field file path is the same.
- if (! strings(__FILE__)->replace(ROOT_DIR, '')->replaceFirst('/', '')->isEqual(entries()->registry()->get('methods.fetch.collection.fields.id.path'))) {
+ if (! strings(__FILE__)->replace(FLEXTYPE_ROOT_DIR, '')->replaceFirst('/', '')->isEqual(entries()->registry()->get('methods.fetch.collection.fields.id.path'))) {
return;
}
diff --git a/src/flextype/core/Entries/Fields/Tokens/Items/LimitCallsField.php b/src/flextype/core/Entries/Fields/Tokens/Items/LimitCallsField.php
index 2b195f68..8eb63018 100644
--- a/src/flextype/core/Entries/Fields/Tokens/Items/LimitCallsField.php
+++ b/src/flextype/core/Entries/Fields/Tokens/Items/LimitCallsField.php
@@ -24,7 +24,7 @@ emitter()->addListener('onEntriesCreate', static function (): void {
}
// Determine is the current field file path is the same.
- if (! strings(__FILE__)->replace(ROOT_DIR, '')->replaceFirst('/', '')->isEqual(entries()->registry()->get('methods.create.collection.fields.limit_calls.path'))) {
+ if (! strings(__FILE__)->replace(FLEXTYPE_ROOT_DIR, '')->replaceFirst('/', '')->isEqual(entries()->registry()->get('methods.create.collection.fields.limit_calls.path'))) {
return;
}
diff --git a/src/flextype/core/Entries/Fields/Tokens/Items/StateField.php b/src/flextype/core/Entries/Fields/Tokens/Items/StateField.php
index 3534ed53..796e7a55 100644
--- a/src/flextype/core/Entries/Fields/Tokens/Items/StateField.php
+++ b/src/flextype/core/Entries/Fields/Tokens/Items/StateField.php
@@ -24,7 +24,7 @@ emitter()->addListener('onEntriesCreate', static function (): void {
}
// Determine is the current field file path is the same.
- if (! strings(__FILE__)->replace(ROOT_DIR, '')->replaceFirst('/', '')->isEqual(entries()->registry()->get('methods.create.collection.fields.state.path'))) {
+ if (! strings(__FILE__)->replace(FLEXTYPE_ROOT_DIR, '')->replaceFirst('/', '')->isEqual(entries()->registry()->get('methods.create.collection.fields.state.path'))) {
return;
}
diff --git a/src/flextype/core/Parsers/Shortcodes.php b/src/flextype/core/Parsers/Shortcodes.php
index f7d43177..098ca82a 100644
--- a/src/flextype/core/Parsers/Shortcodes.php
+++ b/src/flextype/core/Parsers/Shortcodes.php
@@ -117,11 +117,11 @@ final class Shortcodes
continue;
}
- if (! file_exists(ROOT_DIR . '/' . $shortcode['path'])) {
+ if (! file_exists(FLEXTYPE_ROOT_DIR . '/' . $shortcode['path'])) {
continue;
}
- include_once ROOT_DIR . '/' . $shortcode['path'];
+ include_once FLEXTYPE_ROOT_DIR . '/' . $shortcode['path'];
}
}
diff --git a/src/flextype/core/Plugins.php b/src/flextype/core/Plugins.php
index 5c372aa8..198f2b6e 100755
--- a/src/flextype/core/Plugins.php
+++ b/src/flextype/core/Plugins.php
@@ -50,7 +50,7 @@ class Plugins
*/
public function __construct()
{
- $this->locales = serializers()->yaml()->decode(filesystem()->file(ROOT_DIR . '/src/flextype/locales.yaml')->get());
+ $this->locales = serializers()->yaml()->decode(filesystem()->file(FLEXTYPE_ROOT_DIR . '/src/flextype/locales.yaml')->get());
$this->init();
}
diff --git a/src/flextype/defines.php b/src/flextype/defines.php
index e41f8d88..da413332 100644
--- a/src/flextype/defines.php
+++ b/src/flextype/defines.php
@@ -34,12 +34,12 @@ if (! defined('FLEXTYPE_PATH_PROJECT')) {
/**
* Define the project path (without trailing slash).
*/
- define('FLEXTYPE_PATH_PROJECT', ROOT_DIR . '/' . FLEXTYPE_PROJECT_NAME);
+ define('FLEXTYPE_PATH_PROJECT', FLEXTYPE_ROOT_DIR . '/' . FLEXTYPE_PROJECT_NAME);
}
if (! defined('FLEXTYPE_PATH_TMP')) {
/**
* Define the project tmp path (without trailing slash).
*/
- define('FLEXTYPE_PATH_TMP', ROOT_DIR . '/var/tmp');
+ define('FLEXTYPE_PATH_TMP', FLEXTYPE_ROOT_DIR . '/var/tmp');
}
\ No newline at end of file
diff --git a/src/flextype/flextype.php b/src/flextype/flextype.php
index af567f35..e8b4473f 100644
--- a/src/flextype/flextype.php
+++ b/src/flextype/flextype.php
@@ -85,7 +85,7 @@ use const DIRECTORY_SEPARATOR;
use const PHP_VERSION;
// Get defines.
-require_once ROOT_DIR . '/src/flextype/defines.php';
+require_once FLEXTYPE_ROOT_DIR . '/src/flextype/defines.php';
// Check PHP Version
version_compare($ver = PHP_VERSION, $req = FLEXTYPE_MINIMUM_PHP, '<') and exit(sprintf('You are running PHP %s, but Flextype needs at least PHP %s to run.', $ver, $req));
@@ -104,8 +104,8 @@ container()->set('registry', registry());
container()->set('actions', Actions::getInstance());
// Init Flextype config (manifest and settings)
-$flextypeManifestFilePath = ROOT_DIR . '/src/flextype/flextype.yaml';
-$defaultFlextypeSettingsFilePath = ROOT_DIR . '/src/flextype/settings.yaml';
+$flextypeManifestFilePath = FLEXTYPE_ROOT_DIR . '/src/flextype/flextype.yaml';
+$defaultFlextypeSettingsFilePath = FLEXTYPE_ROOT_DIR . '/src/flextype/settings.yaml';
$customFlextypeSettingsFilePath = FLEXTYPE_PATH_PROJECT . '/config/flextype/settings.yaml';
$preflightFlextypePath = FLEXTYPE_PATH_TMP . '/config/flextype/';
$customFlextypeSettingsPath = FLEXTYPE_PATH_PROJECT . '/config/flextype/';
@@ -359,16 +359,16 @@ View::setDirectory(FLEXTYPE_PATH_PROJECT);
View::setExtension(registry()->get('flextype.settings.view.extension'));
// Add bootstrap file before plugins intialization.
-require_once ROOT_DIR . '/src/flextype/bootstrap/before-plugins.php';
+require_once FLEXTYPE_ROOT_DIR . '/src/flextype/bootstrap/before-plugins.php';
// Add Plugins Service
container()->set('plugins', new Plugins());
// Add bootstrap file before plugins intialization.
-require_once ROOT_DIR . '/src/flextype/bootstrap/after-plugins.php';
+require_once FLEXTYPE_ROOT_DIR . '/src/flextype/bootstrap/after-plugins.php';
// Add Routes file.
-require_once ROOT_DIR . '/src/flextype/routes/routes.php';
+require_once FLEXTYPE_ROOT_DIR . '/src/flextype/routes/routes.php';
// Enable lazy CORS
//
diff --git a/tests/Pest.php b/tests/Pest.php
index 23d7f18e..9b672b4f 100644
--- a/tests/Pest.php
+++ b/tests/Pest.php
@@ -6,7 +6,7 @@ namespace Flextype;
use function Glowy\Filesystem\filesystem;
-define('ROOT_DIR', str_replace(DIRECTORY_SEPARATOR, '/', getcwd()));
+define('FLEXTYPE_ROOT_DIR', str_replace(DIRECTORY_SEPARATOR, '/', getcwd()));
/**
* Define the project name.
@@ -16,15 +16,15 @@ define('FLEXTYPE_PROJECT_NAME', 'project');
/**
* Define the PATH (without trailing slash).
*/
-define('FLEXTYPE_PATH_PROJECT', ROOT_DIR . '/' . FLEXTYPE_PROJECT_NAME);
-define('FLEXTYPE_PATH_TMP', ROOT_DIR . '/var/tmp');
+define('FLEXTYPE_PATH_PROJECT', FLEXTYPE_ROOT_DIR . '/' . FLEXTYPE_PROJECT_NAME);
+define('FLEXTYPE_PATH_TMP', FLEXTYPE_ROOT_DIR . '/var/tmp');
-! is_file($flextype_autoload = ROOT_DIR . '/vendor/autoload.php') and exit('Please run: composer install for flextype');
+! is_file($flextype_autoload = FLEXTYPE_ROOT_DIR . '/vendor/autoload.php') and exit('Please run: composer install for flextype');
$flextype_loader = require_once $flextype_autoload;
filesystem()->directory(FLEXTYPE_PATH_TMP)->exists() and filesystem()->directory(FLEXTYPE_PATH_TMP)->delete();
-filesystem()->directory(ROOT_DIR . '/project/config/flextype/')->ensureExists(0755, true);
-filesystem()->file(ROOT_DIR . '/tests/fixtures/settings/settings.yaml')->copy(ROOT_DIR . '/project/config/flextype/settings.yaml');
+filesystem()->directory(FLEXTYPE_ROOT_DIR . '/project/config/flextype/')->ensureExists(0755, true);
+filesystem()->file(FLEXTYPE_ROOT_DIR . '/tests/fixtures/settings/settings.yaml')->copy(FLEXTYPE_ROOT_DIR . '/project/config/flextype/settings.yaml');
-include ROOT_DIR . '/src/flextype/flextype.php';
\ No newline at end of file
+include FLEXTYPE_ROOT_DIR . '/src/flextype/flextype.php';
\ No newline at end of file
diff --git a/tests/src/flextype/core/Entries/Macros/EntriesMacrosTest.php b/tests/src/flextype/core/Entries/Macros/EntriesMacrosTest.php
index 6151dfca..1a63ed52 100644
--- a/tests/src/flextype/core/Entries/Macros/EntriesMacrosTest.php
+++ b/tests/src/flextype/core/Entries/Macros/EntriesMacrosTest.php
@@ -13,9 +13,9 @@ afterEach(function (): void {
});
test('EntriesMacros for blog', function () {
- entries()->create('blog', serializers()->yaml()->decode(filesystem()->file(ROOT_DIR . '/tests/fixtures/entries/blog/blog.yaml')->get()));
- entries()->create('blog/post-1', serializers()->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/fixtures/entries/blog/post-1/post.md')->get()));
- entries()->create('blog/post-2', serializers()->frontmatter()->decode(filesystem()->file(ROOT_DIR . '/tests/fixtures/entries/blog/post-2/post.md')->get()));
+ entries()->create('blog', serializers()->yaml()->decode(filesystem()->file(FLEXTYPE_ROOT_DIR . '/tests/fixtures/entries/blog/blog.yaml')->get()));
+ entries()->create('blog/post-1', serializers()->frontmatter()->decode(filesystem()->file(FLEXTYPE_ROOT_DIR . '/tests/fixtures/entries/blog/post-1/post.md')->get()));
+ entries()->create('blog/post-2', serializers()->frontmatter()->decode(filesystem()->file(FLEXTYPE_ROOT_DIR . '/tests/fixtures/entries/blog/post-2/post.md')->get()));
$blog = entries()->fetch('blog');
$posts = entries()->fetch('blog', ['collection' => true]);
@@ -26,8 +26,8 @@ test('EntriesMacros for blog', function () {
test('EntriesMacros for shop', function() {
filesystem()
- ->directory(ROOT_DIR . '/tests/fixtures/entries/shop')
- ->copy(ROOT_DIR . '/project/entries/shop');
+ ->directory(FLEXTYPE_ROOT_DIR . '/tests/fixtures/entries/shop')
+ ->copy(FLEXTYPE_ROOT_DIR . '/project/entries/shop');
$shop = entries()->fetch('shop');
@@ -40,10 +40,10 @@ test('EntriesMacros for shop', function() {
test('EntriesMacros for catalog', function () {
// Create catalog
- entries()->create('catalog', serializers()->yaml()->decode(filesystem()->file(ROOT_DIR . '/tests/fixtures/entries/catalog/entry.yaml')->get()));
- entries()->create('catalog/bikes', serializers()->yaml()->decode(filesystem()->file(ROOT_DIR . '/tests/fixtures/entries/catalog/bikes/entry.yaml')->get()));
- entries()->create('catalog/bikes/gt', serializers()->yaml()->decode(filesystem()->file(ROOT_DIR . '/tests/fixtures/entries/catalog/bikes/gt/entry.yaml')->get()));
- entries()->create('catalog/bikes/norco', serializers()->yaml()->decode(filesystem()->file(ROOT_DIR . '/tests/fixtures/entries/catalog/bikes/norco/entry.yaml')->get()));
+ entries()->create('catalog', serializers()->yaml()->decode(filesystem()->file(FLEXTYPE_ROOT_DIR . '/tests/fixtures/entries/catalog/entry.yaml')->get()));
+ entries()->create('catalog/bikes', serializers()->yaml()->decode(filesystem()->file(FLEXTYPE_ROOT_DIR . '/tests/fixtures/entries/catalog/bikes/entry.yaml')->get()));
+ entries()->create('catalog/bikes/gt', serializers()->yaml()->decode(filesystem()->file(FLEXTYPE_ROOT_DIR . '/tests/fixtures/entries/catalog/bikes/gt/entry.yaml')->get()));
+ entries()->create('catalog/bikes/norco', serializers()->yaml()->decode(filesystem()->file(FLEXTYPE_ROOT_DIR . '/tests/fixtures/entries/catalog/bikes/norco/entry.yaml')->get()));
entries()->create('catalog/bikes/foo', ['title' => 'foo']);
entries()->create('catalog/bikes/foo/bar', ['title' => 'bar']);
@@ -81,11 +81,11 @@ test('EntriesMacros for catalog', function () {
});
test('EntriesMacros for albmus', function () {
- entries()->create('root', serializers()->yaml()->decode(filesystem()->file(ROOT_DIR . '/tests/fixtures/entries/root/entry.yaml')->get()));
+ entries()->create('root', serializers()->yaml()->decode(filesystem()->file(FLEXTYPE_ROOT_DIR . '/tests/fixtures/entries/root/entry.yaml')->get()));
- entries()->create('albums', serializers()->yaml()->decode(filesystem()->file(ROOT_DIR . '/tests/fixtures/entries/root/albums/entry.yaml')->get()));
- entries()->create('albums/category-1', serializers()->yaml()->decode(filesystem()->file(ROOT_DIR . '/tests/fixtures/entries/root/albums/category-1/entry.yaml')->get()));
- entries()->create('albums/category-1/album-1', serializers()->yaml()->decode(filesystem()->file(ROOT_DIR . '/tests/fixtures/entries/root/albums/category-1/album-1/entry.yaml')->get()));
+ entries()->create('albums', serializers()->yaml()->decode(filesystem()->file(FLEXTYPE_ROOT_DIR . '/tests/fixtures/entries/root/albums/entry.yaml')->get()));
+ entries()->create('albums/category-1', serializers()->yaml()->decode(filesystem()->file(FLEXTYPE_ROOT_DIR . '/tests/fixtures/entries/root/albums/category-1/entry.yaml')->get()));
+ entries()->create('albums/category-1/album-1', serializers()->yaml()->decode(filesystem()->file(FLEXTYPE_ROOT_DIR . '/tests/fixtures/entries/root/albums/category-1/album-1/entry.yaml')->get()));
entries()->create('banners', ['title' => 'Banners']);
entries()->create('banners/1', ['title' => 'Banner1']);
@@ -97,10 +97,10 @@ test('EntriesMacros for albmus', function () {
});
test('EntriesMacros for long nested entries', function () {
- entries()->create('level1', serializers()->yaml()->decode(filesystem()->file(ROOT_DIR . '/tests/fixtures/entries/level1/entry.yaml')->get()));
- entries()->create('level1/level2', serializers()->yaml()->decode(filesystem()->file(ROOT_DIR . '/tests/fixtures/entries/level1/level2/entry.yaml')->get()));
- entries()->create('level1/level2/level3', serializers()->yaml()->decode(filesystem()->file(ROOT_DIR . '/tests/fixtures/entries/level1/level2/level3/entry.yaml')->get()));
- entries()->create('level1/level2/level3/level4', serializers()->yaml()->decode(filesystem()->file(ROOT_DIR . '/tests/fixtures/entries/level1/level2/level3/level4/entry.yaml')->get()));
+ entries()->create('level1', serializers()->yaml()->decode(filesystem()->file(FLEXTYPE_ROOT_DIR . '/tests/fixtures/entries/level1/entry.yaml')->get()));
+ entries()->create('level1/level2', serializers()->yaml()->decode(filesystem()->file(FLEXTYPE_ROOT_DIR . '/tests/fixtures/entries/level1/level2/entry.yaml')->get()));
+ entries()->create('level1/level2/level3', serializers()->yaml()->decode(filesystem()->file(FLEXTYPE_ROOT_DIR . '/tests/fixtures/entries/level1/level2/level3/entry.yaml')->get()));
+ entries()->create('level1/level2/level3/level4', serializers()->yaml()->decode(filesystem()->file(FLEXTYPE_ROOT_DIR . '/tests/fixtures/entries/level1/level2/level3/level4/entry.yaml')->get()));
$level = entries()->fetch('level1');
diff --git a/tests/src/flextype/core/Entries/Macros/PhpMacrosTest.php b/tests/src/flextype/core/Entries/Macros/PhpMacrosTest.php
index 73d211d5..edbad69d 100644
--- a/tests/src/flextype/core/Entries/Macros/PhpMacrosTest.php
+++ b/tests/src/flextype/core/Entries/Macros/PhpMacrosTest.php
@@ -13,7 +13,7 @@ afterEach(function (): void {
});
test('PhpMacros', function () {
- entries()->create('blog', serializers()->yaml()->decode(filesystem()->file(ROOT_DIR . '/tests/fixtures/entries/blog-php-macros/entry.yaml')->get()));
+ entries()->create('blog', serializers()->yaml()->decode(filesystem()->file(FLEXTYPE_ROOT_DIR . '/tests/fixtures/entries/blog-php-macros/entry.yaml')->get()));
$this->assertTrue(entries()->create('blog/post-1', ['title' => 'Post 1']));
$this->assertTrue(entries()->create('blog/post-2', ['title' => 'Post 2']));
$this->assertTrue(entries()->create('blog/post-3', ['title' => 'Post 3']));
diff --git a/tests/src/flextype/core/Entries/Macros/RegistryMacrosTest.php b/tests/src/flextype/core/Entries/Macros/RegistryMacrosTest.php
index 2006bbb9..cbd96791 100644
--- a/tests/src/flextype/core/Entries/Macros/RegistryMacrosTest.php
+++ b/tests/src/flextype/core/Entries/Macros/RegistryMacrosTest.php
@@ -13,9 +13,9 @@ afterEach(function (): void {
});
test('RegistryMacros', function () {
- entries()->create('registry-root', serializers()->yaml()->decode(filesystem()->file(ROOT_DIR . '/tests/fixtures/entries/registry-root/entry.yaml')->get()));
- entries()->create('registry-root/level-1', serializers()->yaml()->decode(filesystem()->file(ROOT_DIR . '/tests/fixtures/entries/registry-root/level-1/entry.yaml')->get()));
- entries()->create('registry-root/level-1/level-2', serializers()->yaml()->decode(filesystem()->file(ROOT_DIR . '/tests/fixtures/entries/registry-root/level-1/level-2/entry.yaml')->get()));
+ entries()->create('registry-root', serializers()->yaml()->decode(filesystem()->file(FLEXTYPE_ROOT_DIR . '/tests/fixtures/entries/registry-root/entry.yaml')->get()));
+ entries()->create('registry-root/level-1', serializers()->yaml()->decode(filesystem()->file(FLEXTYPE_ROOT_DIR . '/tests/fixtures/entries/registry-root/level-1/entry.yaml')->get()));
+ entries()->create('registry-root/level-1/level-2', serializers()->yaml()->decode(filesystem()->file(FLEXTYPE_ROOT_DIR . '/tests/fixtures/entries/registry-root/level-1/level-2/entry.yaml')->get()));
$data = entries()->fetch('registry-root');
diff --git a/tests/src/flextype/core/Serializers/FrontmatterTest.php b/tests/src/flextype/core/Serializers/FrontmatterTest.php
index dc09bd42..6278bb66 100644
--- a/tests/src/flextype/core/Serializers/FrontmatterTest.php
+++ b/tests/src/flextype/core/Serializers/FrontmatterTest.php
@@ -5,7 +5,7 @@ declare(strict_types=1);
use function Glowy\Filesystem\filesystem;
test('encode', function () {
- $string = filesystem()->file(ROOT_DIR . '/tests/fixtures/serializers/frontmatter.md')->get();
+ $string = filesystem()->file(FLEXTYPE_ROOT_DIR . '/tests/fixtures/serializers/frontmatter.md')->get();
$this->assertEquals($string,
serializers()->frontmatter()
->encode(['title' => 'Foo',
@@ -17,31 +17,31 @@ test('decode', function () {
$this->assertEquals(['title' => 'Foo',
'content' => 'Content is here.'],
serializers()->frontmatter()
- ->decode($string = filesystem()->file(ROOT_DIR . '/tests/fixtures/serializers/frontmatter.md')->get()));
+ ->decode($string = filesystem()->file(FLEXTYPE_ROOT_DIR . '/tests/fixtures/serializers/frontmatter.md')->get()));
$this->assertEquals(['title' => 'Frontmatter YAML',
'content' => 'Content is here.'],
serializers()->frontmatter()
- ->decode($string = filesystem()->file(ROOT_DIR . '/tests/fixtures/serializers/frontmatter-yaml.md')->get()));
+ ->decode($string = filesystem()->file(FLEXTYPE_ROOT_DIR . '/tests/fixtures/serializers/frontmatter-yaml.md')->get()));
$this->assertEquals(['title' => 'Frontmatter JSON',
'content' => 'Content is here.'],
serializers()->frontmatter()
- ->decode($string = filesystem()->file(ROOT_DIR . '/tests/fixtures/serializers/frontmatter-json.md')->get()));
+ ->decode($string = filesystem()->file(FLEXTYPE_ROOT_DIR . '/tests/fixtures/serializers/frontmatter-json.md')->get()));
$this->assertEquals(['title' => 'Frontmatter JSON5',
'content' => 'Content is here.'],
serializers()->frontmatter()
- ->decode($string = filesystem()->file(ROOT_DIR . '/tests/fixtures/serializers/frontmatter-json5.md')->get()));
+ ->decode($string = filesystem()->file(FLEXTYPE_ROOT_DIR . '/tests/fixtures/serializers/frontmatter-json5.md')->get()));
$this->assertEquals(['title' => 'Frontmatter NEON',
'content' => 'Content is here.'],
serializers()->frontmatter()
- ->decode($string = filesystem()->file(ROOT_DIR . '/tests/fixtures/serializers/frontmatter-neon.md')->get()));
+ ->decode($string = filesystem()->file(FLEXTYPE_ROOT_DIR . '/tests/fixtures/serializers/frontmatter-neon.md')->get()));
});
test('get cache ID', function () {
- $string = filesystem()->file(ROOT_DIR . '/tests/fixtures/serializers/frontmatter.md')->get();;
+ $string = filesystem()->file(FLEXTYPE_ROOT_DIR . '/tests/fixtures/serializers/frontmatter.md')->get();;
$cache_id = serializers()->frontmatter()
->getCacheID($string);
$this->assertEquals(32, strlen($cache_id));
diff --git a/tests/src/flextype/core/Serializers/NeonTest.php b/tests/src/flextype/core/Serializers/NeonTest.php
index ca466ebd..b0eab2b1 100644
--- a/tests/src/flextype/core/Serializers/NeonTest.php
+++ b/tests/src/flextype/core/Serializers/NeonTest.php
@@ -5,7 +5,7 @@ declare(strict_types=1);
use function Glowy\Filesystem\filesystem;
test('encode', function () {
- $string = filesystem()->file(ROOT_DIR . '/tests/fixtures/serializers/neon.neon')->get();
+ $string = filesystem()->file(FLEXTYPE_ROOT_DIR . '/tests/fixtures/serializers/neon.neon')->get();
$this->assertEquals(trim("{" . $string . "}"),
trim(serializers()->neon()->encode(['hello' => 'world'])));
});
@@ -13,11 +13,11 @@ test('encode', function () {
test('decode', function () {
$this->assertEquals(['hello' => 'world'],
serializers()->neon()
- ->decode($string = filesystem()->file(ROOT_DIR . '/tests/fixtures/serializers/neon.neon')->get()));
+ ->decode($string = filesystem()->file(FLEXTYPE_ROOT_DIR . '/tests/fixtures/serializers/neon.neon')->get()));
});
test('get cache ID', function () {
- $string = filesystem()->file(ROOT_DIR . '/tests/fixtures/serializers/neon.neon')->get();;
+ $string = filesystem()->file(FLEXTYPE_ROOT_DIR . '/tests/fixtures/serializers/neon.neon')->get();;
$cache_id = serializers()->neon()
->getCacheID($string);
$this->assertEquals(32, strlen($cache_id));
diff --git a/tests/src/flextype/core/Serializers/PhpArrayTest.php b/tests/src/flextype/core/Serializers/PhpArrayTest.php
index 7cb69b00..57058fe4 100644
--- a/tests/src/flextype/core/Serializers/PhpArrayTest.php
+++ b/tests/src/flextype/core/Serializers/PhpArrayTest.php
@@ -12,7 +12,7 @@ test('encode', function () {
});
test('decode', function () {
- $this->assertEquals(['title' => 'Foo', 'content' => 'Bar'], serializers()->phparray()->decode(ROOT_DIR . '/tests/fixtures/serializers/phparray.php'));
+ $this->assertEquals(['title' => 'Foo', 'content' => 'Bar'], serializers()->phparray()->decode(FLEXTYPE_ROOT_DIR . '/tests/fixtures/serializers/phparray.php'));
});
test('get cache ID', function () {