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 fancy graph (comment, colors, shapes)
3
--FILE--
4
<?php
5
 
6
/**
7
 * Test 3: "Fancy graph"
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, null, 'G', false);
18
 
19
$graph->addNode('main', array('shape' => 'box',
20
                              'comment' => 'this is a comment'));
21
 
22
$graph->addEdge(array('main' => 'parse'), array('weight' => 8));
23
 
24
$graph->addEdge(array('parse' => 'execute'));
25
$graph->addEdge(array('main' => 'init'), array('style' => 'dotted'));
26
$graph->addEdge(array('main' => 'cleanup'));
27
$graph->addEdge(array('execute' => 'make_string'));
28
$graph->addEdge(array('execute' => 'printf'));
29
$graph->addEdge(array('init' => 'make_string'));
30
 
31
$graph->addEdge(array('main' => 'printf'), array('style' => 'bold',
32
                                                 'label' => '100 times'));
33
$graph->addNode('make_string', array('label' => "make a\nstring"));
34
$graph->addNode('compare', array('shape' => 'box',
35
                                 'style' => 'filled',
36
                                 'color' => '.7 .3 1.0'));
37
$graph->addEdge(array('execute' => 'compare'), array('color' => 'red',
38
                                                     'comment' => 'so is this'));
39
 
40
echo $graph->parse();
41
 
42
?>
43
--EXPECT--
44
digraph G {
45
    main [ shape=box,comment="this is a comment" ];
46
    make_string [ label="make a\nstring" ];
47
    compare [ shape=box,style=filled,color=".7 .3 1.0" ];
48
    main -> parse [ weight=8 ];
49
    main -> init [ style=dotted ];
50
    main -> cleanup;
51
    main -> printf [ style=bold,label="100 times" ];
52
    parse -> execute;
53
    execute -> make_string;
54
    execute -> printf;
55
    execute -> compare [ color=red,comment="so is this" ];
56
    init -> make_string;
57
}