|
14 | 14 | use PHPUnit\Framework\TestCase; |
15 | 15 | use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; |
16 | 16 | use Symfony\Component\Config\Definition\Builder\NodeDefinition; |
17 | | -use Symfony\Component\Config\Definition\Builder\ScalarNodeDefinition; |
18 | 17 |
|
19 | 18 | class NodeDefinitionTest extends TestCase |
20 | 19 | { |
21 | | - public function testDefaultPathSeparatorIsDot() |
22 | | - { |
23 | | - $node = $this->getMockForAbstractClass(NodeDefinition::class, ['foo']); |
24 | | - |
25 | | - $this->assertAttributeSame('.', 'pathSeparator', $node); |
26 | | - } |
27 | | - |
28 | 20 | public function testSetPathSeparatorChangesChildren() |
29 | 21 | { |
30 | | - $node = new ArrayNodeDefinition('foo'); |
31 | | - $scalar = new ScalarNodeDefinition('bar'); |
32 | | - $node->append($scalar); |
33 | | - |
34 | | - $node->setPathSeparator('/'); |
35 | | - |
36 | | - $this->assertAttributeSame('/', 'pathSeparator', $node); |
37 | | - $this->assertAttributeSame('/', 'pathSeparator', $scalar); |
| 22 | + $parentNode = new ArrayNodeDefinition('name'); |
| 23 | + $childNode = $this->createMock(NodeDefinition::class); |
| 24 | + |
| 25 | + $childNode |
| 26 | + ->expects($this->once()) |
| 27 | + ->method('setPathSeparator') |
| 28 | + ->with('/'); |
| 29 | + $childNode |
| 30 | + ->expects($this->once()) |
| 31 | + ->method('setParent') |
| 32 | + ->with($parentNode) |
| 33 | + ->willReturn($childNode); |
| 34 | + $parentNode->append($childNode); |
| 35 | + |
| 36 | + $parentNode->setPathSeparator('/'); |
38 | 37 | } |
39 | 38 | } |
0 commit comments