implement EmailForwarders.listing(); fixes #754

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2019-11-15 07:20:16 +01:00
parent fe7bfcc7c2
commit 3cc5352c01
2 changed files with 110 additions and 15 deletions

View File

@@ -191,6 +191,38 @@ class MailsTest extends TestCase
$this->assertEquals('other@domain.tld other2@domain.tld', $result['destination']);
}
/**
*
* @depends testCustomerEmailForwardersAddAnother
*/
public function testCustomerEmailForwardersListing()
{
global $admin_userdata;
Settings::Set('panel.customer_hide_options', '', true);
// get customer
$json_result = Customers::getLocal($admin_userdata, array(
'loginname' => 'test1'
))->get();
$customer_userdata = json_decode($json_result, true)['data'];
$data = [
'emailaddr' => 'info@test2.local'
];
$json_result = EmailForwarders::getLocal($customer_userdata, $data)->listing();
$result = json_decode($json_result, true)['data'];
$this->assertEquals(2, $result['count']);
$this->assertEquals(0, $result['list'][0]['id']);
$this->assertEquals('other@domain.tld', $result['list'][0]['address']);
$this->assertEquals(1, $result['list'][1]['id']);
$this->assertEquals('other2@domain.tld', $result['list'][1]['address']);
$json_result = EmailForwarders::getLocal($customer_userdata, $data)->listingCount();
$result = json_decode($json_result, true)['data'];
$this->assertEquals(2, $result);
}
/**
*
* @depends testCustomerEmailForwardersDeleteEmailHidden
@@ -292,13 +324,6 @@ class MailsTest extends TestCase
EmailForwarders::getLocal($admin_userdata)->update();
}
public function testAdminEmailForwadersUndefinedListing()
{
global $admin_userdata;
$this->expectExceptionCode(303);
EmailForwarders::getLocal($admin_userdata)->listing();
}
/**
*
* @depends testCustomerEmailForwardersAddAnother