-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLinkOrderTest.php
More file actions
87 lines (74 loc) · 1.75 KB
/
LinkOrderTest.php
File metadata and controls
87 lines (74 loc) · 1.75 KB
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
<?php
/**
* LinkOrder Test Case
*
* @author Jun Nishikawa <topaz2@m0n0m0n0.com>
* @link http://www.netcommons.org NetCommons Project
* @license http://www.netcommons.org/license.txt NetCommons License
*/
App::uses('LinkOrder', 'Links.Model');
class LinkOrderTesting extends LinkOrder{
public $useTable = 'link_orders';
public $alias = 'LinkOrder';
public function _getMaxWeightByLinkCategoryKey($linkCategoryKey) {
return parent::_getMaxWeightByLinkCategoryKey($linkCategoryKey);
}
}
/**
* Summary for LinkOrder Test Case
*/
class LinkOrderTest extends CakeTestCase {
/**
* Fixtures
*
* @var array
*/
public $fixtures = array(
'plugin.links.link_order',
'plugin.links.link_category',
'plugin.links.link_category_order',
'plugin.links.link',
'plugin.links.block',
);
/**
* setUp method
*
* @return void
*/
public function setUp() {
parent::setUp();
$this->LinkOrder = ClassRegistry::init('Links.LinkOrder');
$this->LinkOrderTesting = ClassRegistry::init('Links.LinkOrderTesting');
}
/**
* tearDown method
*
* @return void
*/
public function tearDown() {
unset($this->LinkOrder);
parent::tearDown();
}
public function testGetMaxWeight() {
$key = 'ckey1';
$max = $this->LinkOrderTesting->_getMaxWeightByLinkCategoryKey($key);
$this->assertEqual($max, 10);
$max = $this->LinkOrderTesting->_getMaxWeightByLinkCategoryKey('noDataKey');
$this->assertEqual($max, 0);
}
public function testAddLinkOrder() {
// $link = array(
// 'Link' => array(
// 'description' => "desc",
// 'link_category_id' => 2,
// 'status' => 1,
// 'title' => 'title',
// 'url' => 'url'
// )
// );
$link = array(
'Link' => array('key' => 'key01', 'link_category_id' => 1)
);
$this->LinkOrder->addLinkOrder($link);
}
}