Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
--TEST--
2
Bug #16872: Cluster IDs start with "cluster"
3
--FILE--
4
<?php
5
 
6
/**
7
 * Bug 16872: "Cluster IDs start with 'cluster'"
8
 *
9
 * Cluster ID must start with "cluster" to have a box around it
10
 *
11
 * @category Image
12
 * @package  Image_GraphViz
13
 * @author   Philippe Jausions <jausions@php.net>
14
 * @link     http://pear.php.net/bugs/bug.php?id=16872
15
 */
16
require_once 'Image/GraphViz.php';
17
 
18
$graph = new Image_GraphViz(true, array('rankdir' => 'LR',
19
                                        'ranksep' => .75),
20
                         'sp_d_rcp_001', false);
21
$graph->addCluster('pck_courbe_rcp', 'pck_courbe_rcp',
22
                array('color' => 'green'));
23
$graph->addNode('sp_d_rcp_001', array('shape' => 'component'), 'pck_courbe_rcp');
24
$result = array(
25
    array('tab' => 'courbe_rcp', 'action' => 'S'),
26
    array('tab' => 'courbe_rcp', 'action' => 'D'),
27
    array('tab' => 'detail_rcp', 'action' => 'S'),
28
    array('tab' => 'detail_rcp', 'action' => 'D'),
29
);
30
$lst_tab = array();
31
foreach ($result as $row) {
32
    $table = $row['tab'];
33
    $action = $row['action'];
34
    if (array_key_exists($table, $lst_tab) == false){
35
        $graph->addNode($table, array('shape' => 'box'));
36
        $lst_tab[] = $table;
37
    }
38
    $color = ($action == 'D') ? 'red' : 'blue';
39
    $graph->addEdge(array('sp_d_rcp_001' => $table),
40
                 array('color' => $color,
41
                       'label' => $action,
42
                       'id' => $action.$table));
43
}
44
 
45
echo $graph->parse();
46
 
47
?>
48
--EXPECT--
49
digraph sp_d_rcp_001 {
50
    rankdir=LR;
51
    ranksep=0.75;
52
    courbe_rcp [ shape=box ];
53
    detail_rcp [ shape=box ];
54
    subgraph cluster_pck_courbe_rcp {
55
        graph [ color=green,label=pck_courbe_rcp ];
56
        sp_d_rcp_001 [ shape=component ];
57
    }
58
    sp_d_rcp_001 -> courbe_rcp [ color=blue,label=S,id=Scourbe_rcp ];
59
    sp_d_rcp_001 -> courbe_rcp [ color=red,label=D,id=Dcourbe_rcp ];
60
    sp_d_rcp_001 -> detail_rcp [ color=blue,label=S,id=Sdetail_rcp ];
61
    sp_d_rcp_001 -> detail_rcp [ color=red,label=D,id=Ddetail_rcp ];
62
}