Avoid creation of dynamic property in test

This test requires a property that is not a subnode -- but it does
not need to be dynamic, a declared property works just as well.
This commit is contained in:
Nikita Popov 2021-11-27 20:53:55 +01:00
parent 63f8699143
commit 68d2a52b42

View File

@ -6,11 +6,13 @@ class DummyNode extends NodeAbstract
{ {
public $subNode1; public $subNode1;
public $subNode2; public $subNode2;
public $notSubNode;
public function __construct($subNode1, $subNode2, $attributes) { public function __construct($subNode1, $subNode2, $notSubNode, $attributes) {
parent::__construct($attributes); parent::__construct($attributes);
$this->subNode1 = $subNode1; $this->subNode1 = $subNode1;
$this->subNode2 = $subNode2; $this->subNode2 = $subNode2;
$this->notSubNode = $notSubNode;
} }
public function getSubNodeNames() : array { public function getSubNodeNames() : array {
@ -40,8 +42,7 @@ class NodeAbstractTest extends \PHPUnit\Framework\TestCase
], ],
]; ];
$node = new DummyNode('value1', 'value2', $attributes); $node = new DummyNode('value1', 'value2', 'value3', $attributes);
$node->notSubNode = 'value3';
return [ return [
[$attributes, $node], [$attributes, $node],
@ -90,7 +91,7 @@ class NodeAbstractTest extends \PHPUnit\Framework\TestCase
} }
public function testSetDocComment() { public function testSetDocComment() {
$node = new DummyNode(null, null, []); $node = new DummyNode(null, null, null, []);
// Add doc comment to node without comments // Add doc comment to node without comments
$docComment = new Comment\Doc('/** doc */'); $docComment = new Comment\Doc('/** doc */');