| @@ 122-133 (lines=12) @@ | ||
| 119 | } |
|
| 120 | ||
| 121 | // Normal attributes list on unbound multiedge. |
|
| 122 | public function testBuildAttributesNormal() { |
|
| 123 | $this->MultiEdge->setAttributes(array( |
|
| 124 | new Attribute($this->dic, 'foo', 'bar'), |
|
| 125 | new Attribute($this->dic, 'baz', 'quux'), |
|
| 126 | )); |
|
| 127 | $expected = <<<EOT |
|
| 128 | n0 -- n1 -- n2 -- n3 -- n0 [ foo=bar, baz=quux ]; |
|
| 129 | ||
| 130 | EOT; |
|
| 131 | $actual = $this->MultiEdge->build(false); |
|
| 132 | $this->assertEquals($expected, $actual); |
|
| 133 | } |
|
| 134 | ||
| 135 | // Attribute list with empty title in middle on unbound multiedge. |
|
| 136 | public function testBuildAttributesEmptyMiddle() { |
|
| @@ 136-148 (lines=13) @@ | ||
| 133 | } |
|
| 134 | ||
| 135 | // Attribute list with empty title in middle on unbound multiedge. |
|
| 136 | public function testBuildAttributesEmptyMiddle() { |
|
| 137 | $this->MultiEdge->setAttributes(array( |
|
| 138 | new Attribute($this->dic, 'foo', 'bar'), |
|
| 139 | new Attribute($this->dic, 'title', ''), |
|
| 140 | new Attribute($this->dic, 'baz', 'quux'), |
|
| 141 | )); |
|
| 142 | $expected = <<<EOT |
|
| 143 | n0 -- n1 -- n2 -- n3 -- n0 [ foo=bar, baz=quux ]; |
|
| 144 | ||
| 145 | EOT; |
|
| 146 | $actual = $this->MultiEdge->build(false); |
|
| 147 | $this->assertEquals($expected, $actual); |
|
| 148 | } |
|
| 149 | ||
| 150 | // Attribute list with empty title as single attribute on unbound multiedge. |
|
| 151 | public function testBuildAttributesOnlyEmpty() { |
|
| @@ 164-176 (lines=13) @@ | ||
| 161 | } |
|
| 162 | ||
| 163 | // Attribute list with empty title as last attribute on unbound multiedge. |
|
| 164 | public function testBuildAttributesEmptyLast() { |
|
| 165 | $this->MultiEdge->setAttributes(array( |
|
| 166 | new Attribute($this->dic, 'foo', 'bar'), |
|
| 167 | new Attribute($this->dic, 'baz', 'quux'), |
|
| 168 | new Attribute($this->dic, 'title', ''), |
|
| 169 | )); |
|
| 170 | $expected = <<<EOT |
|
| 171 | n0 -- n1 -- n2 -- n3 -- n0 [ foo=bar, baz=quux ]; |
|
| 172 | ||
| 173 | EOT; |
|
| 174 | $actual = $this->MultiEdge->build(false); |
|
| 175 | $this->assertEquals($expected, $actual); |
|
| 176 | } |
|
| 177 | ||
| 178 | /** |
|
| 179 | * Tests MultiEdge::getAllowedChildTypes() |
|
| @@ 115-127 (lines=13) @@ | ||
| 112 | } |
|
| 113 | ||
| 114 | // Attribute list with empty title in middle. |
|
| 115 | public function testBuildAttributesEmptyMiddle() { |
|
| 116 | $this->Node->setAttributes(array( |
|
| 117 | new Attribute($this->dic, 'foo', 'bar'), |
|
| 118 | new Attribute($this->dic, 'title', ''), |
|
| 119 | new Attribute($this->dic, 'baz', 'quux'), |
|
| 120 | )); |
|
| 121 | $expected = <<<EOT |
|
| 122 | n1 [ foo=bar, baz=quux ]; |
|
| 123 | ||
| 124 | EOT; |
|
| 125 | $actual = $this->Node->build(); |
|
| 126 | $this->assertEquals($expected, $actual); |
|
| 127 | } |
|
| 128 | ||
| 129 | // Attribute list with empty title as single attribute. |
|
| 130 | public function testBuildAttributesOnlyEmpty() { |
|
| @@ 143-155 (lines=13) @@ | ||
| 140 | } |
|
| 141 | ||
| 142 | // Attribute list with empty title as last attribute. |
|
| 143 | public function testBuildAttributesEmptyLast() { |
|
| 144 | $this->Node->setAttributes(array( |
|
| 145 | new Attribute($this->dic, 'foo', 'bar'), |
|
| 146 | new Attribute($this->dic, 'baz', 'quux'), |
|
| 147 | new Attribute($this->dic, 'title', ''), |
|
| 148 | )); |
|
| 149 | $expected = <<<EOT |
|
| 150 | n1 [ foo=bar, baz=quux ]; |
|
| 151 | ||
| 152 | EOT; |
|
| 153 | $actual = $this->Node->build(); |
|
| 154 | $this->assertEquals($expected, $actual); |
|
| 155 | } |
|
| 156 | ||
| 157 | /** |
|
| 158 | * Tests Node::getAllowedChildTypes() |
|
| @@ 72-87 (lines=16) @@ | ||
| 69 | } |
|
| 70 | ||
| 71 | // Attribute list with empty title in middle. |
|
| 72 | public function testBuildAttributesEmptyMiddle() { |
|
| 73 | $this->Graph->setAttributes(array( |
|
| 74 | new Attribute($this->dic, 'foo', 'bar'), |
|
| 75 | new Attribute($this->dic, 'title', ''), |
|
| 76 | new Attribute($this->dic, 'baz', 'quux'), |
|
| 77 | )); |
|
| 78 | $expected = <<<EOT |
|
| 79 | digraph G { |
|
| 80 | foo=bar; |
|
| 81 | baz=quux; |
|
| 82 | } /* /digraph G */ |
|
| 83 | ||
| 84 | EOT; |
|
| 85 | $actual = $this->Graph->build(); |
|
| 86 | $this->assertEquals($expected, $actual); |
|
| 87 | } |
|
| 88 | ||
| 89 | // Attribute list with empty title as single attribute. |
|
| 90 | public function testBuildAttributesOnlyEmpty() { |
|
| @@ 104-119 (lines=16) @@ | ||
| 101 | } |
|
| 102 | ||
| 103 | // Attribute list with empty title as last attribute. |
|
| 104 | public function testBuildAttributesEmptyLast() { |
|
| 105 | $this->Graph->setAttributes(array( |
|
| 106 | new Attribute($this->dic, 'foo', 'bar'), |
|
| 107 | new Attribute($this->dic, 'baz', 'quux'), |
|
| 108 | new Attribute($this->dic, 'title', ''), |
|
| 109 | )); |
|
| 110 | $expected = <<<EOT |
|
| 111 | digraph G { |
|
| 112 | foo=bar; |
|
| 113 | baz=quux; |
|
| 114 | } /* /digraph G */ |
|
| 115 | ||
| 116 | EOT; |
|
| 117 | $actual = $this->Graph->build(); |
|
| 118 | $this->assertEquals($expected, $actual); |
|
| 119 | } |
|
| 120 | ||
| 121 | /** |
|
| 122 | * Tests Graph::getAllowedChildTypes() |
|