Resolve #3392903 "Validate inputs resolveexpression"
Closes #3392903
Merge request reports
Activity
- 12 - class TypeResolverTest extends UnitTestCase { - 13 - 14 - /** - 15 - * @dataProvider provideInvalidTypes - 16 - */ - 17 - public function testInvalidType($name, $message, $data = []): void { - 18 - $this->expectException(\LogicException::class); - 19 - $this->expectExceptionMessage($message); - 20 - TypeResolver::resolveDynamicTypeName($name, $data); - 21 - } - 22 - 23 - public function provideInvalidTypes() { - 24 - return [ - 25 - 'invalid %variable' => [ - 26 - '[foo.%bar.qux]', - 27 - 'The only valid usages of a variable value with a % in it are %parent, %key, and %type in foo.%bar.qux',  - Furthermore, I think this would be clearer if the various literals are quoted, to make them stand out: - (I used backticks, but single quotes or double quotes are fine too. Drupal is not very consistent in this regard. Besides, this will only be visible to developers, not end users, so it won't matter a great deal.) 
- changed this line in version 4 of the diff 
 
- Resolved by Wim Leers
- 8 - /** - 9 - * @covers \Drupal\Core\Config\Schema\TypeResolver - 10 - * @group config - 11 - */ - 12 - class TypeResolverTest extends UnitTestCase { - 13 - 14 - /** - 15 - * @dataProvider provideInvalidTypes - 16 - */ - 17 - public function testInvalidType($name, $message, $data = []): void { - 18 - $this->expectException(\LogicException::class); - 19 - $this->expectExceptionMessage($message); - 20 - TypeResolver::resolveDynamicTypeName($name, $data); - 21 - } - 22 - 23 - public function provideInvalidTypes() { - changed this line in version 4 of the diff 
 
- Resolved by Wim Leers
- added 75 commits - 
6a4bf960...33630ea5 - 71 commits from branch project:11.x
- 50b8835b - Merge remote-tracking branch 'origin/11.x' into 3392903-validate-inputs-resolveexpression
- 004178b7 - Fix remark by Wim about provider name
- fd0956c6 - Add quotes as suggested by Wim
- d36ac99b - Remove test that is now obsolete
 Toggle commit list
- 
6a4bf960...33630ea5 - 71 commits from branch 
- 87 - 85 - } - 88 - 86 - 89 - 87 - $parts = explode('.', $expression); - 88 - $previous_name = NULL; - 90 - 89 - // Process each value part, one at a time. - 91 - 90 - while ($name = array_shift($parts)) { - 91 - if (str_starts_with($name, '%') && !in_array($name, ['%parent', '%key', '%type'])) { - 92 - throw new \LogicException('The only valid usages of a variable value with a `%` in it are `%parent`, `%key`, and `%type` in `' . $expression . '`');  - 92 - throw new \LogicException('The only valid usages of a variable value with a `%` in it are `%parent`, `%key`, and `%type` in `' . $expression . '`'); - 92 - throw new \LogicException('`' . $expression .'` is not a valid dynamic type expression. Dynamic type expressions must contain at least `%parent`, `%key`, or `%type`.`'); 
- changed this line in version 6 of the diff 
 
- 74 - 74 - * a bundle. - 75 - 75 - * - 76 - 76 - * @testWith ["%parent.entity_type_id", "entity_test_with_bundle"] - 77 - * ["%paren.entity_type_id", "%paren.entity_type_id"] - 78 - 77 - */ - Fair. - More importantly: there are now 2 test cases again. - Actually … this test case does not match the name nor docblock of this test  - testDynamicEntityType()and change the first line of the docblock to- Tests getting the entity type ID.?
 
- added 280 commits - 
540d593f...f8a2ccac - 279 commits from branch project:11.x
- 6da9d07c - Merge remote-tracking branch 'origin/11.x' into 3392903-validate-inputs-resolveexpression
 
- 
540d593f...f8a2ccac - 279 commits from branch 
- 87 - 85 - } - 88 - 86 - 89 - 87 - $parts = explode('.', $expression); - 88 - $previous_name = NULL; - 90 - 89 - // Process each value part, one at a time. - 91 - 90 - while ($name = array_shift($parts)) { - 91 - if (str_starts_with($name, '%') && !in_array($name, ['%parent', '%key', '%type'])) { - changed this line in version 10 of the diff 
 
- Resolved by Wim Leers
- Resolved by Wim Leers
- 10 - /** - 11 - * @covers \Drupal\Core\Config\Schema\TypeResolver - 12 - * @group config - 13 - */ - 14 - class TypeResolverTest extends UnitTestCase { - 15 - 16 - /** - 17 - * @dataProvider providerInvalidTypes - 18 - */ - 19 - public function testInvalidType($name, $message, $data = []): void { - 20 - $this->expectException(\LogicException::class); - 21 - $this->expectExceptionMessage($message); - 22 - TypeResolver::resolveDynamicTypeName($name, $data); - 23 - } - 24 - 25 - public function providerInvalidTypes() { - changed this line in version 11 of the diff 
 




 
 
