Skip to content

Commit

Permalink
[#14584] - Added test
Browse files Browse the repository at this point in the history
  • Loading branch information
niden committed Dec 7, 2019
1 parent 869bbc0 commit 8e09c6f
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions tests/unit/Config/ConfigFactory/LoadCest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<?php
declare(strict_types=1);

/**
* This file is part of the Phalcon Framework.
*
Expand All @@ -10,6 +8,8 @@
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Phalcon\Test\Unit\Config\ConfigFactory;

use Phalcon\Config\Adapter\Ini;
Expand All @@ -18,8 +18,10 @@
use Phalcon\Config\Exception;
use Phalcon\Test\Fixtures\Traits\FactoryTrait;
use UnitTester;

use function dataDir;
use function hash;

use const PATH_DATA;

class LoadCest
Expand Down Expand Up @@ -175,4 +177,28 @@ public function configFactoryLoadYamlCallback(UnitTester $I)
$config = $factory->load($config);
$I->assertInstanceOf(Yaml::class, $config);
}

/**
* Tests Phalcon\Config\ConfigFactory :: load() - two calls new instances
*
* @author Phalcon Team <team@phalcon.io>
* @since 2019-12-07
* @issue 14584
*/
public function configFactoryLoadTwoCallsNewInstances(UnitTester $I)
{
$I->wantToTest('Config\ConfigFactory - load() - two calls new instances');

$factory = new ConfigFactory();

$configFile1 = dataDir('assets/config/config.php');
$config = $factory->load($configFile1);

$I->assertEquals("/phalcon/", $config->phalcon->baseUri);

$configFile2 = dataDir('assets/config/config-2.php');
$config2 = $factory->load($configFile2);

$I->assertEquals("/phalcon4/", $config2->phalcon->baseUri);
}
}

0 comments on commit 8e09c6f

Please sign in to comment.