-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed incorrect return type hints for ConfigFactory
See: #14978
- Loading branch information
1 parent
0ed7e37
commit 4f46c4c
Showing
5 changed files
with
41 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,8 @@ | |
* | ||
* (c) Phalcon Team <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE.txt | ||
* file that was distributed with this source code. | ||
* For the full copyright and license information, please view the | ||
* LICENSE.txt file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
@@ -15,6 +15,7 @@ | |
|
||
use Phalcon\Config; | ||
use Phalcon\Config\Adapter\Ini; | ||
|
||
use function dataDir; | ||
use function outputDir; | ||
|
||
|
@@ -35,8 +36,10 @@ trait FactoryTrait | |
|
||
/** | ||
* Initializes the main config | ||
* | ||
* @return void | ||
*/ | ||
protected function init() | ||
protected function init(): void | ||
{ | ||
$configFile = dataDir('assets/config/factory.ini'); | ||
|
||
|
@@ -47,8 +50,10 @@ protected function init() | |
|
||
/** | ||
* Initializes the logger config - this is special because it is nested | ||
* | ||
* @return void | ||
*/ | ||
protected function initLogger() | ||
protected function initLogger(): void | ||
{ | ||
$options = [ | ||
'logger' => [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,8 @@ | |
* | ||
* (c) Phalcon Team <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE.txt | ||
* file that was distributed with this source code. | ||
* For the full copyright and license information, please view the | ||
* LICENSE.txt file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
@@ -29,22 +29,30 @@ class LoadCest | |
{ | ||
use FactoryTrait; | ||
|
||
public function _before(UnitTester $I) | ||
/** | ||
* Executed before each test | ||
* | ||
* @param UnitTester $I | ||
* @return void | ||
*/ | ||
public function _before(UnitTester $I): void | ||
{ | ||
$this->init(); | ||
} | ||
|
||
/** | ||
* Tests Phalcon\Config\ConfigFactory :: load() - Config | ||
* | ||
* @param UnitTester $I | ||
* | ||
* @author Wojciech Ślawski <[email protected]> | ||
* @since 2017-03-02 | ||
*/ | ||
public function configFactoryLoadConfig(UnitTester $I) | ||
{ | ||
$I->wantToTest('Config\ConfigFactory - load() - Config'); | ||
|
||
$options = $this->config->config; | ||
$options = $this->config->get('config'); | ||
|
||
/** @var Ini $ini */ | ||
$ini = (new ConfigFactory())->load($options); | ||
|
@@ -63,7 +71,7 @@ public function configFactoryLoadConfig(UnitTester $I) | |
); | ||
|
||
/** @var Ini $ini */ | ||
$ini = (new ConfigFactory())->load($ini->config->toArray()); | ||
$ini = (new ConfigFactory())->load($ini->get('config')->toArray()); | ||
|
||
$I->assertInstanceOf( | ||
Ini::class, | ||
|
@@ -74,6 +82,8 @@ public function configFactoryLoadConfig(UnitTester $I) | |
/** | ||
* Tests Phalcon\Config\ConfigFactory :: load() - array | ||
* | ||
* @param UnitTester $I | ||
* | ||
* @author Wojciech Ślawski <[email protected]> | ||
* @since 2017-03-02 | ||
*/ | ||
|
@@ -95,6 +105,8 @@ public function configFactoryLoadArray(UnitTester $I) | |
/** | ||
* Tests Phalcon\Config\ConfigFactory :: load() - string | ||
* | ||
* @param UnitTester $I | ||
* | ||
* @author Wojciech Ślawski <[email protected]> | ||
* @since 2017-11-24 | ||
*/ | ||
|
@@ -116,6 +128,8 @@ public function configFactoryLoadString(UnitTester $I) | |
/** | ||
* Tests Phalcon\Config\ConfigFactory :: load() - exception | ||
* | ||
* @param UnitTester $I | ||
* | ||
* @author Phalcon Team <[email protected]> | ||
* @since 2019-06-19 | ||
*/ | ||
|
@@ -169,6 +183,8 @@ function () { | |
/** | ||
* Tests Phalcon\Config\ConfigFactory :: load() - yaml callback | ||
* | ||
* @param UnitTester $I | ||
* | ||
* @author Phalcon Team <[email protected]> | ||
* @since 2019-06-19 | ||
*/ | ||
|
@@ -198,6 +214,8 @@ public function configFactoryLoadYamlCallback(UnitTester $I) | |
/** | ||
* Tests Phalcon\Config\ConfigFactory :: load() - two calls new instances | ||
* | ||
* @param UnitTester $I | ||
* | ||
* @author Phalcon Team <[email protected]> | ||
* @since 2019-12-07 | ||
* @issue 14584 | ||
|
@@ -211,11 +229,11 @@ public function configFactoryLoadTwoCallsNewInstances(UnitTester $I) | |
$configFile1 = dataDir('assets/config/config.php'); | ||
$config = $factory->load($configFile1); | ||
|
||
$I->assertEquals("/phalcon/", $config->phalcon->baseUri); | ||
$I->assertEquals("/phalcon/", $config->get('phalcon')->baseUri); | ||
|
||
$configFile2 = dataDir('assets/config/config-2.php'); | ||
$config2 = $factory->load($configFile2); | ||
|
||
$I->assertEquals("/phalcon4/", $config2->phalcon->baseUri); | ||
$I->assertEquals("/phalcon4/", $config2->get('phalcon')->baseUri); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,8 @@ | |
* | ||
* (c) Phalcon Team <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE.txt | ||
* file that was distributed with this source code. | ||
* For the full copyright and license information, please view the | ||
* LICENSE.txt file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
@@ -27,6 +27,8 @@ class NewInstanceCest | |
/** | ||
* Tests Phalcon\Logger\LoggerFactory :: newInstance() | ||
* | ||
* @param UnitTester $I | ||
* | ||
* @author Phalcon Team <[email protected]> | ||
* @since 2019-05-03 | ||
*/ | ||
|