Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
--TEST--
2
Unit test for graph with edges on clusters not "cluster"-named IDs
3
--FILE--
4
<?php
5
 
6
/**
7
 * Test 17: "Graph with edges on clusters not 'cluster'-named IDs"
8
 *
9
 * Graph definition taken from GraphViz documentation
10
 *
11
 * @category Image
12
 * @package  Image_GraphViz
13
 * @author   Philippe Jausions <jausions@php.net>
14
 */
15
require_once 'Image/GraphViz.php';
16
 
17
$graph = new Image_GraphViz(true, array('compound' => true), 'G', false);
18
 
19
$graph->addCluster(0, '');
20
$graph->addNode('a', null, 0);
21
$graph->addNode('b', null, 0);
22
$graph->addNode('c', null, 0);
23
$graph->addNode('d', null, 0);
24
 
25
$graph->addEdge(array('a' => 'b'));
26
$graph->addEdge(array('a' => 'c'));
27
$graph->addEdge(array('b' => 'd'));
28
$graph->addEdge(array('c' => 'd'));
29
 
30
$graph->addCluster(1, '');
31
$graph->addNode('e', null, 1);
32
$graph->addNode('f', null, 1);
33
$graph->addNode('g', null, 1);
34
 
35
$graph->addEdge(array('e' => 'g'));
36
$graph->addEdge(array('e' => 'f'));
37
 
38
$graph->addEdge(array('b' => 'f'), array('lhead' => 1));
39
$graph->addEdge(array('d' => 'e'));
40
$graph->addEdge(array('c' => 'g'), array('ltail' => 0,
41
                                         'lhead' => 1));
42
$graph->addEdge(array('c' => 'e'), array('ltail' => 0));
43
 
44
$graph->addEdge(array('d' => 'h'));
45
 
46
echo $graph->parse();
47
 
48
?>
49
--EXPECT--
50
digraph G {
51
    compound=true;
52
    subgraph cluster_0 {
53
        a;
54
        b;
55
        c;
56
        d;
57
    }
58
    subgraph cluster_1 {
59
        e;
60
        f;
61
        g;
62
    }
63
    a -> b;
64
    a -> c;
65
    b -> d;
66
    b -> f [ lhead=cluster_1 ];
67
    c -> d;
68
    c -> g [ ltail=cluster_0,lhead=cluster_1 ];
69
    c -> e [ ltail=cluster_0 ];
70
    e -> g;
71
    e -> f;
72
    d -> e;
73
    d -> h;
74
}