1--TEST-- 2Unit test for graph with ports 3--FILE-- 4<?php 5 6/** 7 * Test 16: "Drawing of hash table" 8 * 9 * Graph definition taken from GraphViz documentation 10 * 11 * @category Image 12 * @package Image_GraphViz 13 * @author Philippe Jausions <jausions@php.net> 14 */ 15require_once 'Image/GraphViz.php'; 16 17$graph = new Image_GraphViz(true, array(), 'G', false); 18 19$graph->setAttributes(array('nodesep' => 0.05, 20 'rankdir' => 'LR')); 21 22$graph->addNode('node0', array('shape' => 'record', 23 'label' => '<f0> |<f1> |<f2> |<f3> |<f4> |<f5> |<f6> | ', 24 'height' => 2.5)); 25$graph->addNode('node1', array('shape' => 'record', 26 'label' => '{<n> n14 | 719 |<p> }')); 27$graph->addNode('node2', array('shape' => 'record', 28 'label' => '{<n> a1 | 805 |<p> }')); 29$graph->addNode('node3', array('shape' => 'record', 30 'label' => '{<n> i9 | 718 |<p> }')); 31$graph->addNode('node4', array('shape' => 'record', 32 'label' => '{<n> e5 | 989 |<p> }')); 33$graph->addNode('node5', array('shape' => 'record', 34 'label' => '{<n> t20 | 959 |<p> }')); 35$graph->addNode('node6', array('shape' => 'record', 36 'label' => '{<n> o15 | 794 |<p> }')); 37$graph->addNode('node7', array('shape' => 'record', 38 'label' => '{<n> s19 | 659 |<p> }')); 39 40$graph->addEdge(array('node0' => 'node1'), null, 41 array('node0' => 'f0', 'node1' => 'n')); 42$graph->addEdge(array('node0' => 'node2'), null, 43 array('node0' => 'f1', 'node2' => 'n')); 44$graph->addEdge(array('node0' => 'node3'), null, 45 array('node0' => 'f2', 'node3' => 'n')); 46$graph->addEdge(array('node0' => 'node4'), null, 47 array('node0' => 'f5', 'node4' => 'n')); 48$graph->addEdge(array('node0' => 'node5'), null, 49 array('node0' => 'f6', 'node5' => 'n')); 50$graph->addEdge(array('node2' => 'node6'), null, 51 array('node2' => 'p', 'node6' => 'n')); 52$graph->addEdge(array('node4' => 'node7'), null, 53 array('node4' => 'p', 'node7' => 'n')); 54 55echo $graph->parse(); 56 57?> 58--EXPECT-- 59digraph G { 60 nodesep=0.05; 61 rankdir=LR; 62 node0 [ shape=record,label="<f0> |<f1> |<f2> |<f3> |<f4> |<f5> |<f6> | ",height=2.5 ]; 63 node1 [ shape=record,label="{<n> n14 | 719 |<p> }" ]; 64 node2 [ shape=record,label="{<n> a1 | 805 |<p> }" ]; 65 node3 [ shape=record,label="{<n> i9 | 718 |<p> }" ]; 66 node4 [ shape=record,label="{<n> e5 | 989 |<p> }" ]; 67 node5 [ shape=record,label="{<n> t20 | 959 |<p> }" ]; 68 node6 [ shape=record,label="{<n> o15 | 794 |<p> }" ]; 69 node7 [ shape=record,label="{<n> s19 | 659 |<p> }" ]; 70 node0:f0 -> node1:n; 71 node0:f1 -> node2:n; 72 node0:f2 -> node3:n; 73 node0:f5 -> node4:n; 74 node0:f6 -> node5:n; 75 node2:p -> node6:n; 76 node4:p -> node7:n; 77}