Skip to content

Commit

Permalink
Merge pull request #181 from iMattPro/updates
Browse files Browse the repository at this point in the history
Updates
  • Loading branch information
iMattPro committed May 14, 2023
2 parents 0724a20 + eef1ac2 commit 6fa3dad
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 43 deletions.
2 changes: 1 addition & 1 deletion acp/main_module.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function main($id, $mode)
$this->tpl_name = $mode . '_ads';

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

$admin_controller->{'mode_' . $mode}();
}
Expand Down
10 changes: 0 additions & 10 deletions controller/admin_controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,6 @@ public function set_page_url($u_action)
$this->u_action = $u_action;
}

/**
* Get ACP page title for Ads module
*
* @return string Language string for Ads ACP module
*/
public function get_page_title()
{
return $this->language->lang('ACP_PHPBB_ADS_TITLE');
}

/**
* Process user request for settings mode
*
Expand Down
8 changes: 0 additions & 8 deletions controller/ucp_controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,6 @@ public function set_page_url($u_action)
$this->u_action = $u_action;
}

/**
* @return string Module language string
*/
public function get_page_title()
{
return $this->language->lang('UCP_PHPBB_ADS_STATS');
}

/**
* Display UCP ads module
*/
Expand Down
9 changes: 0 additions & 9 deletions tests/controller/admin_controller_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,6 @@ public function get_controller()
return $controller;
}

/**
* Test get_page_title() method
*/
public function test_get_page_title()
{
$controller = $this->get_controller();
self::assertEquals($controller->get_page_title(), $this->language->lang('ACP_PHPBB_ADS_TITLE'));
}

/**
* Test mode_settings()
*/
Expand Down
1 change: 1 addition & 0 deletions tests/controller/admin_input_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ public function get_form_data_data()
array(true, ['Ad Name #1', 'Ad Note #1', 'Ad Code #1', 0, '', '', 'blah', 5, 0, 0, 0, '', [], false], 0, ['AD_END_DATE_INVALID']),
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']),
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']),
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']),
array(true, ['Ad Name #1', 'Ad Note #1', 'Ad Code #1', 0, '', '', '', 0, 0, 0, 0, '', [], false], 0, ['AD_PRIORITY_INVALID']),
array(true, ['Ad Name #1', 'Ad Note #1', 'Ad Code #1', 0, '', '', '', 11, 0, 0, 0, '', [], false], 0, ['AD_PRIORITY_INVALID']),
array(true, ['Ad Name #1', 'Ad Note #1', 'Ad Code #1', 0, '', '', '', 5, 0, -1, 0, '', [], false], 0, ['AD_VIEWS_LIMIT_INVALID']),
Expand Down
25 changes: 15 additions & 10 deletions tests/controller/ucp_controller_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,6 @@ public function get_controller()
return $controller;
}

/**
* Test get_page_title() method
*/
public function test_get_page_title()
{
$controller = $this->get_controller();

self::assertEquals($this->language->lang('UCP_PHPBB_ADS_STATS'), $controller->get_page_title());
}

/**
* Test data for the test_main() function
*
Expand Down Expand Up @@ -153,6 +143,17 @@ public function main_data()
'ad_views_limit' => 0,
'ad_clicks_limit' => 0,
),
array(
'ad_id' => 4,
'ad_name' => 'Fourth ad',
'ad_views' => 0,
'ad_clicks' => 0,
'ad_enabled' => 1,
'ad_start_date' => 0,
'ad_end_date' => 1,
'ad_views_limit' => 0,
'ad_clicks_limit' => 0,
),
)),
array(1, 0, array()),
array(0, 1, array()),
Expand All @@ -175,6 +176,10 @@ public function test_main($enable_views, $enable_clicks, $ads)
->method('get_ads_by_owner')
->willReturn($ads);

$this->helper->expects(self::exactly(count($ads)))
->method('is_expired')
->willReturnOnConsecutiveCalls(false, false, false, true);

$this->template->expects(self::exactly(count($ads)))
->method('assign_block_vars');

Expand Down
4 changes: 0 additions & 4 deletions tests/ucp/ucp_module_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,6 @@ public function test_main_module()
->expects(self::once())
->method('set_page_url');

$ucp_controller
->expects(self::once())
->method('get_page_title');

$ucp_controller
->expects(self::once())
->method('main');
Expand Down
2 changes: 1 addition & 1 deletion ucp/main_module.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function main()
$this->tpl_name = 'ucp_ads_stats';

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

$ucp_controller->main();
}
Expand Down

0 comments on commit 6fa3dad

Please sign in to comment.