platform/api/symfony/Component/PropertyAccess/Tests/PropertyPathBuilderTest.yaml

115 lines
6.4 KiB
YAML
Raw Normal View History

2024-09-02 17:44:11 +00:00
name: PropertyPathBuilderTest
class_comment: '# * @author Bernhard Schussek <bschussek@gmail.com>'
dependencies:
- name: TestCase
type: class
source: PHPUnit\Framework\TestCase
- name: PropertyPath
type: class
source: Symfony\Component\PropertyAccess\PropertyPath
- name: PropertyPathBuilder
type: class
source: Symfony\Component\PropertyAccess\PropertyPathBuilder
properties: []
methods:
- name: testReplaceDoesNotAllowInvalidOffsets
visibility: public
parameters:
- name: offset
comment: "# * @author Bernhard Schussek <bschussek@gmail.com>\n# */\n# class PropertyPathBuilderTest\
\ extends TestCase\n# {\n# private const PREFIX = 'old1[old2].old3[old4][old5].old6';\n\
# \n# private PropertyPathBuilder $builder;\n# \n# protected function setUp():\
\ void\n# {\n# $this->builder = new PropertyPathBuilder(new PropertyPath(self::PREFIX));\n\
# }\n# \n# public function testCreateEmpty()\n# {\n# $builder = new PropertyPathBuilder();\n\
# \n# $this->assertNull($builder->getPropertyPath());\n# }\n# \n# public function\
\ testCreateCopyPath()\n# {\n# $this->assertEquals(new PropertyPath(self::PREFIX),\
\ $this->builder->getPropertyPath());\n# }\n# \n# public function testAppendIndex()\n\
# {\n# $this->builder->appendIndex('new1');\n# \n# $path = new PropertyPath(self::PREFIX.'[new1]');\n\
# \n# $this->assertEquals($path, $this->builder->getPropertyPath());\n# }\n# \n\
# public function testAppendProperty()\n# {\n# $this->builder->appendProperty('new1');\n\
# \n# $path = new PropertyPath(self::PREFIX.'.new1');\n# \n# $this->assertEquals($path,\
\ $this->builder->getPropertyPath());\n# }\n# \n# public function testAppend()\n\
# {\n# $this->builder->append(new PropertyPath('new1[new2]'));\n# \n# $path =\
\ new PropertyPath(self::PREFIX.'.new1[new2]');\n# \n# $this->assertEquals($path,\
\ $this->builder->getPropertyPath());\n# }\n# \n# public function testAppendUsingString()\n\
# {\n# $this->builder->append('new1[new2]');\n# \n# $path = new PropertyPath(self::PREFIX.'.new1[new2]');\n\
# \n# $this->assertEquals($path, $this->builder->getPropertyPath());\n# }\n# \n\
# public function testAppendWithOffset()\n# {\n# $this->builder->append(new PropertyPath('new1[new2].new3'),\
\ 1);\n# \n# $path = new PropertyPath(self::PREFIX.'[new2].new3');\n# \n# $this->assertEquals($path,\
\ $this->builder->getPropertyPath());\n# }\n# \n# public function testAppendWithOffsetAndLength()\n\
# {\n# $this->builder->append(new PropertyPath('new1[new2].new3'), 1, 1);\n# \n\
# $path = new PropertyPath(self::PREFIX.'[new2]');\n# \n# $this->assertEquals($path,\
\ $this->builder->getPropertyPath());\n# }\n# \n# public function testReplaceByIndex()\n\
# {\n# $this->builder->replaceByIndex(1, 'new1');\n# \n# $path = new PropertyPath('old1[new1].old3[old4][old5].old6');\n\
# \n# $this->assertEquals($path, $this->builder->getPropertyPath());\n# }\n# \n\
# public function testReplaceByIndexWithoutName()\n# {\n# $this->builder->replaceByIndex(0);\n\
# \n# $path = new PropertyPath('[old1][old2].old3[old4][old5].old6');\n# \n# $this->assertEquals($path,\
\ $this->builder->getPropertyPath());\n# }\n# \n# public function testReplaceByIndexDoesNotAllowInvalidOffsets()\n\
# {\n# $this->expectException(\\OutOfBoundsException::class);\n# $this->builder->replaceByIndex(6,\
\ 'new1');\n# }\n# \n# public function testReplaceByIndexDoesNotAllowNegativeOffsets()\n\
# {\n# $this->expectException(\\OutOfBoundsException::class);\n# $this->builder->replaceByIndex(-1,\
\ 'new1');\n# }\n# \n# public function testReplaceByProperty()\n# {\n# $this->builder->replaceByProperty(1,\
\ 'new1');\n# \n# $path = new PropertyPath('old1.new1.old3[old4][old5].old6');\n\
# \n# $this->assertEquals($path, $this->builder->getPropertyPath());\n# }\n# \n\
# public function testReplaceByPropertyWithoutName()\n# {\n# $this->builder->replaceByProperty(1);\n\
# \n# $path = new PropertyPath('old1.old2.old3[old4][old5].old6');\n# \n# $this->assertEquals($path,\
\ $this->builder->getPropertyPath());\n# }\n# \n# public function testReplaceByPropertyDoesNotAllowInvalidOffsets()\n\
# {\n# $this->expectException(\\OutOfBoundsException::class);\n# $this->builder->replaceByProperty(6,\
\ 'new1');\n# }\n# \n# public function testReplaceByPropertyDoesNotAllowNegativeOffsets()\n\
# {\n# $this->expectException(\\OutOfBoundsException::class);\n# $this->builder->replaceByProperty(-1,\
\ 'new1');\n# }\n# \n# public function testReplace()\n# {\n# $this->builder->replace(1,\
\ 1, new PropertyPath('new1[new2].new3'));\n# \n# $path = new PropertyPath('old1.new1[new2].new3.old3[old4][old5].old6');\n\
# \n# $this->assertEquals($path, $this->builder->getPropertyPath());\n# }\n# \n\
# public function testReplaceUsingString()\n# {\n# $this->builder->replace(1,\
\ 1, 'new1[new2].new3');\n# \n# $path = new PropertyPath('old1.new1[new2].new3.old3[old4][old5].old6');\n\
# \n# $this->assertEquals($path, $this->builder->getPropertyPath());\n# }\n# \n\
# public function testReplaceNegative()\n# {\n# $this->builder->replace(-1, 1,\
\ new PropertyPath('new1[new2].new3'));\n# \n# $path = new PropertyPath('old1[old2].old3[old4][old5].new1[new2].new3');\n\
# \n# $this->assertEquals($path, $this->builder->getPropertyPath());\n# }\n# \n\
# /**\n# * @dataProvider provideInvalidOffsets"
- name: provideInvalidOffsets
visibility: public
parameters: []
comment: null
- name: testReplaceWithLengthGreaterOne
visibility: public
parameters: []
comment: null
- name: testReplaceSubstring
visibility: public
parameters: []
comment: null
- name: testReplaceSubstringWithLengthGreaterOne
visibility: public
parameters: []
comment: null
- name: testReplaceWithLongerPath
visibility: public
parameters: []
comment: null
- name: testReplaceWithLongerPathKeepsOrder
visibility: public
parameters: []
comment: null
- name: testRemove
visibility: public
parameters: []
comment: null
- name: testRemoveDoesNotAllowInvalidOffsets
visibility: public
parameters: []
comment: null
- name: testRemoveDoesNotAllowNegativeOffsets
visibility: public
parameters: []
comment: null
- name: testRemoveAndAppendAtTheEnd
visibility: public
parameters: []
comment: null
traits:
- PHPUnit\Framework\TestCase
- Symfony\Component\PropertyAccess\PropertyPath
- Symfony\Component\PropertyAccess\PropertyPathBuilder
interfaces: []