diff --git a/Library/Phalcon/Config/Adapter/Xml.php b/Library/Phalcon/Config/Adapter/Xml.php
deleted file mode 100644
index 43425ee5c..000000000
--- a/Library/Phalcon/Config/Adapter/Xml.php
+++ /dev/null
@@ -1,105 +0,0 @@
- |
- +------------------------------------------------------------------------+
-*/
-
-namespace Phalcon\Config\Adapter;
-
-use Phalcon\Config;
-use Phalcon\Config\Exception;
-
-/**
- * Phalcon\Config\Adapter\Xml
- *
- * Reads xml files and converts them to Phalcon\Config objects.
- *
- * Given the next configuration file:
- *
- *
- *
- *
- *
- * /phalcon/
- *
- *
- * memory
- *
- *
- *
- * here
- *
- *
- *
- *
- *
- * You can read it as follows:
- *
- *
- * use Phalcon\Config\Adapter\Xml;
- * $config = new Xml("path/config.xml");
- * echo $config->phalcon->baseuri;
- * echo $config->nested->config->parameter;
- *
- *
- * @package Phalcon\Config\Adapter
- */
-class Xml extends Config
-{
- /**
- * Phalcon\Config\Adapter\Xml constructor
- *
- * @param string $filePath
- * @throws Exception
- */
- public function __construct($filePath)
- {
- if (!extension_loaded('SimpleXML')) {
- throw new Exception("SimpleXML extension not loaded");
- }
-
- libxml_use_internal_errors(true);
-
- $data = simplexml_load_file(
- $filePath,
- 'SimpleXMLElement',
- LIBXML_NOCDATA
- );
-
- foreach (libxml_get_errors() as $error) {
- /** @var \LibXMLError $error */
- switch ($error->code) {
- case LIBXML_ERR_WARNING:
- trigger_error($error->message, E_USER_WARNING);
- break;
-
- default:
- throw new Exception($error->message);
- }
- }
-
- libxml_use_internal_errors(false);
-
- parent::__construct(
- json_decode(
- json_encode(
- (array) $data
- ),
- true
- )
- );
- }
-}
diff --git a/Library/Phalcon/Config/Loader.php b/Library/Phalcon/Config/Loader.php
deleted file mode 100644
index 1d69e5035..000000000
--- a/Library/Phalcon/Config/Loader.php
+++ /dev/null
@@ -1,78 +0,0 @@
- |
- +------------------------------------------------------------------------+
-*/
-
-namespace Phalcon\Config;
-
-use Phalcon\Config\Adapter\Ini;
-use Phalcon\Config\Adapter\Json;
-use Phalcon\Config\Adapter\Php;
-use Phalcon\Config\Adapter\Yaml;
-use Phalcon\Config;
-
-/**
- * Phalcon config loader
- *
- * @package Phalcon\Config
- */
-class Loader
-{
- /**
- * Load config from file extension dynamical
- *
- * @param string $filePath
- *
- * @return Config
- * @throws Exception
- */
- public static function load($filePath)
- {
- if (!is_file($filePath)) {
- throw new Exception('Config file not found');
- }
-
- $extension = strtolower(
- pathinfo(
- $filePath,
- PATHINFO_EXTENSION
- )
- );
-
- switch ($extension) {
- case 'ini':
- return new Ini($filePath);
-
- case 'json':
- return new Json($filePath);
-
- case 'php':
- case 'php5':
- case 'inc':
- return new Php($filePath);
-
- case 'yml':
- case 'yaml':
- return new Yaml($filePath);
-
- default:
- throw new Exception(
- 'Config adapter for .' . $extension . ' files is not support'
- );
- }
- }
-}
diff --git a/composer.json b/composer.json
index 1ed7d4d2b..ad67e5815 100644
--- a/composer.json
+++ b/composer.json
@@ -33,7 +33,8 @@
"phalcon/incubator-acl": "^1.0.0-alpha.1",
"phalcon/incubator-session": "^1.0",
"phalcon/incubator-test": "^1.0.0-alpha.1",
- "phalcon/incubator-logger": "^1.0"
+ "phalcon/incubator-logger": "^1.0",
+ "phalcon/incubator-config": "^1.0"
},
"require-dev": {
"phpdocumentor/reflection-docblock": "2.0.4",
diff --git a/composer.lock b/composer.lock
index 45c2e6a96..4ee2dc498 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "e4c6647fa72e1ba200fedff45d7bfdca",
+ "content-hash": "b4cdc5e946d630a3f356ede4eed5ac87",
"packages": [
{
"name": "behat/gherkin",
@@ -67,16 +67,16 @@
},
{
"name": "codeception/codeception",
- "version": "4.1.6",
+ "version": "4.1.7",
"source": {
"type": "git",
"url": "https://github.com/Codeception/Codeception.git",
- "reference": "5515b6a6c6f1e1c909aaff2e5f3a15c177dfd1a9"
+ "reference": "220ad18d3c192137d9dc2d0dd8d69a0d82083a26"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/Codeception/Codeception/zipball/5515b6a6c6f1e1c909aaff2e5f3a15c177dfd1a9",
- "reference": "5515b6a6c6f1e1c909aaff2e5f3a15c177dfd1a9",
+ "url": "https://api.github.com/repos/Codeception/Codeception/zipball/220ad18d3c192137d9dc2d0dd8d69a0d82083a26",
+ "reference": "220ad18d3c192137d9dc2d0dd8d69a0d82083a26",
"shasum": ""
},
"require": {
@@ -154,24 +154,25 @@
"type": "open_collective"
}
],
- "time": "2020-06-07T16:31:51+00:00"
+ "time": "2020-08-28T06:37:06+00:00"
},
{
"name": "codeception/lib-asserts",
- "version": "1.12.0",
+ "version": "1.13.1",
"source": {
"type": "git",
"url": "https://github.com/Codeception/lib-asserts.git",
- "reference": "acd0dc8b394595a74b58dcc889f72569ff7d8e71"
+ "reference": "263ef0b7eff80643e82f4cf55351eca553a09a10"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/Codeception/lib-asserts/zipball/acd0dc8b394595a74b58dcc889f72569ff7d8e71",
- "reference": "acd0dc8b394595a74b58dcc889f72569ff7d8e71",
+ "url": "https://api.github.com/repos/Codeception/lib-asserts/zipball/263ef0b7eff80643e82f4cf55351eca553a09a10",
+ "reference": "263ef0b7eff80643e82f4cf55351eca553a09a10",
"shasum": ""
},
"require": {
"codeception/phpunit-wrapper": ">6.0.15 <6.1.0 | ^6.6.1 | ^7.7.1 | ^8.0.3 | ^9.0",
+ "ext-dom": "*",
"php": ">=5.6.0 <8.0"
},
"type": "library",
@@ -192,14 +193,18 @@
},
{
"name": "Gintautas Miselis"
+ },
+ {
+ "name": "Gustavo Nieves",
+ "homepage": "https://medium.com/@ganieves"
}
],
"description": "Assertion methods used by Codeception core and Asserts module",
- "homepage": "http://codeception.com/",
+ "homepage": "https://codeception.com/",
"keywords": [
"codeception"
],
- "time": "2020-04-17T18:20:46+00:00"
+ "time": "2020-08-28T07:49:36+00:00"
},
{
"name": "codeception/lib-innerbrowser",
@@ -259,21 +264,21 @@
},
{
"name": "codeception/module-asserts",
- "version": "1.2.1",
+ "version": "1.3.0",
"source": {
"type": "git",
"url": "https://github.com/Codeception/module-asserts.git",
- "reference": "79f13d05b63f2fceba4d0e78044bab668c9b2a6b"
+ "reference": "32e5be519faaeb60ed3692383dcd1b3390ec2667"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/Codeception/module-asserts/zipball/79f13d05b63f2fceba4d0e78044bab668c9b2a6b",
- "reference": "79f13d05b63f2fceba4d0e78044bab668c9b2a6b",
+ "url": "https://api.github.com/repos/Codeception/module-asserts/zipball/32e5be519faaeb60ed3692383dcd1b3390ec2667",
+ "reference": "32e5be519faaeb60ed3692383dcd1b3390ec2667",
"shasum": ""
},
"require": {
"codeception/codeception": "*@dev",
- "codeception/lib-asserts": "^1.12.0",
+ "codeception/lib-asserts": "^1.13.1",
"php": ">=5.6.0 <8.0"
},
"conflict": {
@@ -298,16 +303,20 @@
},
{
"name": "Gintautas Miselis"
+ },
+ {
+ "name": "Gustavo Nieves",
+ "homepage": "https://medium.com/@ganieves"
}
],
"description": "Codeception module containing various assertions",
- "homepage": "http://codeception.com/",
+ "homepage": "https://codeception.com/",
"keywords": [
"assertions",
"asserts",
"codeception"
],
- "time": "2020-04-20T07:26:11+00:00"
+ "time": "2020-08-28T08:06:29+00:00"
},
{
"name": "codeception/module-phpbrowser",
@@ -822,6 +831,77 @@
],
"time": "2020-04-13T22:00:37+00:00"
},
+ {
+ "name": "phalcon/incubator-config",
+ "version": "v1.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phalcon/incubator-config.git",
+ "reference": "195db8925df8035af0006ccca79e8225d9465665"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phalcon/incubator-config/zipball/195db8925df8035af0006ccca79e8225d9465665",
+ "reference": "195db8925df8035af0006ccca79e8225d9465665",
+ "shasum": ""
+ },
+ "require": {
+ "ext-phalcon": "^4.0",
+ "php": ">=7.2"
+ },
+ "require-dev": {
+ "codeception/codeception": "^4.1",
+ "codeception/module-asserts": "^1.0.0",
+ "phalcon/ide-stubs": "^4.0",
+ "phpstan/phpstan": "^0.12.18",
+ "squizlabs/php_codesniffer": "^3.5",
+ "vimeo/psalm": "^3.6"
+ },
+ "suggest": {
+ "ext-simplexml": "Need to run in XML Config Adapter"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Phalcon\\Incubator\\Config\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Phalcon Team",
+ "email": "team@phalcon.io",
+ "homepage": "https://phalcon.io/en/team"
+ },
+ {
+ "name": "Contributors",
+ "homepage": "https://github.com/phalcon/incubator-config/graphs/contributors"
+ }
+ ],
+ "description": "Phalcon Incubator Config Adapters",
+ "homepage": "https://phalcon.io",
+ "keywords": [
+ "config",
+ "framework",
+ "incubator",
+ "phalcon",
+ "xml"
+ ],
+ "funding": [
+ {
+ "url": "https://github.com/phalcon",
+ "type": "github"
+ },
+ {
+ "url": "https://opencollective.com/phalcon",
+ "type": "open_collective"
+ }
+ ],
+ "time": "2020-09-02T20:34:03+00:00"
+ },
{
"name": "phalcon/incubator-logger",
"version": "v1.0.0",
@@ -1479,6 +1559,7 @@
"keywords": [
"tokenizer"
],
+ "abandoned": true,
"time": "2017-11-27T05:48:46+00:00"
},
{
@@ -2420,7 +2501,7 @@
},
{
"name": "symfony/browser-kit",
- "version": "v5.1.3",
+ "version": "v5.1.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/browser-kit.git",
@@ -2493,16 +2574,16 @@
},
{
"name": "symfony/console",
- "version": "v5.1.3",
+ "version": "v5.1.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
- "reference": "2226c68009627934b8cfc01260b4d287eab070df"
+ "reference": "186f395b256065ba9b890c0a4e48a91d598fa2cf"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/console/zipball/2226c68009627934b8cfc01260b4d287eab070df",
- "reference": "2226c68009627934b8cfc01260b4d287eab070df",
+ "url": "https://api.github.com/repos/symfony/console/zipball/186f395b256065ba9b890c0a4e48a91d598fa2cf",
+ "reference": "186f395b256065ba9b890c0a4e48a91d598fa2cf",
"shasum": ""
},
"require": {
@@ -2582,11 +2663,11 @@
"type": "tidelift"
}
],
- "time": "2020-07-06T13:23:11+00:00"
+ "time": "2020-09-02T07:07:40+00:00"
},
{
"name": "symfony/css-selector",
- "version": "v5.1.3",
+ "version": "v5.1.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/css-selector.git",
@@ -2717,16 +2798,16 @@
},
{
"name": "symfony/dom-crawler",
- "version": "v5.1.3",
+ "version": "v5.1.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/dom-crawler.git",
- "reference": "a96aecb36aaf081f1b012e1e62d71f1069ab3dca"
+ "reference": "3ac31ffbc596e41ca081037b7d78fc7a853c0315"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/a96aecb36aaf081f1b012e1e62d71f1069ab3dca",
- "reference": "a96aecb36aaf081f1b012e1e62d71f1069ab3dca",
+ "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/3ac31ffbc596e41ca081037b7d78fc7a853c0315",
+ "reference": "3ac31ffbc596e41ca081037b7d78fc7a853c0315",
"shasum": ""
},
"require": {
@@ -2789,20 +2870,20 @@
"type": "tidelift"
}
],
- "time": "2020-07-23T08:36:24+00:00"
+ "time": "2020-08-12T08:45:47+00:00"
},
{
"name": "symfony/event-dispatcher",
- "version": "v5.1.3",
+ "version": "v5.1.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher.git",
- "reference": "7827d55911f91c070fc293ea51a06eec80797d76"
+ "reference": "94871fc0a69c3c5da57764187724cdce0755899c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/7827d55911f91c070fc293ea51a06eec80797d76",
- "reference": "7827d55911f91c070fc293ea51a06eec80797d76",
+ "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/94871fc0a69c3c5da57764187724cdce0755899c",
+ "reference": "94871fc0a69c3c5da57764187724cdce0755899c",
"shasum": ""
},
"require": {
@@ -2875,7 +2956,7 @@
"type": "tidelift"
}
],
- "time": "2020-06-18T18:24:02+00:00"
+ "time": "2020-08-13T14:19:42+00:00"
},
{
"name": "symfony/event-dispatcher-contracts",
@@ -2955,16 +3036,16 @@
},
{
"name": "symfony/finder",
- "version": "v5.1.3",
+ "version": "v5.1.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
- "reference": "4298870062bfc667cb78d2b379be4bf5dec5f187"
+ "reference": "2b765f0cf6612b3636e738c0689b29aa63088d5d"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/finder/zipball/4298870062bfc667cb78d2b379be4bf5dec5f187",
- "reference": "4298870062bfc667cb78d2b379be4bf5dec5f187",
+ "url": "https://api.github.com/repos/symfony/finder/zipball/2b765f0cf6612b3636e738c0689b29aa63088d5d",
+ "reference": "2b765f0cf6612b3636e738c0689b29aa63088d5d",
"shasum": ""
},
"require": {
@@ -3014,11 +3095,11 @@
"type": "tidelift"
}
],
- "time": "2020-05-20T17:43:50+00:00"
+ "time": "2020-08-17T10:01:29+00:00"
},
{
"name": "symfony/polyfill-ctype",
- "version": "v1.18.0",
+ "version": "v1.18.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
@@ -3094,7 +3175,7 @@
},
{
"name": "symfony/polyfill-intl-grapheme",
- "version": "v1.18.0",
+ "version": "v1.18.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-grapheme.git",
@@ -3172,7 +3253,7 @@
},
{
"name": "symfony/polyfill-intl-normalizer",
- "version": "v1.18.0",
+ "version": "v1.18.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-normalizer.git",
@@ -3253,7 +3334,7 @@
},
{
"name": "symfony/polyfill-mbstring",
- "version": "v1.18.0",
+ "version": "v1.18.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
@@ -3330,7 +3411,7 @@
},
{
"name": "symfony/polyfill-php73",
- "version": "v1.18.0",
+ "version": "v1.18.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php73.git",
@@ -3406,7 +3487,7 @@
},
{
"name": "symfony/polyfill-php80",
- "version": "v1.18.0",
+ "version": "v1.18.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php80.git",
@@ -3562,16 +3643,16 @@
},
{
"name": "symfony/string",
- "version": "v5.1.3",
+ "version": "v5.1.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/string.git",
- "reference": "f629ba9b611c76224feb21fe2bcbf0b6f992300b"
+ "reference": "0de4cc1e18bb596226c06a82e2e7e9bc6001a63a"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/string/zipball/f629ba9b611c76224feb21fe2bcbf0b6f992300b",
- "reference": "f629ba9b611c76224feb21fe2bcbf0b6f992300b",
+ "url": "https://api.github.com/repos/symfony/string/zipball/0de4cc1e18bb596226c06a82e2e7e9bc6001a63a",
+ "reference": "0de4cc1e18bb596226c06a82e2e7e9bc6001a63a",
"shasum": ""
},
"require": {
@@ -3643,20 +3724,20 @@
"type": "tidelift"
}
],
- "time": "2020-07-08T08:27:49+00:00"
+ "time": "2020-08-17T07:48:54+00:00"
},
{
"name": "symfony/yaml",
- "version": "v5.1.3",
+ "version": "v5.1.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
- "reference": "ea342353a3ef4f453809acc4ebc55382231d4d23"
+ "reference": "a44bd3a91bfbf8db12367fa6ffac9c3eb1a8804a"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/yaml/zipball/ea342353a3ef4f453809acc4ebc55382231d4d23",
- "reference": "ea342353a3ef4f453809acc4ebc55382231d4d23",
+ "url": "https://api.github.com/repos/symfony/yaml/zipball/a44bd3a91bfbf8db12367fa6ffac9c3eb1a8804a",
+ "reference": "a44bd3a91bfbf8db12367fa6ffac9c3eb1a8804a",
"shasum": ""
},
"require": {
@@ -3720,7 +3801,7 @@
"type": "tidelift"
}
],
- "time": "2020-05-20T17:43:50+00:00"
+ "time": "2020-08-26T08:30:57+00:00"
},
{
"name": "theseer/tokenizer",
diff --git a/tests/unit/Config/Adapter/XmlTest.php b/tests/unit/Config/Adapter/XmlTest.php
deleted file mode 100644
index c3786af07..000000000
--- a/tests/unit/Config/Adapter/XmlTest.php
+++ /dev/null
@@ -1,73 +0,0 @@
-
- * @package Phalcon\Test\Config\Adapter
- * @group config
- *
- * The contents of this file are subject to the New BSD License that is
- * bundled with this package in the file docs/LICENSE.txt
- *
- * If you did not receive a copy of the license and are unable to obtain it
- * through the world-wide-web, please send an email to license@phalconphp.com
- * so that we can send you a copy immediately.
- */
-class XmlTest extends Test
-{
- use Specify;
-
- /**
- * executed before each test
- */
- protected function _before()
- {
- if (!extension_loaded('SimpleXML')) {
- $this->markTestSkipped("SimpleXML extension not loaded");
- }
- }
-
- /**
- * Tests toArray method
- *
- * @author Serghei Iakovlev
- * @since 2016-03-04
- */
- public function testConfigToArray()
- {
- $this->specify(
- "Transform Config to the array does not returns the expected result",
- function () {
- $expected = [
- 'phalcon' => [
- 'baseuri' => '/phalcon/'
- ],
- 'models' => [
- 'metadata' => 'memory',
- ],
- 'nested' => [
- 'config' => [
- 'parameter' => 'here',
- ],
- ],
- ];
-
- $config = new Xml(
- PATH_DATA . 'config/config.xml'
- );
-
- expect($config->toArray())->equals($expected);
- }
- );
- }
-}
diff --git a/tests/unit/Config/LoaderTest.php b/tests/unit/Config/LoaderTest.php
deleted file mode 100644
index 24618a5c2..000000000
--- a/tests/unit/Config/LoaderTest.php
+++ /dev/null
@@ -1,239 +0,0 @@
-
- * @package Phalcon\Test\Config
- * @group config
- *
- * The contents of this file are subject to the New BSD License that is
- * bundled with this package in the file docs/LICENSE.txt
- *
- * If you did not receive a copy of the license and are unable to obtain it
- * through the world-wide-web, please send an email to license@phalconphp.com
- * so that we can send you a copy immediately.
- */
-class LoaderTest extends Test
-{
- public function testLoadPhpFileConfig()
- {
- $file = INCUBATOR_FIXTURES . 'Config/config.php';
-
- $config = ConfigLoader::load($file);
-
- $this->assertTrue(
- is_object($config)
- );
-
- $this->assertInstanceOf(
- 'Phalcon\Config\Adapter\Php',
- $config
- );
-
- $this->assertInstanceOf(
- 'Phalcon\Config',
- $config
- );
-
- $this->assertEquals(
- 'bar',
- $config->phalcon->foo
- );
- }
-
- public function testLoadPhp5FileConfig()
- {
- $file = INCUBATOR_FIXTURES . 'Config/config.php5';
-
- $config = ConfigLoader::load($file);
-
- $this->assertTrue(
- is_object($config)
- );
-
- $this->assertInstanceOf(
- \Phalcon\Config\Adapter\Php::class,
- $config
- );
-
- $this->assertInstanceOf(
- \Phalcon\Config::class,
- $config
- );
-
- $this->assertEquals(
- 'bar',
- $config->phalcon->foo
- );
- }
-
- public function testLoadIncFileConfig()
- {
- $file = INCUBATOR_FIXTURES . 'Config/config.inc';
-
- $config = ConfigLoader::load($file);
-
- $this->assertTrue(
- is_object($config)
- );
-
- $this->assertInstanceOf(
- \Phalcon\Config\Adapter\Php::class,
- $config
- );
-
- $this->assertInstanceOf(
- \Phalcon\Config::class,
- $config
- );
-
- $this->assertEquals(
- 'bar',
- $config->phalcon->foo
- );
- }
-
- public function testLoadIniFileConfig()
- {
- $file = INCUBATOR_FIXTURES . 'Config/config.ini';
-
- $config = ConfigLoader::load($file);
-
- $this->assertTrue(
- is_object($config)
- );
-
- $this->assertInstanceOf(
- \Phalcon\Config\Adapter\Ini::class,
- $config
- );
-
- $this->assertInstanceOf(
- \Phalcon\Config::class,
- $config
- );
-
- $this->assertEquals(
- 'bar',
- $config->phalcon->foo
- );
- }
-
- /**
- * @requires extension json
- */
- public function testLoadJsonFileConfig()
- {
- $file = INCUBATOR_FIXTURES . 'Config/config.json';
-
- $config = ConfigLoader::load($file);
-
- $this->assertTrue(
- is_object($config)
- );
-
- $this->assertInstanceOf(
- \Phalcon\Config\Adapter\Json::class,
- $config
- );
-
- $this->assertInstanceOf(
- \Phalcon\Config::class,
- $config
- );
-
- $this->assertEquals(
- 'bar',
- $config->phalcon->foo
- );
- }
-
- /**
- * @requires extension yaml
- */
- public function testLoadYamlFileConfig()
- {
- $file = INCUBATOR_FIXTURES . 'Config/config.yaml';
-
- $config = ConfigLoader::load($file);
-
- $this->assertTrue(
- is_object($config)
- );
-
- $this->assertInstanceOf(
- \Phalcon\Config\Adapter\Yaml::class,
- $config
- );
-
- $this->assertInstanceOf(
- \Phalcon\Config::class,
- $config
- );
-
- $this->assertEquals(
- 'bar',
- $config->phalcon->foo
- );
- }
-
- /**
- * @requires extension yaml
- */
- public function testLoadYmlFileConfig()
- {
- $file = INCUBATOR_FIXTURES . 'Config/config.yml';
-
- $config = ConfigLoader::load($file);
-
- $this->assertTrue(
- is_object($config)
- );
-
- $this->assertInstanceOf(
- \Phalcon\Config\Adapter\Yaml::class,
- $config
- );
-
- $this->assertInstanceOf(
- \Phalcon\Config::class,
- $config
- );
-
- $this->assertEquals(
- 'bar',
- $config->phalcon->foo
- );
- }
-
- /**
- * @expectedException \Phalcon\Config\Exception
- * @expectedExceptionMessage Config file not found
- */
- public function testLoadWrongFilePath()
- {
- $file = INCUBATOR_FIXTURES . 'Config/config.jason';
-
- ConfigLoader::load($file);
- }
-
- /**
- * @expectedException \Phalcon\Config\Exception
- * @expectedExceptionMessage Config adapter for .txt files is not support
- */
- public function testLoadUnsupportedConfigFile()
- {
- $file = INCUBATOR_FIXTURES . 'Config/config.txt';
-
- ConfigLoader::load($file);
- }
-}