format composer.json and add php-7.0 as dev-requirement (phpunit6); add unit-test for Backup.add() when customer passes / as path value

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2018-11-28 13:17:44 +01:00
parent c7bee4edf2
commit fd69fc22db
2 changed files with 80 additions and 55 deletions

View File

@@ -95,6 +95,28 @@ class CustomerBackupsTest extends TestCase
$this->assertEquals('0', $result['backup_web']);
}
/**
* @depends testCustomerCustomerBackupsAdd
*/
public function testCustomerCustomerBackupsAddPathNotDocroot()
{
global $admin_userdata;
// get customer
$json_result = Customers::getLocal($admin_userdata, array(
'loginname' => 'test1'
))->get();
$customer_userdata = json_decode($json_result, true)['data'];
$data = [
'path' => '/'
];
$this->expectExceptionCode(400);
$this->expectExceptionMessage('The folder for backups cannot be your homedir, please chose a folder within your homedir, e.g. /backups');
$json_result = CustomerBackups::getLocal($customer_userdata, $data)->add();
}
public function testAdminCustomerBackupsGet()
{
global $admin_userdata;