blob: 481230d4ba5c0d7101de0eb6edcd28818f6efae9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Test for PMA\libraries\navigation\nodes\NodeDatabaseChild
*
* @package PhpMyAdmin-test
*/
use PMA\libraries\navigation\NodeFactory;
use PMA\libraries\navigation\nodes\NodeDatabaseChild;
use PhpMyAdmin\Theme;
use PhpMyAdmin\Url;
require_once 'libraries/relation.lib.php';
require_once 'test/PMATestCase.php';
/**
* Tests for PMA\libraries\navigation\nodes\NodeDatabaseChild class
*
* @package PhpMyAdmin-test
*/
class NodeDatabaseChildTest extends PMATestCase
{
/**
* @var NodeDatabaseChild
*/
protected $object;
/**
* Sets up the fixture.
*
* @access protected
* @return void
*/
protected function setUp()
{
$GLOBALS['pmaThemePath'] = $_SESSION['PMA_Theme']->getPath();
$GLOBALS['cfg']['DefaultTabDatabase'] = 'structure';
$GLOBALS['server'] = 1;
$GLOBALS['cfg']['ServerDefault'] = 1;
$GLOBALS['pmaThemeImage'] = '';
$_SESSION['relation'][1]['PMA_VERSION'] = PMA_VERSION;
$_SESSION['relation'][1]['navwork'] = true;
$this->object = $this->getMockForAbstractClass(
'PMA\libraries\navigation\nodes\NodeDatabaseChild', array('child')
);
}
/**
* Tears down the fixture.
*
* @access protected
* @return void
*/
protected function tearDown()
{
unset($this->object);
}
/**
* Tests getHtmlForControlButtons() method
*
* @return void
* @test
*/
public function testGetHtmlForControlButtons()
{
$parent = NodeFactory::getInstance('NodeDatabase', 'parent');
$parent->addChild($this->object);
$this->object->expects($this->once())
->method('getItemType')
->will($this->returnValue('itemType'));
$html = $this->object->getHtmlForControlButtons();
$this->assertStringStartsWith(
'<span class="navItemControls">',
$html
);
$this->assertStringEndsWith(
'</span>',
$html
);
$this->assertContains(
'<a href="navigation.php?'
. 'hideNavItem=1&itemType=itemType&itemName=child'
. '&dbName=parent&lang=en" class="hideNavItem ajax">',
$html
);
}
}
|