forked from symfony/symfony1
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from nicoschoenmaker/feature/less-deprecations
Do not use the deprecated create_function function
- Loading branch information
Showing
2 changed files
with
58 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
declare(strict_types = 1); | ||
|
||
use PHPUnit\Framework\TestCase; | ||
|
||
require_once(__DIR__ . '/../../../lib/config/sfConfigHandler.class.php'); | ||
require_once(__DIR__ . '/../../../lib/util/sfToolkit.class.php'); | ||
|
||
/** | ||
* @covers sfConfigHandler | ||
*/ | ||
class sfConfigHandlerTest extends TestCase | ||
{ | ||
/** | ||
* @dataProvider replaceConstantsProvider | ||
*/ | ||
public function testReplaceConstants($input, $output) | ||
{ | ||
sfConfig::clear(); | ||
sfConfig::set('foo', 'bar'); | ||
self::assertSame($output, sfConfigHandler::replaceConstants($input)); | ||
} | ||
|
||
public function replaceConstantsProvider() | ||
{ | ||
return [ | ||
['a', 'a'], | ||
[[], []], | ||
[[[['a']]], [[['a']]]], | ||
['%foo%', 'bar'], | ||
['%foo% foo %foo%', 'bar foo bar'], | ||
['%unknown%', '%unknown%'], | ||
[['%foo%'], ['bar']], | ||
]; | ||
} | ||
|
||
/** | ||
* @dataProvider replacePathProvider | ||
*/ | ||
public function testReplacePath($input, $output) | ||
{ | ||
sfConfig::clear(); | ||
sfConfig::set('sf_app_dir', '/the/app/dir'); | ||
self::assertSame($output, sfConfigHandler::replacePath($input)); | ||
} | ||
|
||
public function replacePathProvider() | ||
{ | ||
return [ | ||
['a', '/the/app/dir/a'], | ||
['/a', '/a'], | ||
[['a'], ['/the/app/dir/a']], | ||
[['/a'], ['/a']], | ||
]; | ||
} | ||
} |