Skip to content

Commit 6fa3dad

Browse files
authored
Merge pull request #181 from iMattPro/updates
Updates
2 parents 0724a20 + eef1ac2 commit 6fa3dad

8 files changed

+18
-43
lines changed

acp/main_module.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function main($id, $mode)
4040
$this->tpl_name = $mode . '_ads';
4141

4242
// Set the page title for our ACP page
43-
$this->page_title = $admin_controller->get_page_title();
43+
$this->page_title = 'ACP_PHPBB_ADS_TITLE';
4444

4545
$admin_controller->{'mode_' . $mode}();
4646
}

controller/admin_controller.php

-10
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,6 @@ public function set_page_url($u_action)
108108
$this->u_action = $u_action;
109109
}
110110

111-
/**
112-
* Get ACP page title for Ads module
113-
*
114-
* @return string Language string for Ads ACP module
115-
*/
116-
public function get_page_title()
117-
{
118-
return $this->language->lang('ACP_PHPBB_ADS_TITLE');
119-
}
120-
121111
/**
122112
* Process user request for settings mode
123113
*

controller/ucp_controller.php

-8
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,6 @@ public function set_page_url($u_action)
6464
$this->u_action = $u_action;
6565
}
6666

67-
/**
68-
* @return string Module language string
69-
*/
70-
public function get_page_title()
71-
{
72-
return $this->language->lang('UCP_PHPBB_ADS_STATS');
73-
}
74-
7567
/**
7668
* Display UCP ads module
7769
*/

tests/controller/admin_controller_test.php

-9
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,6 @@ public function get_controller()
154154
return $controller;
155155
}
156156

157-
/**
158-
* Test get_page_title() method
159-
*/
160-
public function test_get_page_title()
161-
{
162-
$controller = $this->get_controller();
163-
self::assertEquals($controller->get_page_title(), $this->language->lang('ACP_PHPBB_ADS_TITLE'));
164-
}
165-
166157
/**
167158
* Test mode_settings()
168159
*/

tests/controller/admin_input_test.php

+1
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ public function get_form_data_data()
115115
array(true, ['Ad Name #1', 'Ad Note #1', 'Ad Code #1', 0, '', '', 'blah', 5, 0, 0, 0, '', [], false], 0, ['AD_END_DATE_INVALID']),
116116
array(true, ['Ad Name #1', 'Ad Note #1', 'Ad Code #1', 0, '', '1970-01-01', '', 5, 0, 0, 0, '', [], false], 0, ['AD_START_DATE_INVALID']),
117117
array(true, ['Ad Name #1', 'Ad Note #1', 'Ad Code #1', 0, '', '', '1970-01-01', 5, 0, 0, 0, '', [], false], 0, ['AD_END_DATE_INVALID']),
118+
array(true, ['Ad Name #1', 'Ad Note #1', 'Ad Code #1', 0, '', '2060-01-01', '2050-01-01', 5, 0, 0, 0, '', [], false], 0, ['END_DATE_TOO_SOON']),
118119
array(true, ['Ad Name #1', 'Ad Note #1', 'Ad Code #1', 0, '', '', '', 0, 0, 0, 0, '', [], false], 0, ['AD_PRIORITY_INVALID']),
119120
array(true, ['Ad Name #1', 'Ad Note #1', 'Ad Code #1', 0, '', '', '', 11, 0, 0, 0, '', [], false], 0, ['AD_PRIORITY_INVALID']),
120121
array(true, ['Ad Name #1', 'Ad Note #1', 'Ad Code #1', 0, '', '', '', 5, 0, -1, 0, '', [], false], 0, ['AD_VIEWS_LIMIT_INVALID']),

tests/controller/ucp_controller_test.php

+15-10
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,6 @@ public function get_controller()
101101
return $controller;
102102
}
103103

104-
/**
105-
* Test get_page_title() method
106-
*/
107-
public function test_get_page_title()
108-
{
109-
$controller = $this->get_controller();
110-
111-
self::assertEquals($this->language->lang('UCP_PHPBB_ADS_STATS'), $controller->get_page_title());
112-
}
113-
114104
/**
115105
* Test data for the test_main() function
116106
*
@@ -153,6 +143,17 @@ public function main_data()
153143
'ad_views_limit' => 0,
154144
'ad_clicks_limit' => 0,
155145
),
146+
array(
147+
'ad_id' => 4,
148+
'ad_name' => 'Fourth ad',
149+
'ad_views' => 0,
150+
'ad_clicks' => 0,
151+
'ad_enabled' => 1,
152+
'ad_start_date' => 0,
153+
'ad_end_date' => 1,
154+
'ad_views_limit' => 0,
155+
'ad_clicks_limit' => 0,
156+
),
156157
)),
157158
array(1, 0, array()),
158159
array(0, 1, array()),
@@ -175,6 +176,10 @@ public function test_main($enable_views, $enable_clicks, $ads)
175176
->method('get_ads_by_owner')
176177
->willReturn($ads);
177178

179+
$this->helper->expects(self::exactly(count($ads)))
180+
->method('is_expired')
181+
->willReturnOnConsecutiveCalls(false, false, false, true);
182+
178183
$this->template->expects(self::exactly(count($ads)))
179184
->method('assign_block_vars');
180185

tests/ucp/ucp_module_test.php

-4
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,6 @@ public function test_main_module()
111111
->expects(self::once())
112112
->method('set_page_url');
113113

114-
$ucp_controller
115-
->expects(self::once())
116-
->method('get_page_title');
117-
118114
$ucp_controller
119115
->expects(self::once())
120116
->method('main');

ucp/main_module.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function main()
3838
$this->tpl_name = 'ucp_ads_stats';
3939

4040
// Set the page title for our UCP page
41-
$this->page_title = $ucp_controller->get_page_title();
41+
$this->page_title = 'UCP_PHPBB_ADS_STATS';
4242

4343
$ucp_controller->main();
4444
}

0 commit comments

Comments
 (0)