Skip to content

Commit

Permalink
Improve test coverage
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Friedman <[email protected]>
  • Loading branch information
iMattPro committed May 14, 2023
1 parent 2b61d3f commit eef1ac2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
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
15 changes: 15 additions & 0 deletions tests/controller/ucp_controller_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,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 @@ -165,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

0 comments on commit eef1ac2

Please sign in to comment.