Skip to content

Commit 96ad70a

Browse files
committed
Fix test notices
1 parent 3fae156 commit 96ad70a

2 files changed

Lines changed: 13 additions & 13 deletions

File tree

controller/admin_controller.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -380,20 +380,20 @@ protected function ad_enable($enable)
380380
'ad_enabled' => (int) $enable,
381381
));
382382

383-
// If AJAX was used, show user a result message
384-
if ($this->request->is_ajax())
385-
{
386-
$json_response = new \phpbb\json_response;
387-
$json_response->send(array(
388-
'text' => $this->language->lang($enable ? 'ENABLED' : 'DISABLED'),
389-
'title' => $this->language->lang('AD_ENABLE_TITLE', (int) $enable),
390-
));
391-
}
392-
393-
// Otherwise, show traditional infobox
394383
if ($success)
395384
{
396-
$this->success($enable ? 'ACP_AD_ENABLE_SUCCESS' : 'ACP_AD_DISABLE_SUCCESS');
385+
if ($this->request->is_ajax())
386+
{
387+
$json_response = new \phpbb\json_response;
388+
$json_response->send(array(
389+
'text' => $this->language->lang($enable ? 'ENABLED' : 'DISABLED'),
390+
'title' => $this->language->lang('AD_ENABLE_TITLE', (int) $enable),
391+
));
392+
}
393+
else
394+
{
395+
$this->success($enable ? 'ACP_AD_ENABLE_SUCCESS' : 'ACP_AD_DISABLE_SUCCESS');
396+
}
397397
}
398398
else
399399
{

tests/controller/admin_controller_test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ public function test_ad_enable($ad_id, $enable, $is_ajax, $err_msg)
926926
->method('update_ad')
927927
->willReturn((bool) $ad_id);
928928

929-
$this->request->expects(self::once())
929+
$this->request->expects($ad_id ? self::once() : self::never())
930930
->method('is_ajax')
931931
->willReturn($is_ajax);
932932

0 commit comments

Comments
 (0)