diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 250b78b..2ff3b59 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -16,7 +16,7 @@ class Configuration implements ConfigurationInterface { - const SERVICE_CALLABLE_NOTATION_REGEX = '/^@(?[a-z0-9\._]+)(?:\:(?[a-zA-Z_\x7f-\xff][a-z0-9_\x7f-\xff]*))?$/i'; + const SERVICE_CALLABLE_NOTATION_REGEX = '/^@(?[a-z0-9\._\\\]+)(?:\:(?[a-zA-Z_\x7f-\xff][a-z0-9_\x7f-\xff]*))?$/iu'; const PHP_CALLABLE_NOTATION_REGEX = '/^(?(?:\\\\?[a-z_\x7f-\xff][a-z0-9_\x7f-\xff]*)+)(?:\:\:(?[a-z_\x7f-\xff][a-z0-9_\x7f-\xff]*))?$/i'; public function getConfigTreeBuilder() diff --git a/Tests/DependencyInjection/OverblogDataLoaderExtensionTest.php b/Tests/DependencyInjection/OverblogDataLoaderExtensionTest.php index e26c0b1..d2d0ac8 100644 --- a/Tests/DependencyInjection/OverblogDataLoaderExtensionTest.php +++ b/Tests/DependencyInjection/OverblogDataLoaderExtensionTest.php @@ -11,6 +11,7 @@ namespace Overblog\DataLoaderBundle\Tests\DependencyInjection; +use Overblog\DataLoaderBundle\DependencyInjection\Configuration; use Overblog\DataLoaderBundle\DependencyInjection\OverblogDataLoaderExtension; use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\Alias; @@ -41,6 +42,22 @@ public function tearDown() unset($this->container, $this->extension); } + public function testValidServiceCallableNodeValue() + { + $validValues = ['@app.user:getUsers', '@App\\Loader\\User:all']; + foreach ($validValues as $validValue) { + $this->assertRegExp(Configuration::SERVICE_CALLABLE_NOTATION_REGEX, $validValue); + } + } + + public function testValidPhpCallableNodeValue() + { + $validValues = ['Image\\Loader::get', 'Post::getPosts']; + foreach ($validValues as $validValue) { + $this->assertRegExp(Configuration::PHP_CALLABLE_NOTATION_REGEX, $validValue); + } + } + public function testUsersDataLoaderConfig() { $this->loadValidConfig();