@@ 31-49 (lines=19) @@ | ||
28 | $this->root = 'kuma_voting'; |
|
29 | } |
|
30 | ||
31 | public function testGetConfigWithOverrideDefaultValue() |
|
32 | { |
|
33 | $container = $this->getContainer(); |
|
34 | $container->setParameter('voting_default_value', 2); |
|
35 | $this->extension->load([['actions' => [['name' => 'foo', 'max_number_by_ip' => 2]]]], $container); |
|
36 | $this->assertTrue($container->hasParameter($this->root . '.actions')); |
|
37 | $this->assertInternalType('array', $container->getParameter($this->root . '.actions')); |
|
38 | ||
39 | $actions = $container->getParameter($this->root . '.actions'); |
|
40 | if (isset($actions['up_vote'])) { |
|
41 | $this->assertEquals(2, $actions['up_vote']['default_value']); |
|
42 | } |
|
43 | if (isset($actions['down_vote'])) { |
|
44 | $this->assertEquals(-2, $actions['down_vote']['default_value']); |
|
45 | } |
|
46 | if (isset($actions['facebook_like'])) { |
|
47 | $this->assertEquals(2, $actions['facebook_like']['default_value']); |
|
48 | } |
|
49 | } |
|
50 | ||
51 | public function testGetConfigWithDefaultValues() |
|
52 | { |
|
@@ 70-98 (lines=29) @@ | ||
67 | } |
|
68 | } |
|
69 | ||
70 | public function testGetConfigWithOverrideValues() |
|
71 | { |
|
72 | $configs = array( |
|
73 | 'actions' => array( |
|
74 | 'up_vote' => array( |
|
75 | 'default_value' => '2', |
|
76 | ), |
|
77 | 'down_vote' => array( |
|
78 | 'default_value' => '-5', |
|
79 | ), |
|
80 | ), |
|
81 | ); |
|
82 | ||
83 | $container = $this->getContainer(); |
|
84 | $this->extension->load(array($configs), $container); |
|
85 | $this->assertTrue($container->hasParameter($this->root . '.actions')); |
|
86 | $this->assertInternalType('array', $container->getParameter($this->root . '.actions')); |
|
87 | ||
88 | $actions = $container->getParameter($this->root . '.actions'); |
|
89 | if (isset($actions['up_vote'])) { |
|
90 | $this->assertEquals(2, $actions['up_vote']['default_value']); |
|
91 | } |
|
92 | if (isset($actions['down_vote'])) { |
|
93 | $this->assertEquals(-5, $actions['down_vote']['default_value']); |
|
94 | } |
|
95 | if (isset($actions['facebook_like'])) { |
|
96 | $this->assertEquals(1, $actions['facebook_like']['default_value']); |
|
97 | } |
|
98 | } |
|
99 | ||
100 | /** |
|
101 | * @return KunstmaanVotingExtension |