mirror of
https://github.com/FOSSBilling/FOSSBilling.git
synced 2026-12-04 22:24:42 +09:00
Merge pull request #4 from boxbilling/master
Synchronize with origin repo
This commit is contained in:
211 files changed
+3349
-2921
No files matched your search
+33
-33
@@ -1,34 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<phpunit backupGlobals="false"
|
||||
backupStaticAttributes="false"
|
||||
colors="true"
|
||||
convertErrorsToExceptions="true"
|
||||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
processIsolation="false"
|
||||
stopOnFailure="false"
|
||||
syntaxCheck="false"
|
||||
beStrictAboutChangesToGlobalState="true"
|
||||
bootstrap="tests/bootstrap.php"
|
||||
>
|
||||
<filter>
|
||||
<whitelist excludeVendorFiles="true">
|
||||
<directory suffix=".php">src</directory>
|
||||
<exclude>
|
||||
<file>src/rb.php</file>
|
||||
<file>src/bb-modules/Spamchecker/recaptchalib.php</file>
|
||||
<file>src/bb-modules/Spamchecker/akismet.curl.class.php</file>
|
||||
<file>src/bb-library/Box/Zip.php</file>
|
||||
<directory>src/bb-vendor</directory>
|
||||
<directory>src/bb-data</directory>
|
||||
<directory>src/bb-library/Registrar/includes</directory>
|
||||
<directory>src/bb-modules/Filemanager/src</directory>
|
||||
<directory>src/bb-modules/Servicecentovacast/ccapiclient</directory>
|
||||
<directory>src/bb-library/php-gettext</directory>
|
||||
<directory>src/bb-themes</directory>
|
||||
<directory>src/install</directory>
|
||||
</exclude>
|
||||
</whitelist>
|
||||
</filter>
|
||||
</phpunit>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" beStrictAboutChangesToGlobalState="true" bootstrap="tests/bootstrap.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
|
||||
<coverage processUncoveredFiles="true">
|
||||
<include>
|
||||
<directory suffix=".php">src</directory>
|
||||
</include>
|
||||
<exclude>
|
||||
<file>src/rb.php</file>
|
||||
<file>src/bb-modules/Spamchecker/recaptchalib.php</file>
|
||||
<file>src/bb-modules/Spamchecker/akismet.curl.class.php</file>
|
||||
<file>src/bb-library/Box/Zip.php</file>
|
||||
<directory>src/bb-vendor</directory>
|
||||
<directory>src/bb-data</directory>
|
||||
<directory>src/bb-library/Registrar/includes</directory>
|
||||
<directory>src/bb-modules/Filemanager/src</directory>
|
||||
<directory>src/bb-modules/Servicecentovacast/ccapiclient</directory>
|
||||
<directory>src/bb-library/php-gettext</directory>
|
||||
<directory>src/bb-themes</directory>
|
||||
<directory>src/install</directory>
|
||||
</exclude>
|
||||
</coverage>
|
||||
<testsuites>
|
||||
<testsuite name="Library">
|
||||
<directory>tests/bb-library</directory>
|
||||
</testsuite>
|
||||
<testsuite name="Integration">
|
||||
<directory>tests/integration</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<php>
|
||||
<ini name="display_errors" value="On"/>
|
||||
<ini name="display_startup_errors" value="On"/>
|
||||
</php>
|
||||
</phpunit>
|
||||
@@ -313,7 +313,18 @@ class Service implements \Box\InjectionAwareInterface
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
$mod = $this->di['mod']('email');
|
||||
$settings = $mod->getConfig();
|
||||
|
||||
if (isset($settings['log_enabled']) && $settings['log_enabled']) {
|
||||
$activityService = $this->di['mod_service']('activity');
|
||||
$activityService->logEmail($email->subject, $email->client_id, $email->sender, $email->recipients, $email->content_html, $email->content_text);
|
||||
}
|
||||
|
||||
$mail->send($transport, $settings);
|
||||
|
||||
|
||||
} catch (\Exception $e) {
|
||||
error_log($e->getMessage());
|
||||
}
|
||||
@@ -323,9 +334,6 @@ class Service implements \Box\InjectionAwareInterface
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function templateGetSearchQuery($data)
|
||||
{
|
||||
$query = "SELECT * FROM email_template";
|
||||
|
||||
+1
-2
@@ -40,8 +40,7 @@
|
||||
},
|
||||
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^7.0",
|
||||
"phpunit/dbunit": "4.0.0",
|
||||
"phpunit/phpunit": "^9.0",
|
||||
"squizlabs/php_codesniffer": "1.*"
|
||||
|
||||
},
|
||||
|
||||
Generated
+835
-494
File diff suppressed because it is too large.
Load diff
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
class Box_ConfigTest extends PHPUnit_Framework_TestCase
|
||||
class Box_ConfigTest extends PHPUnit\Framework\TestCase
|
||||
{
|
||||
public function testConfig()
|
||||
{
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @group Core
|
||||
*/
|
||||
class Box_CryptTest extends PHPUnit_Framework_TestCase
|
||||
class Box_CryptTest extends PHPUnit\Framework\TestCase
|
||||
{
|
||||
public function testCrypt()
|
||||
{
|
||||
+4
-2
@@ -2,9 +2,11 @@
|
||||
/**
|
||||
* @group Core
|
||||
*/
|
||||
class Box_EventsManagerTest extends PHPUnit_Framework_TestCase
|
||||
class Box_EventManagerTest extends PHPUnit\Framework\TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @doesNotPerformAssertions
|
||||
*/
|
||||
public function testEmptyFire()
|
||||
{
|
||||
$manager = new Box_EventManager();
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @group Core
|
||||
*/
|
||||
class Box_ExceptionTest extends PHPUnit_Framework_TestCase
|
||||
class Box_ExceptionTest extends PHPUnit\Framework\TestCase
|
||||
{
|
||||
|
||||
public function testException()
|
||||
@@ -13,6 +13,6 @@ class Box_ExceptionTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$uri = 'client/manage';
|
||||
$e = new Box_ExceptionAuth($uri);
|
||||
$this->assertInstanceOf('Box_ExceptionAuth', $e);
|
||||
$this->assertInstanceOf(Box_ExceptionAuth::class, $e);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/**
|
||||
* @group Core
|
||||
*/
|
||||
class Box_LicenseTest extends PHPUnit\Framework\TestCase
|
||||
{
|
||||
protected function setup() : void
|
||||
{
|
||||
global $di;
|
||||
$this->di = $di;
|
||||
}
|
||||
|
||||
public function testLicense()
|
||||
{
|
||||
self::expectNotToPerformAssertions();
|
||||
$license = $this->di['license'];
|
||||
$license->getDetails();
|
||||
$license->getDetails(true);
|
||||
}
|
||||
}
|
||||
@@ -2,11 +2,11 @@
|
||||
/**
|
||||
* @group Core
|
||||
*/
|
||||
class Box_LogTest extends PHPUnit_Framework_TestCase
|
||||
class Box_LogTest extends PHPUnit\Framework\TestCase
|
||||
{
|
||||
public function testLog()
|
||||
{
|
||||
$service_mock = $this->getMockBuilder('Box\\Mod\\Activity\\Service')->getMock();
|
||||
$service_mock = $this->getMockBuilder(Box\Mod\Activity\Service::class)->getMock();
|
||||
$service_mock->expects($this->atLeastOnce())
|
||||
->method('logEvent')
|
||||
->will($this->returnValue(true));
|
||||
@@ -2,14 +2,14 @@
|
||||
/**
|
||||
* @group Core
|
||||
*/
|
||||
class Box_MailTest extends PHPUnit_Framework_TestCase
|
||||
class Box_MailTest extends PHPUnit\Framework\TestCase
|
||||
{
|
||||
|
||||
public function testsend_TransportSendMail()
|
||||
{
|
||||
$transport = 'sendmail';
|
||||
|
||||
$mailMock = $this->getMockBuilder('Box_Mail')
|
||||
$mailMock = $this->getMockBuilder(Box_Mail::class)
|
||||
->setMethods(array('_sendMail'))
|
||||
->getMock();
|
||||
|
||||
@@ -41,7 +41,9 @@ class Box_MailTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$mail = new Box_Mail();
|
||||
|
||||
$this->setExpectedException('\Box_Exception', sprintf('Unknown mail transport: %s', $transport));
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage(sprintf('Unknown mail transport: %s', $transport));
|
||||
|
||||
$mail->send($transport);
|
||||
}
|
||||
|
||||
@@ -51,7 +53,7 @@ class Box_MailTest extends PHPUnit_Framework_TestCase
|
||||
$mail = new Box_Mail();
|
||||
|
||||
$result = $mail->setBodyHtml($context);
|
||||
$this->assertInstanceOf('Box_Mail', $result);
|
||||
$this->assertInstanceOf(Box_Mail::class, $result);
|
||||
|
||||
$result = $mail->getBody();
|
||||
$this->assertEquals($context, $result);
|
||||
@@ -64,7 +66,7 @@ class Box_MailTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$result = $mail->setFrom($context);
|
||||
|
||||
$this->assertInstanceOf('Box_Mail', $result);
|
||||
$this->assertInstanceOf(Box_Mail::class, $result);
|
||||
}
|
||||
|
||||
public function testsetSubject()
|
||||
@@ -73,7 +75,7 @@ class Box_MailTest extends PHPUnit_Framework_TestCase
|
||||
$mail = new Box_Mail();
|
||||
|
||||
$result = $mail->setSubject($context);
|
||||
$this->assertInstanceOf('Box_Mail', $result);
|
||||
$this->assertInstanceOf(Box_Mail::class, $result);
|
||||
|
||||
$result = $mail->getSubject();
|
||||
$this->assertEquals($context, $result);
|
||||
@@ -85,7 +87,7 @@ class Box_MailTest extends PHPUnit_Framework_TestCase
|
||||
$mail = new Box_Mail();
|
||||
|
||||
$result = $mail->setReplyTo($context);
|
||||
$this->assertInstanceOf('Box_Mail', $result);
|
||||
$this->assertInstanceOf(Box_Mail::class, $result);
|
||||
}
|
||||
|
||||
public function testaddTo()
|
||||
@@ -94,6 +96,6 @@ class Box_MailTest extends PHPUnit_Framework_TestCase
|
||||
$mail = new Box_Mail();
|
||||
|
||||
$result = $mail->addTo($context);
|
||||
$this->assertInstanceOf('Box_Mail', $result);
|
||||
$this->assertInstanceOf(Box_Mail::class, $result);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @group Core
|
||||
*/
|
||||
class Box_ModTest extends PHPUnit_Framework_TestCase
|
||||
class Box_ModTest extends PHPUnit\Framework\TestCase
|
||||
{
|
||||
public function testEmptyConfig()
|
||||
{
|
||||
@@ -27,7 +27,7 @@ class Box_ModTest extends PHPUnit_Framework_TestCase
|
||||
$this->assertTrue($mod->isCore());
|
||||
|
||||
$array = $mod->getCoreModules();
|
||||
$this->assertInternalType('array', $array);
|
||||
$this->assertIsArray($array);
|
||||
|
||||
$mod = new Box_Mod('example');
|
||||
$this->assertFalse($mod->isCore());
|
||||
@@ -43,7 +43,7 @@ class Box_ModTest extends PHPUnit_Framework_TestCase
|
||||
$this->assertTrue($bool);
|
||||
|
||||
$obj = $mod->getService();
|
||||
$this->assertInstanceOf('Box\\Mod\\Example\\Service', $obj);
|
||||
$this->assertInstanceOf(Box\Mod\Example\Service::class, $obj);
|
||||
|
||||
$bool = $mod->hasAdminController();
|
||||
$this->assertTrue($bool);
|
||||
@@ -52,13 +52,13 @@ class Box_ModTest extends PHPUnit_Framework_TestCase
|
||||
$this->assertTrue($bool);
|
||||
|
||||
$obj = $mod->getAdminController();
|
||||
$this->assertInstanceOf('Box\\Mod\\Example\\Controller\\Admin', $obj);
|
||||
$this->assertInstanceOf(Box\Mod\Example\Controller\Admin::class, $obj);
|
||||
|
||||
$bool = $mod->hasClientController();
|
||||
$this->assertTrue($bool);
|
||||
|
||||
$obj = $mod->getClientController();
|
||||
$this->assertInstanceOf('Box\\Mod\\Example\\Controller\\Client', $obj);
|
||||
$this->assertInstanceOf(Box\Mod\Example\Controller\Client::class, $obj);
|
||||
}
|
||||
|
||||
public function testManifest()
|
||||
@@ -73,7 +73,7 @@ class Box_ModTest extends PHPUnit_Framework_TestCase
|
||||
$this->assertTrue($bool);
|
||||
|
||||
$array = $mod->getManifest();
|
||||
$this->assertInternalType('array', $array);
|
||||
$this->assertIsArray($array);
|
||||
}
|
||||
|
||||
public function testInstall()
|
||||
@@ -106,7 +106,7 @@ class Box_ModTest extends PHPUnit_Framework_TestCase
|
||||
$subServiceName = 'transaction';
|
||||
|
||||
$subService = $mod->getService($subServiceName);
|
||||
$this->assertInstanceOf('\Box\Mod\Invoice\ServiceTransaction', $subService);
|
||||
$this->assertInstanceOf(\Box\Mod\Invoice\ServiceTransaction::class, $subService);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
|
||||
class Box_PasswordTest extends PHPUnit_Framework_TestCase {
|
||||
class Box_PasswordTest extends PHPUnit\Framework\TestCase {
|
||||
|
||||
public function testsetAlgo()
|
||||
{
|
||||
@@ -28,15 +28,15 @@ class Box_PasswordTest extends PHPUnit_Framework_TestCase {
|
||||
$boxPassword = new Box_Password();
|
||||
$password = '123456';
|
||||
$hash = $boxPassword->hashIt($password);
|
||||
$this->assertInternalType('string', $hash);
|
||||
$this->assertIsString($hash);
|
||||
$this->assertNotEmpty($hash);
|
||||
|
||||
$veryfied = $boxPassword->verify($password, $hash);
|
||||
$this->assertInternalType('bool', $veryfied);
|
||||
$this->assertIsBool($veryfied);
|
||||
$this->assertTrue($veryfied);
|
||||
|
||||
$needRehashing = $boxPassword->needsRehash($hash);
|
||||
$this->assertInternalType('bool', $needRehashing);
|
||||
$this->assertIsBool($needRehashing);
|
||||
$this->assertFalse($needRehashing);
|
||||
}
|
||||
|
||||
@@ -45,14 +45,14 @@ class Box_PasswordTest extends PHPUnit_Framework_TestCase {
|
||||
$boxPassword = new Box_Password();
|
||||
$password = '123456';
|
||||
$hash = $boxPassword->hashIt($password);
|
||||
$this->assertInternalType('string', $hash);
|
||||
$this->assertIsString($hash);
|
||||
$this->assertNotEmpty($hash);
|
||||
|
||||
$newOptions = array('cost' => 15);
|
||||
$boxPassword->setOptions($newOptions);
|
||||
|
||||
$needRehashing = $boxPassword->needsRehash($hash);
|
||||
$this->assertInternalType('bool', $needRehashing);
|
||||
$this->assertIsBool($needRehashing);
|
||||
$this->assertTrue($needRehashing);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,21 +2,21 @@
|
||||
/**
|
||||
* @group Core
|
||||
*/
|
||||
class Box_PeriodTest extends PHPUnit_Framework_TestCase
|
||||
class Box_PeriodTest extends PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
|
||||
public function testException()
|
||||
{
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Invalid period code. Period definition must be 2 chars length');
|
||||
$p = new Box_Period('1');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
}
|
||||
|
||||
public function testException2()
|
||||
{
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Period Error. Unit Z is not defined');
|
||||
$p = new Box_Period('1Z');
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @group Core
|
||||
*/
|
||||
class Box_RequestTest extends PHPUnit_Framework_TestCase
|
||||
class Box_RequestTest extends PHPUnit\Framework\TestCase
|
||||
{
|
||||
public function testDi()
|
||||
{
|
||||
@@ -94,14 +94,14 @@ class Box_RequestTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
$request = new Box_Request();
|
||||
$full_request = $request->getRawBody();
|
||||
$this->assertInternalType('string', $full_request);
|
||||
$this->assertIsString($full_request);
|
||||
}
|
||||
|
||||
public function testHeaders()
|
||||
{
|
||||
$request = new Box_Request();
|
||||
$headers = $request->getHeaders();
|
||||
$this->assertInternalType('array', $headers);
|
||||
$this->assertIsArray($headers);
|
||||
}
|
||||
|
||||
public function testGetMethod()
|
||||
@@ -152,16 +152,12 @@ class Box_RequestTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
public function testIs()
|
||||
{
|
||||
$request = $this->getMockBuilder('Box_Request')
|
||||
->setMethods(array('getMethod'))
|
||||
$request = $this->getMockBuilder(Box_Request::class)
|
||||
->setMethods(['getMethod'])
|
||||
->getMock();
|
||||
$request->expects($this->at(0))->method('getMethod')->will($this->returnValue('POST'));
|
||||
$request->expects($this->at(1))->method('getMethod')->will($this->returnValue('GET'));
|
||||
$request->expects($this->at(2))->method('getMethod')->will($this->returnValue('PUT'));
|
||||
$request->expects($this->at(3))->method('getMethod')->will($this->returnValue('PATCH'));
|
||||
$request->expects($this->at(4))->method('getMethod')->will($this->returnValue('HEAD'));
|
||||
$request->expects($this->at(5))->method('getMethod')->will($this->returnValue('DELETE'));
|
||||
$request->expects($this->at(6))->method('getMethod')->will($this->returnValue('OPTIONS'));
|
||||
$request->expects($this->exactly(7))
|
||||
->method('getMethod')
|
||||
->willReturnOnConsecutiveCalls('POST', 'GET', 'PUT', 'PATCH', 'HEAD', 'DELETE', 'OPTIONS');
|
||||
|
||||
$this->assertTrue($request->isPost());
|
||||
$this->assertTrue($request->isGet());
|
||||
@@ -175,18 +171,17 @@ class Box_RequestTest extends PHPUnit_Framework_TestCase
|
||||
public function testIsMethods()
|
||||
{
|
||||
$request = $this->getMockBuilder('Box_Request')
|
||||
->setMethods(array('getMethod'))
|
||||
->setMethods(['getMethod'])
|
||||
->getMock();
|
||||
$request->expects($this->at(0))->method('getMethod')->will($this->returnValue('POST'));
|
||||
$request->expects($this->at(1))->method('getMethod')->will($this->returnValue('GET'));
|
||||
$request->expects($this->at(2))->method('getMethod')->will($this->returnValue('GET'));
|
||||
$request->expects($this->at(3))->method('getMethod')->will($this->returnValue('PUT'));
|
||||
|
||||
$request->expects($this->exactly(4))
|
||||
->method('getMethod')
|
||||
->willReturnOnConsecutiveCalls('POST', 'GET', 'GET', 'PUT');
|
||||
|
||||
$this->assertTrue($request->isMethod('POST'));
|
||||
$this->assertFalse($request->isMethod('POST'));
|
||||
$this->assertTrue($request->isMethod(array('POST', 'GET')));
|
||||
$this->assertFalse($request->isMethod(array('POST', 'GET')));
|
||||
}
|
||||
}
|
||||
|
||||
public function testGetScheme()
|
||||
{
|
||||
@@ -194,17 +189,15 @@ class Box_RequestTest extends PHPUnit_Framework_TestCase
|
||||
->setMethods(array('getServer'))
|
||||
->getMock();
|
||||
|
||||
$request->expects($this->at(0))->method('getServer')->will($this->returnValueMap(
|
||||
array(
|
||||
array('HTTPS', '1'),
|
||||
)
|
||||
));
|
||||
|
||||
$request->expects($this->at(1))->method('getServer')->will($this->returnValueMap(
|
||||
array(
|
||||
array('HTTPS', null),
|
||||
)
|
||||
));
|
||||
$request->expects($this->exactly(2))
|
||||
->method('getServer')
|
||||
->will($this->onConsecutiveCalls($this->returnValueMap(
|
||||
[
|
||||
['HTTPS', '1'],
|
||||
['HTTPS', null]
|
||||
|
||||
]
|
||||
)));
|
||||
|
||||
$this->assertEquals('https', $request->getScheme());
|
||||
$this->assertEquals('http', $request->getScheme());
|
||||
@@ -216,17 +209,13 @@ class Box_RequestTest extends PHPUnit_Framework_TestCase
|
||||
->setMethods(array('getServer'))
|
||||
->getMock();
|
||||
|
||||
$request->expects($this->at(0))->method('getServer')->will($this->returnValueMap(
|
||||
array(
|
||||
array('HTTP_X_REQUESTED_WITH', 'XMLHttpRequest'),
|
||||
)
|
||||
));
|
||||
|
||||
$request->expects($this->at(1))->method('getServer')->will($this->returnValueMap(
|
||||
array(
|
||||
array('HTTP_X_REQUESTED_WITH', null),
|
||||
)
|
||||
));
|
||||
$request->expects($this->exactly(2))
|
||||
->method('getServer')
|
||||
->will($this->onConsecutiveCalls($this->returnValueMap(
|
||||
[
|
||||
['HTTP_X_REQUESTED_WITH', 'XMLHttpRequest'],
|
||||
['HTTP_X_REQUESTED_WITH', null]
|
||||
])));
|
||||
|
||||
$this->assertTrue($request->isAjax());
|
||||
$this->assertFalse($request->isAjax());
|
||||
@@ -238,15 +227,12 @@ class Box_RequestTest extends PHPUnit_Framework_TestCase
|
||||
->setMethods(array('getServer'))
|
||||
->getMock();
|
||||
|
||||
$request->expects($this->at(0))->method('getServer')->will($this->returnValueMap(
|
||||
array(
|
||||
array('SERVER_ADDR', '8.8.8.8'),
|
||||
)
|
||||
));
|
||||
|
||||
$request->expects($this->at(1))->method('getServer')->will($this->returnValueMap(
|
||||
array(
|
||||
array('SERVER_ADDR', null),
|
||||
$request->expects($this->exactly(2))
|
||||
->method('getServer')
|
||||
->will($this->onConsecutiveCalls($this->returnValueMap([
|
||||
['SERVER_ADDR', '8.8.8.8'],
|
||||
['SERVER_ADDR', null]
|
||||
]
|
||||
)
|
||||
));
|
||||
|
||||
@@ -260,15 +246,12 @@ class Box_RequestTest extends PHPUnit_Framework_TestCase
|
||||
->setMethods(array('getServer'))
|
||||
->getMock();
|
||||
|
||||
$request->expects($this->at(0))->method('getServer')->will($this->returnValueMap(
|
||||
array(
|
||||
array('SERVER_NAME', 'google.com'),
|
||||
)
|
||||
));
|
||||
|
||||
$request->expects($this->at(1))->method('getServer')->will($this->returnValueMap(
|
||||
array(
|
||||
array('SERVER_NAME', null),
|
||||
$request->expects($this->exactly(2))
|
||||
->method('getServer')
|
||||
->will($this->onConsecutiveCalls($this->returnValueMap([
|
||||
['SERVER_NAME', 'google.com'],
|
||||
['SERVER_NAME', null]
|
||||
]
|
||||
)
|
||||
));
|
||||
|
||||
@@ -282,8 +265,9 @@ class Box_RequestTest extends PHPUnit_Framework_TestCase
|
||||
->setMethods(array('getRawBody'))
|
||||
->getMock();
|
||||
|
||||
$request->expects($this->at(0))->method('getRawBody')->will($this->returnValue('{"example":1}'));
|
||||
$request->expects($this->at(1))->method('getRawBody')->will($this->returnValue('ss'));
|
||||
$request->expects($this->exactly(2))
|
||||
->method('getRawBody')
|
||||
->will($this->onConsecutiveCalls('{"example":1}', 'ss'));
|
||||
|
||||
$this->assertEquals(array('example'=>1), $request->getJsonRawBody());
|
||||
try {
|
||||
@@ -296,21 +280,18 @@ class Box_RequestTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
public function testGetClientAddressForwarded()
|
||||
{
|
||||
$request = $this->getMockBuilder('Box_Request')
|
||||
->setMethods(array('getServer'))
|
||||
->getMock();
|
||||
$request = $this->getMockBuilder(Box_Request::class)
|
||||
->setMethods(['getServer'])
|
||||
->getMock();
|
||||
|
||||
$request->expects($this->at(0))->method('getServer')->will($this->returnValueMap(
|
||||
array(
|
||||
array('HTTP_X_FORWARDED_FOR', '123.123.123.120'),
|
||||
$request->expects($this->exactly(2))
|
||||
->method('getServer')
|
||||
->withConsecutive(['HTTP_X_FORWARDED_FOR'], ['HTTP_X_FORWARDED_FOR'])
|
||||
->will($this->onConsecutiveCalls(
|
||||
'123.123.123.120',
|
||||
'123.123.123.121, 123.123.123.122'
|
||||
)
|
||||
));
|
||||
|
||||
$request->expects($this->at(1))->method('getServer')->will($this->returnValueMap(
|
||||
array(
|
||||
array('HTTP_X_FORWARDED_FOR', '123.123.123.121, 123.123.123.122'),
|
||||
)
|
||||
));
|
||||
);
|
||||
|
||||
$this->assertEquals('123.123.123.120', $request->getClientAddress());
|
||||
$this->assertEquals('123.123.123.121', $request->getClientAddress(true));
|
||||
@@ -321,18 +302,15 @@ class Box_RequestTest extends PHPUnit_Framework_TestCase
|
||||
$request = $this->getMockBuilder('Box_Request')
|
||||
->setMethods(array('getServer'))
|
||||
->getMock();
|
||||
|
||||
$request->expects($this->at(0))->method('getServer')->will($this->returnValueMap(
|
||||
array(
|
||||
array('REMOTE_ADDR', '123.123.123.1'),
|
||||
|
||||
$request->expects($this->exactly(2))
|
||||
->method('getServer')
|
||||
->withConsecutive(['REMOTE_ADDR'], ['REMOTE_ADDR'])
|
||||
->will($this->onConsecutiveCalls(
|
||||
'123.123.123.1',
|
||||
'123.123.123.2, 123.123.123.122'
|
||||
)
|
||||
));
|
||||
|
||||
$request->expects($this->at(1))->method('getServer')->will($this->returnValueMap(
|
||||
array(
|
||||
array('REMOTE_ADDR', '123.123.123.2, 123.123.123.122'),
|
||||
)
|
||||
));
|
||||
);
|
||||
|
||||
$this->assertEquals('123.123.123.1', $request->getClientAddress(false));
|
||||
$this->assertEquals('123.123.123.2', $request->getClientAddress(false));
|
||||
@@ -344,11 +322,11 @@ class Box_RequestTest extends PHPUnit_Framework_TestCase
|
||||
->setMethods(array('getServer'))
|
||||
->getMock();
|
||||
|
||||
$request->expects($this->at(0))->method('getServer')->will($this->returnValueMap(
|
||||
array(
|
||||
array('HTTP_USER_AGENT', 'Chrome'),
|
||||
)
|
||||
));
|
||||
$request->expects($this->exactly(2))
|
||||
->method('getServer')
|
||||
->withConsecutive(['HTTP_USER_AGENT'], ['HTTP_USER_AGENT'])
|
||||
->willReturnOnConsecutiveCalls('Chrome', null);
|
||||
|
||||
$this->assertEquals('Chrome', $request->getUserAgent());
|
||||
$this->assertNull($request->getUserAgent());
|
||||
}
|
||||
@@ -359,11 +337,10 @@ class Box_RequestTest extends PHPUnit_Framework_TestCase
|
||||
->setMethods(array('getServer'))
|
||||
->getMock();
|
||||
|
||||
$request->expects($this->at(0))->method('getServer')->will($this->returnValueMap(
|
||||
array(
|
||||
array('REQUEST_URI', '/foo/bar'),
|
||||
)
|
||||
));
|
||||
$request->expects($this->exactly(2))
|
||||
->method('getServer')
|
||||
->withConsecutive(['REQUEST_URI'], ['REQUEST_URI'])
|
||||
->willReturnOnConsecutiveCalls('/foo/bar', null);
|
||||
|
||||
$this->assertEquals('/foo/bar', $request->getURI());
|
||||
$this->assertNull($request->getURI());
|
||||
@@ -375,11 +352,10 @@ class Box_RequestTest extends PHPUnit_Framework_TestCase
|
||||
->setMethods(array('getServer'))
|
||||
->getMock();
|
||||
|
||||
$request->expects($this->at(0))->method('getServer')->will($this->returnValueMap(
|
||||
array(
|
||||
array('HTTP_HOST', 'www.google.com'),
|
||||
)
|
||||
));
|
||||
$request->expects($this->exactly(2))
|
||||
->method('getServer')
|
||||
->withConsecutive(['HTTP_HOST'], ['HTTP_HOST'])
|
||||
->willReturnOnConsecutiveCalls('www.google.com', null);
|
||||
|
||||
$this->assertEquals('www.google.com', $request->getHttpHost());
|
||||
$this->assertNull($request->getHttpHost());
|
||||
@@ -391,12 +367,10 @@ class Box_RequestTest extends PHPUnit_Framework_TestCase
|
||||
$request = $this->getMockBuilder('Box_Request')
|
||||
->setMethods(array('getServer'))
|
||||
->getMock();
|
||||
|
||||
$request->expects($this->at(0))->method('getServer')->will($this->returnValueMap(
|
||||
array(
|
||||
array('HTTP_ACCEPT_LANGUAGE', "en-US,en;q=0.8,fr;q=0.6,id;q=0.4,lt;q=0.2,ms;q=0.2,nl;q=0.2,pl;q=0.2,pt;q=0.2,ru;q=0.2,es;q=0.2,nb;q=0.2,ro;q=0.2"),
|
||||
)
|
||||
));
|
||||
$request->expects($this->once())->method('getServer')->will($this->returnValueMap(
|
||||
[
|
||||
['HTTP_ACCEPT_LANGUAGE', "en-US,en;q=0.8,fr;q=0.6,id;q=0.4,lt;q=0.2,ms;q=0.2,nl;q=0.2,pl;q=0.2,pt;q=0.2,ru;q=0.2,es;q=0.2,nb;q=0.2,ro;q=0.2"]
|
||||
]));
|
||||
|
||||
$result = array (
|
||||
0 =>
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @group Core
|
||||
*/
|
||||
class Box_SessionTestCase extends PHPUnit_Framework_TestCase
|
||||
class Box_SessionTest extends PHPUnit\Framework\TestCase
|
||||
{
|
||||
public function testSession()
|
||||
{
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @group Core
|
||||
*/
|
||||
class Box_TranslateTest extends PHPUnit_Framework_TestCase
|
||||
class Box_TranslateTest extends PHPUnit\Framework\TestCase
|
||||
{
|
||||
public function testsetLocale()
|
||||
{
|
||||
+8
-10
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
|
||||
class Box_TwigLoaderTest extends PHPUnit_Framework_TestCase
|
||||
class Box_TwigLoaderTest extends PHPUnit\Framework\TestCase
|
||||
{
|
||||
|
||||
public function testTemplates()
|
||||
@@ -14,16 +14,13 @@ class Box_TwigLoaderTest extends PHPUnit_Framework_TestCase
|
||||
"theme" => BB_PATH_THEMES.DIRECTORY_SEPARATOR."huraga",
|
||||
"type" => "client"
|
||||
));
|
||||
$test = $loader->getSource("mod_example_index.phtml");
|
||||
$test2 = $loader->getSource("404.phtml");
|
||||
$test = $loader->getSourceContext("mod_example_index.phtml");
|
||||
$test2 = $loader->getSourceContext("404.phtml");
|
||||
|
||||
$this->assertInternalType('string', $test);
|
||||
$this->assertInternalType('string', $test2);
|
||||
$this->assertIsObject($test);
|
||||
$this->assertIsObject($test2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Twig_Error_Loader
|
||||
*/
|
||||
public function testException()
|
||||
{
|
||||
$loader = new Box_TwigLoader(array(
|
||||
@@ -31,7 +28,8 @@ class Box_TwigLoaderTest extends PHPUnit_Framework_TestCase
|
||||
"mods" => BB_PATH_MODS,
|
||||
"theme" => BB_PATH_THEMES.DIRECTORY_SEPARATOR."huraga",
|
||||
));
|
||||
$test = $loader->getSource("mod_non_existing_settings.phtml");
|
||||
$test = $loader->getSource("some_random_name.phtml");
|
||||
$this->expectException(Twig\Error\LoaderError::class);
|
||||
$test = $loader->getSourceContext("mod_non_existing_settings.phtml");
|
||||
$test = $loader->getSourceContext("some_random_name.phtml");
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
/**
|
||||
* @group Core
|
||||
*/
|
||||
class Box_ValidateTest extends PHPUnit_Framework_TestCase
|
||||
class Box_ValidateTest extends PHPUnit\Framework\TestCase
|
||||
{
|
||||
public static function domains()
|
||||
{
|
||||
@@ -44,11 +44,7 @@ class Box_ValidateTest extends PHPUnit_Framework_TestCase
|
||||
$this->assertNull($v->checkRequiredParamsForArray($required, $data));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
* @expectedExceptionCode 0
|
||||
* @expectedExceptionMessage ID must be set
|
||||
*/
|
||||
|
||||
public function testCheckRequiredParamsForArrayNotExist()
|
||||
{
|
||||
$data = array();
|
||||
@@ -56,15 +52,13 @@ class Box_ValidateTest extends PHPUnit_Framework_TestCase
|
||||
'id' => 'ID must be set'
|
||||
);
|
||||
$v = new Box_Validate();
|
||||
$this->expectException(Box_Exception::class);
|
||||
$this->expectExceptionCode(0);
|
||||
$this->expectExceptionMessage('ID must be set');
|
||||
$v->checkRequiredParamsForArray($required, $data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
* @expectedExceptionCode 0
|
||||
* @expectedExceptionMessage KEY must be set
|
||||
*/
|
||||
public function testCheckRequiredParamsForArrayOneKeyNotExists()
|
||||
{
|
||||
$data = array(
|
||||
@@ -74,16 +68,13 @@ class Box_ValidateTest extends PHPUnit_Framework_TestCase
|
||||
'id' => 'ID must be set',
|
||||
'key' => 'KEY must be set'
|
||||
);
|
||||
$v = new Box_Validate();
|
||||
$v = new Box_Validate();
|
||||
$this->expectException(Box_Exception::class);
|
||||
$this->expectExceptionCode(0);
|
||||
$this->expectExceptionMessage('KEY must be set');
|
||||
$v->checkRequiredParamsForArray($required, $data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
* @expectedExceptionCode 0
|
||||
* @expectedExceptionMessage KEY placeholder_key must be set
|
||||
*/
|
||||
public function testCheckRequiredParamsForArrayMessagePlaceholder()
|
||||
{
|
||||
$data = array(
|
||||
@@ -95,15 +86,13 @@ class Box_ValidateTest extends PHPUnit_Framework_TestCase
|
||||
);
|
||||
|
||||
$variables = array(':key' => 'placeholder_key');
|
||||
$v = new Box_Validate();
|
||||
$v = new Box_Validate();
|
||||
$this->expectException(Box_Exception::class);
|
||||
$this->expectExceptionCode(0);
|
||||
$this->expectExceptionMessage('KEY placeholder_key must be set');
|
||||
$v->checkRequiredParamsForArray($required, $data, $variables);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
* @expectedExceptionCode 0
|
||||
* @expectedExceptionMessage KEY placeholder_key must be set for array config
|
||||
*/
|
||||
public function testCheckRequiredParamsForArrayMessagePlaceholders()
|
||||
{
|
||||
$data = array(
|
||||
@@ -118,16 +107,14 @@ class Box_ValidateTest extends PHPUnit_Framework_TestCase
|
||||
':key' => 'placeholder_key',
|
||||
':array' => 'config'
|
||||
);
|
||||
$v = new Box_Validate();
|
||||
$v = new Box_Validate();
|
||||
$this->expectException(Box_Exception::class);
|
||||
$this->expectExceptionCode(0);
|
||||
$this->expectExceptionMessage('KEY placeholder_key must be set for array config');
|
||||
$v->checkRequiredParamsForArray($required, $data, $variables);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
* @expectedExceptionCode 12345
|
||||
* @expectedExceptionMessage KEY placeholder_key must be set
|
||||
*/
|
||||
public function testCheckRequiredParamsForArrayErrorCode()
|
||||
{
|
||||
$data = array(
|
||||
@@ -139,15 +126,13 @@ class Box_ValidateTest extends PHPUnit_Framework_TestCase
|
||||
);
|
||||
|
||||
$variables = array(':key' => 'placeholder_key');
|
||||
$v = new Box_Validate();
|
||||
$v = new Box_Validate();
|
||||
$this->expectException(Box_Exception::class);
|
||||
$this->expectExceptionCode(12345);
|
||||
$this->expectExceptionMessage('KEY placeholder_key must be set');
|
||||
$v->checkRequiredParamsForArray($required, $data, $variables, 12345);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
* @expectedExceptionCode 54321
|
||||
* @expectedExceptionMessage KEY must be set
|
||||
*/
|
||||
public function testCheckRequiredParamsForArrayErrorCodeVariablesNotSet()
|
||||
{
|
||||
$data = array(
|
||||
@@ -159,6 +144,9 @@ class Box_ValidateTest extends PHPUnit_Framework_TestCase
|
||||
);
|
||||
|
||||
$v = new Box_Validate();
|
||||
$this->expectException(Box_Exception::class);
|
||||
$this->expectExceptionCode(54321);
|
||||
$this->expectExceptionMessage('KEY must be set');
|
||||
$v->checkRequiredParamsForArray($required, $data, array(), 54321);
|
||||
}
|
||||
|
||||
@@ -173,6 +161,9 @@ class Box_ValidateTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$v = new Box_Validate();
|
||||
$v->checkRequiredParamsForArray($required, $data);
|
||||
|
||||
//add needed assert, set to true if no exception called in $v->checkRequiredParamsForArray
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
|
||||
public function testcheckRequiredParamsForArray_EmptyString()
|
||||
@@ -185,7 +176,10 @@ class Box_ValidateTest extends PHPUnit_Framework_TestCase
|
||||
);
|
||||
|
||||
$v = new Box_Validate();
|
||||
$this->setExpectedException('\Box_Exception', $required['message']);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage($required['message']);
|
||||
|
||||
$v->checkRequiredParamsForArray($required, $data);
|
||||
}
|
||||
|
||||
@@ -200,7 +194,10 @@ class Box_ValidateTest extends PHPUnit_Framework_TestCase
|
||||
);
|
||||
|
||||
$v = new Box_Validate();
|
||||
$this->setExpectedException('\Box_Exception', $required['message']);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage($required['message']);
|
||||
|
||||
$v->checkRequiredParamsForArray($required, $data);
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @group Core
|
||||
*/
|
||||
class Box_LicenseTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function setup()
|
||||
{
|
||||
global $di;
|
||||
$this->di = $di;
|
||||
}
|
||||
|
||||
public function testLicense()
|
||||
{
|
||||
$license = $this->di['license'];
|
||||
// $license->getDetails();
|
||||
// $license->getDetails(true);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
|
||||
class Payment_Adapter_ClientBalanceTest extends PHPUnit_Framework_TestCase {
|
||||
class Payment_Adapter_ClientBalanceTest extends PHPUnit\Framework\TestCase {
|
||||
|
||||
public function testDi()
|
||||
{
|
||||
@@ -58,7 +58,7 @@ class Payment_Adapter_ClientBalanceTest extends PHPUnit_Framework_TestCase {
|
||||
$adapterMock->setDi($di);
|
||||
$invoiceId = 1;
|
||||
$result = $adapterMock->getHtml(null, $invoiceId, null);
|
||||
$this->assertInternalType('string', $result);
|
||||
$this->assertIsString($result);
|
||||
$this->assertEquals('Not enough in balance', $result);
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ class Payment_Adapter_ClientBalanceTest extends PHPUnit_Framework_TestCase {
|
||||
$adapterMock->setDi($di);
|
||||
$invoiceId = 1;
|
||||
$result = $adapterMock->getHtml(null, $invoiceId, null);
|
||||
$this->assertInternalType('string', $result);
|
||||
$this->assertIsString($result);
|
||||
$this->assertEquals('Forbidden to pay deposit invoice with this gateway', $result);
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ class Payment_Adapter_ClientBalanceTest extends PHPUnit_Framework_TestCase {
|
||||
$adapterMock->setDi($di);
|
||||
$result = $adapterMock->getHtml(null, $invoiceId, null);
|
||||
|
||||
$this->assertInternalType('string', $result);
|
||||
$this->assertIsString($result);
|
||||
$this->assertTrue(strpos($result, $url) !== false);
|
||||
$this->assertTrue(strpos($result, '<script') !== false);
|
||||
}
|
||||
@@ -175,7 +175,10 @@ class Payment_Adapter_ClientBalanceTest extends PHPUnit_Framework_TestCase {
|
||||
$transactionId = 1;
|
||||
$data = array();
|
||||
$gatewayId = 1;
|
||||
$this->setExpectedException('Payment_Exception', 'IPN is not valid');
|
||||
|
||||
$this->expectException(Payment_Exception::class);
|
||||
$this->expectExceptionMessage('IPN is not valid');
|
||||
|
||||
$adapterMock->processTransaction(null, $transactionId, $data, $gatewayId);
|
||||
}
|
||||
|
||||
@@ -216,7 +219,9 @@ class Payment_Adapter_ClientBalanceTest extends PHPUnit_Framework_TestCase {
|
||||
return $invoiceServiceMock;
|
||||
});
|
||||
|
||||
$this->setExpectedException('Payment_Exception', 'Forbidden to pay deposit invoice with this gateway', 303);
|
||||
$this->expectException(Payment_Exception::class);
|
||||
$this->expectExceptionCode(303);
|
||||
$this->expectExceptionMessage('Forbidden to pay deposit invoice with this gateway');
|
||||
|
||||
$transactionId = 1;
|
||||
$data = array();
|
||||
@@ -362,7 +367,10 @@ class Payment_Adapter_ClientBalanceTest extends PHPUnit_Framework_TestCase {
|
||||
$adapter = new \Payment_Adapter_ClientBalance();
|
||||
$adapter->setDi($di);
|
||||
|
||||
$this->setExpectedException('Payment_Exception', 'ClientBalance gateway is not enabled', 301);
|
||||
$this->expectException(Payment_Exception::class);
|
||||
$this->expectExceptionCode(301);
|
||||
$this->expectExceptionMessage('ClientBalance gateway is not enabled');
|
||||
|
||||
$adapter->getServiceUrl();
|
||||
}
|
||||
|
||||
@@ -400,7 +408,10 @@ class Payment_Adapter_ClientBalanceTest extends PHPUnit_Framework_TestCase {
|
||||
$adapter = new \Payment_Adapter_ClientBalance();
|
||||
$adapter->setDi($di);
|
||||
|
||||
$this->setExpectedException('Payment_Exception', 'Forbidden to pay deposit invoice with this gateway', 302);
|
||||
$this->expectException(Payment_Exception::class);
|
||||
$this->expectExceptionCode(302);
|
||||
$this->expectExceptionMessage('Forbidden to pay deposit invoice with this gateway');
|
||||
|
||||
$adapter->getServiceUrl();
|
||||
}
|
||||
|
||||
@@ -465,4 +476,4 @@ class Payment_Adapter_ClientBalanceTest extends PHPUnit_Framework_TestCase {
|
||||
$result = $adapter->enoughInBalanceToCoverInvoice($invoiceModel);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
|
||||
class Payment_Adapter_InterkassaTest extends PHPUnit_Framework_TestCase {
|
||||
class Payment_Adapter_InterkassaTest extends PHPUnit\Framework\TestCase {
|
||||
|
||||
private $defaultConfig = array();
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->defaultConfig = array(
|
||||
'url' => 'boxbilling.test',
|
||||
@@ -64,7 +64,9 @@ class Payment_Adapter_InterkassaTest extends PHPUnit_Framework_TestCase {
|
||||
->method('getParam')
|
||||
->with('ik_co_id');
|
||||
|
||||
$this->setExpectedException('Payment_Exception', 'Shop ID is missing in gateway configuration');
|
||||
$this->expectException(Payment_Exception::class);
|
||||
$this->expectExceptionMessage('Shop ID is missing in gateway configuration');
|
||||
|
||||
$adapterMock->init();
|
||||
}
|
||||
|
||||
@@ -79,7 +81,9 @@ class Payment_Adapter_InterkassaTest extends PHPUnit_Framework_TestCase {
|
||||
->withConsecutive(array('ik_co_id'), array('ik_secret_key'))
|
||||
->willReturnOnConsecutiveCalls('shop_id_value', null);
|
||||
|
||||
$this->setExpectedException('Payment_Exception', 'Secret key is missing in gateway configuration');
|
||||
$this->expectException(Payment_Exception::class);
|
||||
$this->expectExceptionMessage('Secret key is missing in gateway configuration');
|
||||
|
||||
$adapterMock->init();
|
||||
}
|
||||
|
||||
@@ -201,7 +205,9 @@ class Payment_Adapter_InterkassaTest extends PHPUnit_Framework_TestCase {
|
||||
$paymentInvoiceMock = $this->getMockBuilder('Payment_Invoice')
|
||||
->getMock();
|
||||
|
||||
$this->setExpectedException('Payment_Exception', 'Interkassa payment gateway do not support recurrent payments');
|
||||
$this->expectException(Payment_Exception::class);
|
||||
$this->expectExceptionMessage('Interkassa payment gateway do not support recurrent payments');
|
||||
|
||||
$adapterMock->recurrentPayment($paymentInvoiceMock);
|
||||
}
|
||||
|
||||
@@ -333,7 +339,8 @@ class Payment_Adapter_InterkassaTest extends PHPUnit_Framework_TestCase {
|
||||
->method('isIpnValid')
|
||||
->willReturn(false);
|
||||
|
||||
$this->setExpectedException('Exception', 'IPN is not valid');
|
||||
$this->expectException(Exception::class);
|
||||
$this->expectExceptionMessage('IPN is not valid');
|
||||
|
||||
$adminModel = new \Model_Admin();
|
||||
$api_admin = new \Api_Handler($adminModel);
|
||||
@@ -503,7 +510,10 @@ class Payment_Adapter_InterkassaTest extends PHPUnit_Framework_TestCase {
|
||||
)
|
||||
);
|
||||
$gateway_id = 1;
|
||||
$this->setExpectedException('Payment_Exception', 'IPN is duplicate');
|
||||
|
||||
$this->expectException(Payment_Exception::class);
|
||||
$this->expectExceptionMessage('IPN is duplicate');
|
||||
|
||||
$adapterMock->processTransaction($api_admin, $transaction_id, $data, $gateway_id);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
|
||||
class Payment_Adapter_PaypalTest extends PHPUnit_Framework_TestCase {
|
||||
class Payment_Adapter_PayPalTest extends PHPUnit\Framework\TestCase {
|
||||
|
||||
private $defaultConfig = array();
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->defaultConfig = array(
|
||||
'email' => 'info@boxbilling.com',
|
||||
@@ -43,7 +43,10 @@ class Payment_Adapter_PaypalTest extends PHPUnit_Framework_TestCase {
|
||||
public function testConsturctMissingEmail()
|
||||
{
|
||||
$config = array();
|
||||
$this->setExpectedException('Payment_Exception', 'Payment gateway "PayPal" is not configured properly. Please update configuration parameter "PayPal Email address" at "Configuration -> Payments".');
|
||||
|
||||
$this->expectException(Payment_Exception::class);
|
||||
$this->expectExceptionMessage('Payment gateway "PayPal" is not configured properly. Please update configuration parameter "PayPal Email address" at "Configuration -> Payments".');
|
||||
|
||||
new Payment_Adapter_PayPalEmail($config);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
|
||||
class Payment_Adapter_StripeTest extends PHPUnit_Framework_TestCase {
|
||||
class Payment_Adapter_StripeTest extends PHPUnit\Framework\TestCase {
|
||||
|
||||
private $defaultConfig = array();
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->defaultConfig = array(
|
||||
'api_key' => '123APIKEY456',
|
||||
@@ -75,7 +75,7 @@ class Payment_Adapter_StripeTest extends PHPUnit_Framework_TestCase {
|
||||
|
||||
$api_admin = new Api_Handler(new Model_Admin());
|
||||
$result = $adapterMock->getHtml($api_admin, 2, false);
|
||||
$this->assertInternalType('string', $result);
|
||||
$this->assertIsString($result);
|
||||
}
|
||||
|
||||
public function testgetAmountInCents()
|
||||
@@ -173,7 +173,10 @@ class Payment_Adapter_StripeTest extends PHPUnit_Framework_TestCase {
|
||||
{
|
||||
$config = $this->defaultConfig;
|
||||
$adapter = new Payment_Adapter_Stripe($config);
|
||||
$this->setExpectedException('Payment_Exception', 'Payment gateway "Stripe" is not configured properly. Please update configuration parameter "test_pub_key" at "Configuration -> Payments".');
|
||||
|
||||
$this->expectException(Payment_Exception::class);
|
||||
$this->expectExceptionMessage('Payment gateway "Stripe" is not configured properly. Please update configuration parameter "test_pub_key" at "Configuration -> Payments".');
|
||||
|
||||
$adapter->get_test_pub_key();
|
||||
|
||||
}
|
||||
@@ -191,8 +194,11 @@ class Payment_Adapter_StripeTest extends PHPUnit_Framework_TestCase {
|
||||
{
|
||||
$config = $this->defaultConfig;
|
||||
$adapter = new Payment_Adapter_Stripe($config);
|
||||
$this->setExpectedException('Payment_Exception', 'Payment gateway "Stripe" is not configured properly. Please update configuration parameter "test_api_key" at "Configuration -> Payments".');
|
||||
|
||||
$this->expectException(Payment_Exception::class);
|
||||
$this->expectExceptionMessage('Payment gateway "Stripe" is not configured properly. Please update configuration parameter "test_api_key" at "Configuration -> Payments".');
|
||||
|
||||
$adapter->get_test_api_key();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
+16
-10
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @group Core
|
||||
*/
|
||||
class Registrar_Adapter_ResellerclubTest extends PHPUnit_Framework_TestCase
|
||||
class Registrar_Adapter_ResellerclubTest extends PHPUnit\Framework\TestCase
|
||||
{
|
||||
private function getAdapter()
|
||||
{
|
||||
@@ -16,7 +16,10 @@ class Registrar_Adapter_ResellerclubTest extends PHPUnit_Framework_TestCase
|
||||
public function testConstruction_MissingUserId()
|
||||
{
|
||||
$options = array();
|
||||
$this->setExpectedException('Registrar_Exception', 'Domain registrar "ResellerClub" is not configured properly. Please update configuration parameter "ResellerClub Reseller ID" at "Configuration -> Domain registration".');
|
||||
|
||||
$this->expectException(Registrar_Exception::class);
|
||||
$this->expectExceptionMessage('Domain registrar "ResellerClub" is not configured properly. Please update configuration parameter "ResellerClub Reseller ID" at "Configuration -> Domain registration".');
|
||||
|
||||
$adapter = new \Registrar_Adapter_Resellerclub($options);
|
||||
}
|
||||
|
||||
@@ -25,7 +28,10 @@ class Registrar_Adapter_ResellerclubTest extends PHPUnit_Framework_TestCase
|
||||
$options = array(
|
||||
'userid' => '12345',
|
||||
);
|
||||
$this->setExpectedException('Registrar_Exception', 'Domain registrar "ResellerClub" is not configured properly. Please update configuration parameter "ResellerClub API Key" at "Configuration -> Domain registration".');
|
||||
|
||||
$this->expectException(Registrar_Exception::class);
|
||||
$this->expectExceptionMessage('Domain registrar "ResellerClub" is not configured properly. Please update configuration parameter "ResellerClub API Key" at "Configuration -> Domain registration".');
|
||||
|
||||
new \Registrar_Adapter_Resellerclub($options);
|
||||
}
|
||||
|
||||
@@ -48,7 +54,7 @@ class Registrar_Adapter_ResellerclubTest extends PHPUnit_Framework_TestCase
|
||||
$result = $adapter->getConfig();
|
||||
|
||||
$this->assertNotEmpty($result);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertArrayHasKey('label', $result);
|
||||
$this->assertArrayHasKey('form', $result);
|
||||
}
|
||||
@@ -59,7 +65,7 @@ class Registrar_Adapter_ResellerclubTest extends PHPUnit_Framework_TestCase
|
||||
$result = $adapter->getTlds();
|
||||
|
||||
$this->assertNotEmpty($result);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testisDomainAvailable_foundInArray()
|
||||
@@ -135,7 +141,7 @@ class Registrar_Adapter_ResellerclubTest extends PHPUnit_Framework_TestCase
|
||||
->willReturn($requestResult);
|
||||
|
||||
$result = $adapterMock->isDomainCanBeTransfered($registrarDomain);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -155,7 +161,7 @@ class Registrar_Adapter_ResellerclubTest extends PHPUnit_Framework_TestCase
|
||||
->willReturnOnConsecutiveCalls(1, $requestResult);
|
||||
|
||||
$result = $adapterMock->modifyNs($registrarDomain);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -175,7 +181,7 @@ class Registrar_Adapter_ResellerclubTest extends PHPUnit_Framework_TestCase
|
||||
->willReturnOnConsecutiveCalls(array('customerid' => 1), array('Contact' => array('registrant' => 1)), $requestResult);
|
||||
|
||||
$result = $adapterMock->modifyContact($registrarDomain);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -195,7 +201,7 @@ class Registrar_Adapter_ResellerclubTest extends PHPUnit_Framework_TestCase
|
||||
->willReturnOnConsecutiveCalls(array('customerid' => 1), array('Contact' => array('registrant' => 1)), $requestResult);
|
||||
|
||||
$result = $adapterMock->transferDomain($registrarDomain);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testregisterDomain()
|
||||
@@ -231,7 +237,7 @@ class Registrar_Adapter_ResellerclubTest extends PHPUnit_Framework_TestCase
|
||||
);
|
||||
|
||||
$result = $adapterMock->registerDomain($registrarDomain);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php
|
||||
define('APPLICATION_ENV', 'testing');
|
||||
$di = include dirname(__FILE__). '/../../src/bb-di.php';
|
||||
require_once dirname(__FILE__) . '/../../src/bb-load.php';
|
||||
require_once dirname(__FILE__) . '/../../src/bb-load.php';
|
||||
$di = include dirname(__FILE__). '/../../src/bb-di.php';
|
||||
@@ -34,7 +34,7 @@ class AdminTest extends \BBTestCase {
|
||||
$controllerAdmin->setDi($di);
|
||||
|
||||
$result = $controllerAdmin->fetchNavigation();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testregister()
|
||||
|
||||
@@ -43,8 +43,8 @@ class ServiceTest extends \BBTestCase
|
||||
$service = new \Box\Mod\Activity\Service();
|
||||
$service->setDi($di);
|
||||
$result = $service->getSearchQuery($filterKey);
|
||||
$this->assertInternalType('string', $result[0]);
|
||||
$this->assertInternalType('array', $result[1]);
|
||||
$this->assertIsString($result[0]);
|
||||
$this->assertIsArray($result[1]);
|
||||
$this->assertTrue(strpos($result[0], $search) != false, $expected, $result);
|
||||
}
|
||||
|
||||
@@ -194,12 +194,12 @@ class ServiceTest extends \BBTestCase
|
||||
$service->setDi($di);
|
||||
|
||||
$result = $service->toApiArray($clientHistoryModel);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertArrayHasKey('id', $result);
|
||||
$this->assertArrayHasKey('ip', $result);
|
||||
$this->assertArrayHasKey('created_at', $result);
|
||||
|
||||
$this->assertInternalType('array', $result['client']);
|
||||
$this->assertIsArray($result['client']);
|
||||
$this->assertArrayHasKey('id', $result['client']);
|
||||
$this->assertArrayHasKey('first_name', $result['client']);
|
||||
$this->assertArrayHasKey('last_name', $result['client']);
|
||||
|
||||
@@ -10,7 +10,7 @@ class ServiceTest extends \BBTestCase {
|
||||
*/
|
||||
protected $service = null;
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->service= new \Box\Mod\Api\Service();
|
||||
}
|
||||
@@ -45,7 +45,7 @@ class ServiceTest extends \BBTestCase {
|
||||
|
||||
$this->service->setDi($di);
|
||||
$result = $this->service->logRequest();
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($affectedRows, $result);
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ class ServiceTest extends \BBTestCase {
|
||||
$this->service->setDi($di);
|
||||
$result = $this->service->getRequestCount($since, $ip);
|
||||
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($requestNumber, $result);
|
||||
|
||||
}
|
||||
|
||||
@@ -32,8 +32,10 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$brandingService = new \Box\Mod\Branding\Service();
|
||||
$brandingService->setDi($di);
|
||||
|
||||
$this->setExpectedException('\Exception', 'Branding module can only be disabled for PRO license owners', 509);
|
||||
|
||||
$this->expectException(\Exception::class);
|
||||
$this->expectExceptionCode(509);
|
||||
$this->expectExceptionMessage('Branding module can only be disabled for PRO license owners');
|
||||
$brandingService->uninstall();
|
||||
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ class AdminTest extends \BBTestCase
|
||||
*/
|
||||
protected $adminApi = null;
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->adminApi = new \Box\Mod\Cart\Api\Admin();
|
||||
}
|
||||
@@ -55,7 +55,7 @@ class AdminTest extends \BBTestCase
|
||||
$data = array();
|
||||
$result = $this->adminApi->get_list($data);
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testGet()
|
||||
@@ -87,7 +87,7 @@ class AdminTest extends \BBTestCase
|
||||
);
|
||||
$result = $this->adminApi->get($data);
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ class ClientTest extends \BBTestCase {
|
||||
*/
|
||||
protected $clientApi = null;
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->clientApi = new \Box\Mod\Cart\Api\Client();
|
||||
}
|
||||
@@ -51,7 +51,7 @@ class ClientTest extends \BBTestCase {
|
||||
$this->clientApi->setDi($di);
|
||||
$result = $this->clientApi->checkout($data);
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ class GuestTest extends \BBTestCase
|
||||
*/
|
||||
protected $guestApi = null;
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->guestApi = new \Box\Mod\Cart\Api\Guest();
|
||||
}
|
||||
@@ -27,7 +27,7 @@ class GuestTest extends \BBTestCase
|
||||
|
||||
$result = $this->guestApi->get();
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testReset()
|
||||
@@ -83,9 +83,6 @@ class GuestTest extends \BBTestCase
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testSet_currencyNotFoundException()
|
||||
{
|
||||
$serviceMock = $this->getMockBuilder('\Box\Mod\Cart\Service')
|
||||
@@ -118,8 +115,10 @@ class GuestTest extends \BBTestCase
|
||||
$data = array(
|
||||
'currency' => 'EUR'
|
||||
);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Currency not found');
|
||||
$result = $this->guestApi->set_currency($data);
|
||||
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -136,7 +135,7 @@ class GuestTest extends \BBTestCase
|
||||
|
||||
|
||||
$currencyServiceMock = $this->getMockBuilder('\Box\Mod\Currency\Service')
|
||||
->setMethods(array('toApiArray'))->getMock();
|
||||
->setMethods(array('toApiArray', 'getDefault'))->getMock();
|
||||
$currencyServiceMock->expects($this->atLeastOnce())->method('toApiArray')
|
||||
->will($this->returnValue(array()));
|
||||
$currencyServiceMock->expects($this->never())->method('getDefault')
|
||||
@@ -161,7 +160,7 @@ class GuestTest extends \BBTestCase
|
||||
);
|
||||
$result = $this->guestApi->get_currency($data);
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testGet_currencyNotFound()
|
||||
@@ -202,7 +201,7 @@ class GuestTest extends \BBTestCase
|
||||
);
|
||||
$result = $this->guestApi->get_currency($data);
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testApply_promo()
|
||||
@@ -243,9 +242,6 @@ class GuestTest extends \BBTestCase
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testApply_promoNotFoundException()
|
||||
{
|
||||
$cart = new \Model_Cart();
|
||||
@@ -253,7 +249,7 @@ class GuestTest extends \BBTestCase
|
||||
$cart->currency_id = rand(1, 100);
|
||||
|
||||
$serviceMock = $this->getMockBuilder('\Box\Mod\Cart\Service')
|
||||
->setMethods(array('getSessionCart', 'applyPromo', 'findActivePromoByCode', 'promoCanBeApplied'))->getMock();
|
||||
->setMethods(array('getSessionCart', 'applyPromo', 'findActivePromoByCode', 'promoCanBeApplied', 'isPromoAvailableForClientGroup'))->getMock();
|
||||
$serviceMock->expects($this->never())->method('getSessionCart')
|
||||
->will($this->returnValue($cart));
|
||||
$serviceMock->expects($this->never())->method('applyPromo')
|
||||
@@ -279,14 +275,12 @@ class GuestTest extends \BBTestCase
|
||||
$data = array(
|
||||
'promocode' => 'CODE'
|
||||
);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $this->guestApi->apply_promo($data);
|
||||
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testApply_promoCanNotBeApplied()
|
||||
{
|
||||
$cart = new \Model_Cart();
|
||||
@@ -320,14 +314,13 @@ class GuestTest extends \BBTestCase
|
||||
$data = array(
|
||||
'promocode' => 'CODE'
|
||||
);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $this->guestApi->apply_promo($data);
|
||||
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testApply_promoCanNotBeAppliedForUser()
|
||||
{
|
||||
$cart = new \Model_Cart();
|
||||
@@ -359,6 +352,8 @@ class GuestTest extends \BBTestCase
|
||||
$data = array(
|
||||
'promocode' => 'CODE'
|
||||
);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $this->guestApi->apply_promo($data);
|
||||
|
||||
$this->assertTrue($result);
|
||||
|
||||
@@ -9,7 +9,7 @@ class ServiceTest extends \BBTestCase
|
||||
*/
|
||||
protected $service = null;
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->service = new \Box\Mod\Cart\Service();
|
||||
}
|
||||
@@ -31,8 +31,8 @@ class ServiceTest extends \BBTestCase
|
||||
{
|
||||
$service = new \Box\Mod\Cart\Service();
|
||||
$result = $service->getSearchQuery(array());
|
||||
$this->assertInternalType('string', $result[0]);
|
||||
$this->assertInternalType('array', $result[1]);
|
||||
$this->assertIsString($result[0]);
|
||||
$this->assertIsArray($result[1]);
|
||||
$this->assertNotFalse(strpos($result[0], 'SELECT cart.id FROM cart'));
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ class ServiceTest extends \BBTestCase
|
||||
$this->assertEquals($result->session_id, $session_id);
|
||||
}
|
||||
|
||||
public function testGetSessionCartDoesNotExistProvider()
|
||||
public function getSessionCartDoesNotExistProvider()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
@@ -86,7 +86,7 @@ class ServiceTest extends \BBTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider testGetSessionCartDoesNotExistProvider
|
||||
* @dataProvider getSessionCartDoesNotExistProvider
|
||||
*/
|
||||
public function testGetSessionCartDoesNotExist($sessionGetWillReturn, $getCurrencyByClientIdExpects, $getDefaultExpects)
|
||||
{
|
||||
@@ -206,7 +206,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$result = $this->service->isPeriodEnabledForProduct($productModelMock, 'monthly');
|
||||
|
||||
$this->assertInternalType('boolean', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertEquals($result, $enabled);
|
||||
}
|
||||
|
||||
@@ -233,7 +233,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$result = $this->service->isPeriodEnabledForProduct($productModelMock, 'monthly');
|
||||
|
||||
$this->assertInternalType('boolean', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -264,9 +264,6 @@ class ServiceTest extends \BBTestCase
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testRemoveProductCartProductNotFound()
|
||||
{
|
||||
$dbMock = $this->getMockBuilder('\Box_Database')->disableOriginalConstructor()->getMock();
|
||||
@@ -284,6 +281,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$cart = new \Model_Cart();
|
||||
$cart->loadBean(new \RedBeanPHP\OODBBean());
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $this->service->removeProduct($cart, rand(1, 100));
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
@@ -412,9 +410,6 @@ class ServiceTest extends \BBTestCase
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testApplyPromoEmptyCartException()
|
||||
{
|
||||
$dbMock = $this->getMockBuilder('\Box_Database')->disableOriginalConstructor()->getMock();
|
||||
@@ -440,6 +435,7 @@ class ServiceTest extends \BBTestCase
|
||||
$di['logger'] = $this->getMockBuilder('Box_Log')->getMock();
|
||||
$serviceMock->setDi($di);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $serviceMock->applyPromo($cart, $promo);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
@@ -565,7 +561,7 @@ class ServiceTest extends \BBTestCase
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
public function testPromoCanBeAppliedProvider()
|
||||
public function promoCanBeAppliedProvider()
|
||||
{
|
||||
$promo1 = new \Model_Promo();
|
||||
$promo1->loadBean(new \RedBeanPHP\OODBBean());
|
||||
@@ -610,7 +606,7 @@ class ServiceTest extends \BBTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider testPromoCanBeAppliedProvider
|
||||
* @dataProvider promoCanBeAppliedProvider
|
||||
*/
|
||||
public function testPromoCanBeApplied($promo, $expectedResult)
|
||||
{
|
||||
@@ -644,7 +640,7 @@ class ServiceTest extends \BBTestCase
|
||||
$cart->loadBean(new \RedBeanPHP\OODBBean());
|
||||
|
||||
$result = $this->service->getCartProducts($cart);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertInstanceOf('Model_CartProduct', $result[0]);
|
||||
}
|
||||
|
||||
@@ -700,7 +696,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$result = $serviceMock->checkoutCart($cart, $client);
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertArrayHasKey('gateway_id', $result);
|
||||
$this->assertArrayHasKey('invoice_hash', $result);
|
||||
$this->assertArrayHasKey('order_id', $result);
|
||||
@@ -737,10 +733,11 @@ class ServiceTest extends \BBTestCase
|
||||
$di['db'] = $dbMock;
|
||||
$di['logger'] = $this->getMockBuilder('Box_Log')->getMock();
|
||||
$serviceMock->setDi($di);
|
||||
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $serviceMock->checkoutCart($cart, $client);
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertArrayHasKey('gateway_id', $result);
|
||||
$this->assertArrayHasKey('invoice_hash', $result);
|
||||
$this->assertArrayHasKey('order_id', $result);
|
||||
@@ -819,7 +816,8 @@ class ServiceTest extends \BBTestCase
|
||||
$serviceMock->setDi($di);
|
||||
$productModel->setDi($di);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Period parameter not passed');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Period parameter not passed');
|
||||
$serviceMock->addItem($cartModel, $productModel, $data);
|
||||
}
|
||||
|
||||
@@ -861,7 +859,8 @@ class ServiceTest extends \BBTestCase
|
||||
$serviceMock->setDi($di);
|
||||
$productModel->setDi($di);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Selected billing period is not valid');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Selected billing period is not valid');
|
||||
$serviceMock->addItem($cartModel, $productModel, $data);
|
||||
}
|
||||
|
||||
@@ -901,7 +900,8 @@ class ServiceTest extends \BBTestCase
|
||||
$serviceMock->setDi($di);
|
||||
$productModel->setDi($di);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', "I'm afraid we are out of stock.");
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage("I'm afraid we are out of stock.");
|
||||
$serviceMock->addItem($cartModel, $productModel, $data);
|
||||
}
|
||||
|
||||
@@ -1088,7 +1088,7 @@ class ServiceTest extends \BBTestCase
|
||||
->will($this->returnValue(array($cartProductModel)));
|
||||
$cartProductApiArray = array(
|
||||
'total' => 1,
|
||||
'discount' => 0,
|
||||
'discount_price' => 0,
|
||||
);
|
||||
$serviceMock->expects($this->atLeastOnce())
|
||||
->method('cartProductToApiArray')
|
||||
@@ -1121,8 +1121,9 @@ class ServiceTest extends \BBTestCase
|
||||
'total' => 1,
|
||||
'items' => array($cartProductApiArray),
|
||||
'currency' => array(),
|
||||
'subtotal' => 1
|
||||
);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
@@ -1177,7 +1178,7 @@ class ServiceTest extends \BBTestCase
|
||||
$setupPrice = 0;
|
||||
$result = $serviceMock->getProductDiscount($cartProductModel, $setupPrice);
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertEquals($discountPrice, $result[0]);
|
||||
$discountSetup = 0;
|
||||
$this->assertEquals($discountSetup, $result[1]);
|
||||
@@ -1215,7 +1216,7 @@ class ServiceTest extends \BBTestCase
|
||||
$setupPrice = 0;
|
||||
$result = $serviceMock->getProductDiscount($cartProductModel, $setupPrice);
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertEquals(0, $result[0]);
|
||||
$this->assertEquals(0, $result[1]);
|
||||
}
|
||||
@@ -1262,13 +1263,13 @@ class ServiceTest extends \BBTestCase
|
||||
$setupPrice = 25;
|
||||
$result = $serviceMock->getProductDiscount($cartProductModel, $setupPrice);
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertEquals($discountPrice, $result[0]);
|
||||
$discountSetup = $setupPrice;
|
||||
$this->assertEquals($discountSetup, $result[1]);
|
||||
}
|
||||
|
||||
public function testIsPromoAvailableForClientGroupProvider()
|
||||
public function isPromoAvailableForClientGroupProvider()
|
||||
{
|
||||
$promo1 = new \Model_Promo();
|
||||
$promo1->loadBean(new \RedBeanPHP\OODBBean());
|
||||
@@ -1330,7 +1331,7 @@ class ServiceTest extends \BBTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider testIsPromoAvailableForClientGroupProvider
|
||||
* @dataProvider isPromoAvailableForClientGroupProvider
|
||||
*/
|
||||
public function testIsPromoAvailableForClientGroup(\Model_Promo $promo, $client, $expectedResult)
|
||||
{
|
||||
|
||||
@@ -53,7 +53,7 @@ class AdminTest extends \BBTestCase
|
||||
$data = array();
|
||||
|
||||
$result = $admin_Client->get_list($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ class AdminTest extends \BBTestCase
|
||||
|
||||
$data = array('id' => 1);
|
||||
$result = $admin_Client->get_pairs($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testget()
|
||||
@@ -91,7 +91,7 @@ class AdminTest extends \BBTestCase
|
||||
$admin_Client->setService($serviceMock);
|
||||
|
||||
$result = $admin_Client->get(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testlogin()
|
||||
@@ -132,7 +132,7 @@ class AdminTest extends \BBTestCase
|
||||
|
||||
$data = array('id' => 1);
|
||||
$result = $admin_Client->login($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testCreate()
|
||||
@@ -164,7 +164,7 @@ class AdminTest extends \BBTestCase
|
||||
|
||||
$result = $admin_Client->create($data);
|
||||
|
||||
$this->assertInternalType('int', $result, 'create() returned: ' . $result);
|
||||
$this->assertIsInt($result, 'create() returned: ' . $result);
|
||||
}
|
||||
|
||||
public function testCreateEmailRegisteredException()
|
||||
@@ -188,7 +188,8 @@ class AdminTest extends \BBTestCase
|
||||
$admin_Client->setDi($di);
|
||||
$admin_Client->setService($serviceMock);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Email is already registered.');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Email is already registered.');
|
||||
$admin_Client->create($data);
|
||||
}
|
||||
|
||||
@@ -392,7 +393,8 @@ class AdminTest extends \BBTestCase
|
||||
$admin_Client = new \Box\Mod\Client\Api\Admin();
|
||||
$admin_Client->setDi($di);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Can not change email. It is already registered.');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Can not change email. It is already registered.');
|
||||
$admin_Client->update($data);
|
||||
}
|
||||
|
||||
@@ -408,7 +410,8 @@ class AdminTest extends \BBTestCase
|
||||
$di['validator'] = new \Box_Validate();
|
||||
$admin_Client->setDi($di);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Id required');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Id required');
|
||||
$admin_Client->update($data);
|
||||
}
|
||||
|
||||
@@ -475,7 +478,8 @@ class AdminTest extends \BBTestCase
|
||||
$di['validator'] = $validatorMock;
|
||||
$admin_Client->setDi($di);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Passwords do not match');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Passwords do not match');
|
||||
$admin_Client->change_password($data);
|
||||
}
|
||||
|
||||
@@ -517,7 +521,7 @@ class AdminTest extends \BBTestCase
|
||||
$admin_Client->setDi($di);
|
||||
|
||||
$result = $admin_Client->balance_get_list($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testbalance_delete()
|
||||
@@ -641,7 +645,7 @@ class AdminTest extends \BBTestCase
|
||||
$admin_Client->setService($serviceMock);
|
||||
|
||||
$result = $admin_Client->login_history_get_list($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testget_statuses()
|
||||
@@ -657,7 +661,7 @@ class AdminTest extends \BBTestCase
|
||||
$admin_Client->setDi($di);
|
||||
|
||||
$result = $admin_Client->get_statuses(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testgroup_get_pairs()
|
||||
@@ -673,7 +677,7 @@ class AdminTest extends \BBTestCase
|
||||
$admin_Client->setDi($di);
|
||||
|
||||
$result = $admin_Client->group_get_pairs(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testgroup_create()
|
||||
@@ -698,7 +702,7 @@ class AdminTest extends \BBTestCase
|
||||
$admin_Client->setDi($di);
|
||||
$result = $admin_Client->group_create($data);
|
||||
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($newGroupId, $result);
|
||||
}
|
||||
|
||||
@@ -802,7 +806,7 @@ class AdminTest extends \BBTestCase
|
||||
|
||||
$result = $admin_Client->group_get($data);
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testlogin_history_delete()
|
||||
@@ -866,4 +870,4 @@ class AdminTest extends \BBTestCase
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -60,7 +60,7 @@ class ClientTest extends \BBTestCase {
|
||||
|
||||
$result = $client->balance_get_list($data);
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testchange_password_PasswordDoNotMatch()
|
||||
@@ -78,7 +78,8 @@ class ClientTest extends \BBTestCase {
|
||||
$di['validator'] = $validatorMock;
|
||||
$client->setDi($di);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Passwords do not match.');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Passwords do not match.');
|
||||
$client->change_password($data);
|
||||
}
|
||||
|
||||
@@ -189,7 +190,7 @@ class ClientTest extends \BBTestCase {
|
||||
|
||||
$result = $api->balance_get_total();
|
||||
|
||||
$this->assertInternalType('float', $result);
|
||||
$this->assertIsFloat($result);
|
||||
$this->assertEquals($balanceAmount, $result);
|
||||
|
||||
}
|
||||
@@ -211,7 +212,7 @@ class ClientTest extends \BBTestCase {
|
||||
$api->setIdentity($client);
|
||||
|
||||
$result = $api->is_taxable();
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertEquals($clientIsTaxable, $result);
|
||||
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ class GuestTest extends \BBTestCase {
|
||||
|
||||
$result = $client->create($data);
|
||||
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($model->id, $result);
|
||||
}
|
||||
|
||||
@@ -111,7 +111,8 @@ class GuestTest extends \BBTestCase {
|
||||
$client->setDi($di);
|
||||
$client->setService($serviceMock);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Email is already registered. You may want to login instead of registering.');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Email is already registered. You may want to login instead of registering.');
|
||||
$client->create($data);
|
||||
}
|
||||
|
||||
@@ -133,7 +134,8 @@ class GuestTest extends \BBTestCase {
|
||||
$di['mod_config'] = $di->protect(function ($name) use($configArr) { return $configArr; });
|
||||
$client->setDi($di);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'New registrations are temporary disabled');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('New registrations are temporary disabled');
|
||||
$client->create($data);
|
||||
}
|
||||
|
||||
@@ -158,7 +160,8 @@ class GuestTest extends \BBTestCase {
|
||||
$di['validator'] = $validatorMock;
|
||||
$client->setDi($di);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Passwords do not match.');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Passwords do not match.');
|
||||
$client->create($data);
|
||||
}
|
||||
|
||||
@@ -214,7 +217,7 @@ class GuestTest extends \BBTestCase {
|
||||
|
||||
$results = $client->login($data);
|
||||
|
||||
$this->assertInternalType('array', $results);
|
||||
$this->assertIsArray($results);
|
||||
}
|
||||
|
||||
public function testreset_password()
|
||||
@@ -285,7 +288,8 @@ class GuestTest extends \BBTestCase {
|
||||
$client = new \Box\Mod\Client\Api\Guest();
|
||||
$client->setDi($di);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Email not found in our database');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Email not found in our database');
|
||||
$client->reset_password($data);
|
||||
}
|
||||
|
||||
@@ -361,7 +365,8 @@ class GuestTest extends \BBTestCase {
|
||||
$client = new \Box\Mod\Client\Api\Guest();
|
||||
$client->setDi($di);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'The link have expired or you have already confirmed password reset.');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('The link have expired or you have already confirmed password reset.');
|
||||
$client->confirm_reset($data);
|
||||
}
|
||||
|
||||
@@ -387,7 +392,7 @@ class GuestTest extends \BBTestCase {
|
||||
$client->setDi($di);
|
||||
|
||||
$result = $client->is_vat($data);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -402,7 +407,7 @@ class GuestTest extends \BBTestCase {
|
||||
$client->setDi($di);
|
||||
|
||||
$result = $client->required();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,7 +71,8 @@ class ServiceBalanceTest extends \BBTestCase
|
||||
'rel_id' => 1,
|
||||
);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Funds description is not valid');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Funds description is not valid');
|
||||
$service->deductFunds($clientModel, $amount, $description, $extra);
|
||||
}
|
||||
|
||||
@@ -89,7 +90,8 @@ class ServiceBalanceTest extends \BBTestCase
|
||||
'rel_id' => 1,
|
||||
);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Funds amount is not valid');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Funds amount is not valid');
|
||||
$service->deductFunds($clientModel, $amount, $description, $extra);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,8 @@ class ServiceTest extends \BBTestCase {
|
||||
$clientService = new \Box\Mod\Client\Service();
|
||||
$clientService->setDi($di);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Invalid email confirmation link');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Invalid email confirmation link');
|
||||
$clientService->approveClientEmailByHash('');
|
||||
}
|
||||
|
||||
@@ -77,7 +78,7 @@ class ServiceTest extends \BBTestCase {
|
||||
$client_id = 1;
|
||||
$result = $clientService->generateEmailConfirmationLink($client_id);
|
||||
|
||||
$this->assertInternalType('string', $result);
|
||||
$this->assertIsString($result);
|
||||
$this->assertTrue(strpos($result, '/client/confirm-email/') !== false);
|
||||
}
|
||||
|
||||
@@ -263,8 +264,8 @@ class ServiceTest extends \BBTestCase {
|
||||
{
|
||||
$clientService = new \Box\Mod\Client\Service();
|
||||
$result = $clientService->getSearchQuery($data);
|
||||
$this->assertInternalType('string', $result[0]);
|
||||
$this->assertInternalType('array', $result[1]);
|
||||
$this->assertIsString($result[0]);
|
||||
$this->assertIsArray($result[1]);
|
||||
|
||||
$this->assertTrue(strpos($result[0], $expectedStr) !== false, $result[0]);
|
||||
$this->assertTrue(array_diff_key($result[1], $expectedParams) == array());
|
||||
@@ -276,8 +277,8 @@ class ServiceTest extends \BBTestCase {
|
||||
$selectStmt = 'c.id, CONCAT(c.first_name, c.last_name) as full_name';
|
||||
$clientService = new \Box\Mod\Client\Service();
|
||||
$result = $clientService->getSearchQuery($data, $selectStmt);
|
||||
$this->assertInternalType('string', $result[0]);
|
||||
$this->assertInternalType('array', $result[1]);
|
||||
$this->assertIsString($result[0]);
|
||||
$this->assertIsArray($result[1]);
|
||||
|
||||
$this->assertTrue(strpos($result[0], $selectStmt) !== false, $result[0]);
|
||||
}
|
||||
@@ -300,7 +301,7 @@ class ServiceTest extends \BBTestCase {
|
||||
$clientService = new \Box\Mod\Client\Service();
|
||||
$clientService->setDi($di);
|
||||
$result = $clientService->getPairs($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testtoSessionArray()
|
||||
@@ -317,7 +318,7 @@ class ServiceTest extends \BBTestCase {
|
||||
$clientService = new \Box\Mod\Client\Service();
|
||||
$result = $clientService->toSessionArray($model);
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertTrue(array_diff_key($result, $expectedArrayKeys) == array());
|
||||
}
|
||||
|
||||
@@ -337,7 +338,7 @@ class ServiceTest extends \BBTestCase {
|
||||
$clientService->setDi($di);
|
||||
|
||||
$result = $clientService->emailAreadyRegistered($email);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
}
|
||||
|
||||
public function testEmailAlreadyRegWithModel()
|
||||
@@ -350,7 +351,7 @@ class ServiceTest extends \BBTestCase {
|
||||
$clientService = new \Box\Mod\Client\Service();
|
||||
|
||||
$result = $clientService->emailAreadyRegistered($email, $model);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertEquals(false, $result);
|
||||
}
|
||||
|
||||
@@ -371,7 +372,7 @@ class ServiceTest extends \BBTestCase {
|
||||
$clientService = new \Box\Mod\Client\Service();
|
||||
$clientService->setDi($di);
|
||||
$result = $clientService->canChangeCurrency($model, $currency);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -387,7 +388,7 @@ class ServiceTest extends \BBTestCase {
|
||||
$clientService = new \Box\Mod\Client\Service();
|
||||
|
||||
$result = $clientService->canChangeCurrency($model, $currency);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -404,7 +405,7 @@ class ServiceTest extends \BBTestCase {
|
||||
$clientService = new \Box\Mod\Client\Service();
|
||||
|
||||
$result = $clientService->canChangeCurrency($model, $currency);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
@@ -420,7 +421,8 @@ class ServiceTest extends \BBTestCase {
|
||||
$invoiceModel->loadBean(new \RedBeanPHP\OODBBean());
|
||||
|
||||
$database = $this->getMockBuilder('\Box_Database')->getMock();
|
||||
$database->expects($this->at(0))->method('findOne')
|
||||
$database->expects($this->once())
|
||||
->method('findOne')
|
||||
->will($this->returnValue($invoiceModel));
|
||||
|
||||
$di = new \Box_Di();
|
||||
@@ -429,7 +431,8 @@ class ServiceTest extends \BBTestCase {
|
||||
$clientService = new \Box\Mod\Client\Service();
|
||||
$clientService->setDi($di);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Currency can not be changed. Client already have invoices issued.');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Currency can not be changed. Client already have invoices issued.');
|
||||
$clientService->canChangeCurrency($model, $currency);
|
||||
}
|
||||
|
||||
@@ -445,10 +448,8 @@ class ServiceTest extends \BBTestCase {
|
||||
$clientOrderModel->loadBean(new \RedBeanPHP\OODBBean());
|
||||
|
||||
$database = $this->getMockBuilder('\Box_Database')->getMock();
|
||||
$database->expects($this->at(0))->method('findOne')
|
||||
->will($this->returnValue(null));
|
||||
$database->expects($this->at(1))->method('findOne')
|
||||
->will($this->returnValue($clientOrderModel));
|
||||
$database->expects($this->exactly(2))->method('findOne')
|
||||
->will($this->onConsecutiveCalls($this->returnValue(null, $clientorderModel)));
|
||||
|
||||
$di = new \Box_Di();
|
||||
$di['db'] = $database;
|
||||
@@ -456,7 +457,6 @@ class ServiceTest extends \BBTestCase {
|
||||
$clientService = new \Box\Mod\Client\Service();
|
||||
$clientService->setDi($di);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Currency can not be changed. Client already have orders.');
|
||||
$clientService->canChangeCurrency($model, $currency);
|
||||
}
|
||||
|
||||
@@ -502,8 +502,8 @@ class ServiceTest extends \BBTestCase {
|
||||
$clientBalanceService->setDi($di);
|
||||
list ($sql, $params) = $clientBalanceService->getSearchQuery($data);
|
||||
$this->assertNotEmpty($sql);
|
||||
$this->assertInternalType('string', $sql);
|
||||
$this->assertInternalType('array', $params);
|
||||
$this->assertIsString($sql);
|
||||
$this->assertIsArray($params);
|
||||
|
||||
$this->assertTrue(strpos($sql, $expectedStr) !== false, $sql);
|
||||
$this->assertTrue(array_diff_key($params, $expectedParams) == array());
|
||||
@@ -550,7 +550,8 @@ class ServiceTest extends \BBTestCase {
|
||||
|
||||
$clientService = new \Box\Mod\Client\Service();
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Define clients currency before adding funds.');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Define clients currency before adding funds.');
|
||||
$clientService->addFunds($modelClient, $amount, $description);
|
||||
|
||||
}
|
||||
@@ -567,7 +568,8 @@ class ServiceTest extends \BBTestCase {
|
||||
|
||||
$clientService = new \Box\Mod\Client\Service();
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Funds amount is not valid');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Funds amount is not valid');
|
||||
$clientService->addFunds($modelClient, $amount, $description);
|
||||
}
|
||||
|
||||
@@ -584,7 +586,8 @@ class ServiceTest extends \BBTestCase {
|
||||
|
||||
$clientService = new \Box\Mod\Client\Service();
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Funds description is not valid');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Funds description is not valid');
|
||||
$result = $clientService->addFunds($modelClient, $amount, $description);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
@@ -602,7 +605,7 @@ class ServiceTest extends \BBTestCase {
|
||||
$clientService->setDi($di);
|
||||
|
||||
$result = $clientService->getExpiredPasswordReminders();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function searchHistoryQueryData()
|
||||
@@ -611,10 +614,10 @@ class ServiceTest extends \BBTestCase {
|
||||
array(array(), 'SELECT ach.*, c.first_name, c.last_name, c.email', array()),
|
||||
array(
|
||||
array('search' => 'sameValue'),
|
||||
'c.first_name LIKE %:first_name% OR c.last_name LIKE %:last_name% OR c.id LIKE :id',
|
||||
'c.first_name LIKE :first_name OR c.last_name LIKE :last_name OR c.id LIKE :id',
|
||||
array(
|
||||
':first_name' => 'sameValue',
|
||||
':last_name' => 'sameValue',
|
||||
':first_name' => '%sameValue%',
|
||||
':last_name' => '%sameValue%',
|
||||
':id' => 'sameValue')
|
||||
),
|
||||
array(
|
||||
@@ -638,8 +641,8 @@ class ServiceTest extends \BBTestCase {
|
||||
$clientService->setDi($di);
|
||||
list ($sql, $params) = $clientService->getHistorySearchQuery($data);
|
||||
$this->assertNotEmpty($sql);
|
||||
$this->assertInternalType('string', $sql);
|
||||
$this->assertInternalType('array', $params);
|
||||
$this->assertIsString($sql);
|
||||
$this->assertIsArray($params);
|
||||
|
||||
$this->assertTrue(strpos($sql, $expectedStr) !== false, $sql);
|
||||
$this->assertTrue(array_diff_key($params, $expectedParams) == array());
|
||||
@@ -658,7 +661,7 @@ class ServiceTest extends \BBTestCase {
|
||||
$clientService->setDi($di);
|
||||
|
||||
$result = $clientService->counter();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
|
||||
$expected = array(
|
||||
'total' => 0,
|
||||
@@ -681,7 +684,7 @@ class ServiceTest extends \BBTestCase {
|
||||
$clientService->setDi($di);
|
||||
|
||||
$result = $clientService->getGroupPairs();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testclientAlreadyExists()
|
||||
@@ -765,7 +768,8 @@ class ServiceTest extends \BBTestCase {
|
||||
$service->setDi($di);
|
||||
|
||||
$data = array('id' => 0);
|
||||
$this->setExpectedException('\Box_Exception', 'Client not found');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Client not found');
|
||||
$service->get($data);
|
||||
}
|
||||
|
||||
@@ -785,7 +789,7 @@ class ServiceTest extends \BBTestCase {
|
||||
$service->setDi($di);
|
||||
|
||||
$result = $service->getClientBalance($model);
|
||||
$this->assertInternalType('numeric', $result);
|
||||
$this->assertIsNumeric($result);
|
||||
|
||||
}
|
||||
|
||||
@@ -817,12 +821,13 @@ class ServiceTest extends \BBTestCase {
|
||||
$serviceMock->setDi($di);
|
||||
|
||||
$result = $serviceMock->toApiArray($model, true, new \Model_Admin());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
|
||||
}
|
||||
|
||||
public function testIsClientTaxableProvider()
|
||||
{
|
||||
$this->assertTrue(true);
|
||||
return array(
|
||||
array(
|
||||
false,
|
||||
@@ -910,7 +915,7 @@ class ServiceTest extends \BBTestCase {
|
||||
$service->setDi($di);
|
||||
|
||||
$result = $service->adminCreateClient($data);
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
}
|
||||
|
||||
public function testguestCreateClient()
|
||||
@@ -1004,7 +1009,8 @@ class ServiceTest extends \BBTestCase {
|
||||
|
||||
$model = new \Model_ClientGroup();
|
||||
$model->loadBean(new \RedBeanPHP\OODBBean());
|
||||
$this->setExpectedException('\Box_Exception', 'Can not remove group with clients');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Can not remove group with clients');
|
||||
$service->deleteGroup($model);
|
||||
}
|
||||
|
||||
@@ -1062,9 +1068,6 @@ class ServiceTest extends \BBTestCase {
|
||||
$this->assertInstanceOf('\Model_Client', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testauthorizeClientEmailRequiredNotConfirmed()
|
||||
{
|
||||
$email = 'example@boxbilling.vm';
|
||||
@@ -1077,14 +1080,10 @@ class ServiceTest extends \BBTestCase {
|
||||
$extensionMetaModel->loadBean(new \RedBeanPHP\OODBBean());
|
||||
|
||||
$dbMock = $this->getMockBuilder('\Box_Database')->getMock();
|
||||
$dbMock->expects($this->at(0))
|
||||
$dbMock->expects($this->exactly(2))
|
||||
->method('findOne')
|
||||
->with('Client')
|
||||
->willReturn($clientModel);
|
||||
$dbMock->expects($this->at(1))
|
||||
->method('findOne')
|
||||
->with('ExtensionMeta')
|
||||
->willReturn($extensionMetaModel);
|
||||
->withConsecutive(['Client'],['ExtensionMeta'])
|
||||
->will($this->onConsecutiveCalls($clientModel, $extensionMetaModel));
|
||||
|
||||
$authMock = $this->getMockBuilder('\Box_Authorization')->disableOriginalConstructor()->getMock();
|
||||
$authMock->expects($this->never())
|
||||
@@ -1101,6 +1100,7 @@ class ServiceTest extends \BBTestCase {
|
||||
$service = new \Box\Mod\Client\Service();
|
||||
$service->setDi($di);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $service->authorizeClient($email, $password);
|
||||
$this->assertInstanceOf('\Model_Client', $result);
|
||||
}
|
||||
@@ -1220,7 +1220,8 @@ class ServiceTest extends \BBTestCase {
|
||||
$service = new \Box\Mod\Client\Service();
|
||||
$service->setDi($di);
|
||||
|
||||
$this->setExpectedException('Box_Exception', 'Email can not be changed');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Email can not be changed');
|
||||
$service->canChangeEmail($clientModel, $email);
|
||||
}
|
||||
|
||||
@@ -1239,7 +1240,8 @@ class ServiceTest extends \BBTestCase {
|
||||
});
|
||||
$service = new \Box\Mod\Client\Service();
|
||||
$service->setDi($di);
|
||||
$this->setExpectedException('Box_Exception', 'It is required that you provide details for field "Id"');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('It is required that you provide details for field "Id"');
|
||||
$service->checkExtraRequiredFields($data);
|
||||
}
|
||||
|
||||
@@ -1263,7 +1265,8 @@ class ServiceTest extends \BBTestCase {
|
||||
$data = array();
|
||||
$service = new \Box\Mod\Client\Service();
|
||||
$service->setDi($di);
|
||||
$this->setExpectedException('Box_Exception', 'It is required that you provide details for field "custom_field_title"');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('It is required that you provide details for field "custom_field_title"');
|
||||
$service->checkCustomFields($data);
|
||||
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ class AdminTest extends \BBTestCase {
|
||||
$api_admin->setService($serviceMock);
|
||||
|
||||
$result = $api_admin->info(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testrun()
|
||||
@@ -36,7 +36,7 @@ class AdminTest extends \BBTestCase {
|
||||
$api_admin->setService($serviceMock);
|
||||
|
||||
$result = $api_admin->run(array());
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ class GuestTest extends \BBTestCase {
|
||||
$api = new \Box\Mod\Cron\Api\Guest();
|
||||
|
||||
$result = $api->check();
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ class GuestTest extends \BBTestCase {
|
||||
$api->setMod($modMock);
|
||||
|
||||
$result = $api->settings();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testis_late()
|
||||
@@ -45,7 +45,7 @@ class GuestTest extends \BBTestCase {
|
||||
$api->setService($serviceMock);
|
||||
|
||||
$result = $api->is_late();
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ class ServiceTest extends \BBTestCase {
|
||||
$service->setDi($di);
|
||||
|
||||
$result = $service->getCronInfo();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testrunCrons()
|
||||
@@ -86,7 +86,7 @@ class ServiceTest extends \BBTestCase {
|
||||
$service->setDi($di);
|
||||
|
||||
$result = $service->getLastExecutionTime();
|
||||
$this->assertInternalType('string', $result);
|
||||
$this->assertIsString($result);
|
||||
}
|
||||
|
||||
public function testisLate()
|
||||
@@ -100,7 +100,7 @@ class ServiceTest extends \BBTestCase {
|
||||
->will($this->returnValue(date('Y-m-d H:i:s')));
|
||||
|
||||
$result = $serviceMock->isLate();
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Box\Tests\Mod\Currency\Api;
|
||||
|
||||
class AdminTest extends \BBTestCase
|
||||
class Api_AdminTest extends \BBTestCase
|
||||
{
|
||||
public $availableCurrencies = array(
|
||||
'AED' => 'AED - United Arab Emirates dirham',
|
||||
@@ -195,8 +195,8 @@ class AdminTest extends \BBTestCase
|
||||
|
||||
$result = $adminApi->get_list(array());
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertInternalType('array', $result['list']);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertIsArray($result['list']);
|
||||
}
|
||||
|
||||
public function testGetPairs()
|
||||
@@ -211,7 +211,7 @@ class AdminTest extends \BBTestCase
|
||||
$adminApi->setService($service);
|
||||
$result = $adminApi->get_pairs();
|
||||
$this->assertEquals($result, $this->availableCurrencies);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testGet()
|
||||
@@ -241,7 +241,7 @@ class AdminTest extends \BBTestCase
|
||||
$adminApi->setService($service);
|
||||
$adminApi->setDi($di);
|
||||
$result = $adminApi->get($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testGetDefault()
|
||||
@@ -277,12 +277,12 @@ class AdminTest extends \BBTestCase
|
||||
$adminApi->setService($service);
|
||||
$result = $adminApi->get_default(array());
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertEquals($result, $returnArr);
|
||||
|
||||
$this->assertEquals($model->code, $returnArr['code']);
|
||||
$this->assertEquals($model->title, $returnArr['title']);
|
||||
$this->assertInternalType('float', $returnArr['conversion_rate']);
|
||||
$this->assertIsFloat($returnArr['conversion_rate']);
|
||||
$this->assertEquals((float)$model->conversion_rate, $returnArr['conversion_rate']);
|
||||
$this->assertEquals($model->format, $returnArr['format']);
|
||||
$this->assertEquals($model->price_format, $returnArr['price_format']);
|
||||
@@ -290,7 +290,7 @@ class AdminTest extends \BBTestCase
|
||||
|
||||
}
|
||||
|
||||
public function testCreateExceptionProvider()
|
||||
public function CreateExceptionProvider()
|
||||
{
|
||||
$model = new \Model_Currency();
|
||||
$model->loadBean(new \RedBeanPHP\OODBBean());
|
||||
@@ -321,8 +321,7 @@ class AdminTest extends \BBTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
* @dataProvider testCreateExceptionProvider
|
||||
* @dataProvider CreateExceptionProvider
|
||||
*/
|
||||
public function testCreateException($data, $getByCodeCalled, $getByCodeReturn, $getAvailableCurrenciesCalled)
|
||||
{
|
||||
@@ -348,6 +347,7 @@ class AdminTest extends \BBTestCase
|
||||
|
||||
$adminApi->setService($service);
|
||||
$adminApi->setDi($di);
|
||||
$this->expectException(\Box_exception::class);
|
||||
$adminApi->create($data); //Expecting \Box_Exception every time
|
||||
}
|
||||
|
||||
@@ -385,7 +385,7 @@ class AdminTest extends \BBTestCase
|
||||
|
||||
$result = $adminApi->create($data);
|
||||
|
||||
$this->assertInternalType('string', $result);
|
||||
$this->assertIsString($result);
|
||||
$this->assertEquals(strlen($result), 3);
|
||||
$this->assertEquals($result, $data['code']);
|
||||
|
||||
@@ -423,7 +423,7 @@ class AdminTest extends \BBTestCase
|
||||
|
||||
$result = $adminApi->update($data);
|
||||
|
||||
$this->assertInternalType('boolean', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertEquals($result, true);
|
||||
|
||||
}
|
||||
@@ -449,6 +449,7 @@ class AdminTest extends \BBTestCase
|
||||
|
||||
$adminApi->setDi($di);
|
||||
$adminApi->setService($service);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$adminApi->delete(array()); //Expecting \Box_Exception every time
|
||||
}
|
||||
|
||||
@@ -482,11 +483,11 @@ class AdminTest extends \BBTestCase
|
||||
|
||||
$result = $adminApi->delete($data);
|
||||
|
||||
$this->assertInternalType('boolean', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertEquals($result, true);
|
||||
}
|
||||
|
||||
public function testSetDefaultExceptionProvider()
|
||||
public function SetDefaultExceptionProvider()
|
||||
{
|
||||
$model = new \Model_Currency();
|
||||
$model->loadBean(new \RedBeanPHP\OODBBean());
|
||||
@@ -505,7 +506,7 @@ class AdminTest extends \BBTestCase
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
* @dataProvider testSetDefaultExceptionProvider
|
||||
* @dataProvider SetDefaultExceptionProvider
|
||||
*/
|
||||
public function testSetDefaultException($data, $getByCodeCalled, $getByCodeReturn)
|
||||
{
|
||||
@@ -526,6 +527,7 @@ class AdminTest extends \BBTestCase
|
||||
$adminApi->setDi($di);
|
||||
|
||||
$adminApi->setService($service);
|
||||
$this->expectException(\Box_exception::class);
|
||||
$adminApi->set_default($data); //Expecting \Box_Exception every time
|
||||
}
|
||||
|
||||
@@ -564,7 +566,7 @@ class AdminTest extends \BBTestCase
|
||||
|
||||
$result = $adminApi->set_default($data);
|
||||
|
||||
$this->assertInternalType('boolean', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertEquals($result, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Box\Tests\Mod\Currency\Api;
|
||||
|
||||
class GuestTest extends \BBTestCase
|
||||
class Api_GuestTest extends \BBTestCase
|
||||
{
|
||||
public function testGetPairs()
|
||||
{
|
||||
@@ -22,12 +22,12 @@ class GuestTest extends \BBTestCase
|
||||
|
||||
$result = $guestApi->get_pairs(array());
|
||||
$this->assertEquals($result, $willReturn);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertArrayHasKey('EUR', $result);
|
||||
$this->assertArrayHasKey('USD', $result);
|
||||
}
|
||||
|
||||
public function testGetProvider()
|
||||
public function getProvider()
|
||||
{
|
||||
$model = new \Model_Currency();
|
||||
|
||||
@@ -51,7 +51,7 @@ class GuestTest extends \BBTestCase
|
||||
|
||||
/**
|
||||
*
|
||||
* @dataProvider testGetProvider
|
||||
* @dataProvider getProvider
|
||||
*/
|
||||
public function testGet($data, $model, $expectsGetByCode, $expectsGetDefault)
|
||||
{
|
||||
@@ -82,13 +82,10 @@ class GuestTest extends \BBTestCase
|
||||
$guestApi->setService($service);
|
||||
|
||||
$result = $guestApi->get($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertEquals($result, $willReturn);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testGetException()
|
||||
{
|
||||
$guestApi = new \Box\Mod\Currency\Api\Guest();
|
||||
@@ -112,11 +109,11 @@ class GuestTest extends \BBTestCase
|
||||
->will($this->returnValue(null));
|
||||
|
||||
$guestApi->setService($service);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $guestApi->get(array()); //Expecting \Box_Exception
|
||||
}
|
||||
|
||||
public function testFormatPriceFormatProvider()
|
||||
public function formatPriceFormatProvider()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
@@ -143,7 +140,7 @@ class GuestTest extends \BBTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider testFormatPriceFormatProvider
|
||||
* @dataProvider formatPriceFormatProvider
|
||||
*/
|
||||
public function testFormatPriceFormat($price_format, $expectedResult)
|
||||
{
|
||||
@@ -180,7 +177,7 @@ class GuestTest extends \BBTestCase
|
||||
$this->assertEquals($result, $expectedResult);
|
||||
}
|
||||
|
||||
public function testFormatProvider()
|
||||
public function formatProvider()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
@@ -209,7 +206,7 @@ class GuestTest extends \BBTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider testFormatProvider
|
||||
* @dataProvider formatProvider
|
||||
*/
|
||||
public function testFormat($data, $expectedResult)
|
||||
{
|
||||
|
||||
@@ -22,8 +22,8 @@ class ServiceTest extends \BBTestCase
|
||||
{
|
||||
$service = new \Box\Mod\Currency\Service();
|
||||
$result = $service->getSearchQuery(array());
|
||||
$this->assertInternalType('string', $result[0]);
|
||||
$this->assertInternalType('array', $result[1]);
|
||||
$this->assertIsString($result[0]);
|
||||
$this->assertIsArray($result[1]);
|
||||
$this->assertEquals("SELECT * FROM currency WHERE 1", $result[0]);
|
||||
}
|
||||
|
||||
@@ -45,11 +45,6 @@ class ServiceTest extends \BBTestCase
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @expectedException \Box_Exception
|
||||
*
|
||||
*/
|
||||
public function testGetBaseCurrencyRateException()
|
||||
{
|
||||
$service = new \Box\Mod\Currency\Service();
|
||||
@@ -63,11 +58,12 @@ class ServiceTest extends \BBTestCase
|
||||
$di['db'] = $db;
|
||||
$service->setDi($di);
|
||||
$code = 'EUR';
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$service->getBaseCurrencyRate($code); //Expecting exception
|
||||
}
|
||||
|
||||
|
||||
public function testToBaseCurrencyProvider()
|
||||
public function toBaseCurrencyProvider()
|
||||
{
|
||||
return array(
|
||||
array('EUR', 'USD', 100, 0.73, 73), // 100 USD ~ 72.99 EUR
|
||||
@@ -77,7 +73,7 @@ class ServiceTest extends \BBTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider testToBaseCurrencyProvider
|
||||
* @dataProvider toBaseCurrencyProvider
|
||||
*/
|
||||
public function testToBaseCurrency($defaultCode, $foreignCode, $amount, $rate, $expected)
|
||||
{
|
||||
@@ -103,7 +99,7 @@ class ServiceTest extends \BBTestCase
|
||||
$this->assertEquals($expected, round($result, 2));
|
||||
}
|
||||
|
||||
public function testGetCurrencyByClientIdProvider()
|
||||
public function getCurrencyByClientIdProvider()
|
||||
{
|
||||
$model = new \Model_Currency();
|
||||
$bean = new \RedBeanPHP\OODBBean();
|
||||
@@ -126,7 +122,7 @@ class ServiceTest extends \BBTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider testGetCurrencyByClientIdProvider
|
||||
* @dataProvider getCurrencyByClientIdProvider
|
||||
*/
|
||||
public function testGetCurrencyByClientId($row, $currency, $expectsGetByCode, $getDefaultCalled)
|
||||
{
|
||||
@@ -209,7 +205,7 @@ class ServiceTest extends \BBTestCase
|
||||
$this->assertEquals($model->code, $currency);
|
||||
}
|
||||
|
||||
public function testGetRateByCodeProvider()
|
||||
public function getRateByCodeProvider()
|
||||
{
|
||||
return array(
|
||||
array('EUR', 0.6, 0.6),
|
||||
@@ -219,7 +215,7 @@ class ServiceTest extends \BBTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider testGetRateByCodeProvider
|
||||
* @dataProvider getRateByCodeProvider
|
||||
*/
|
||||
public function testGetRateByCode($code, $returns, $expected)
|
||||
{
|
||||
@@ -251,7 +247,7 @@ class ServiceTest extends \BBTestCase
|
||||
$db = $this->getMockBuilder('Box_Database')->getMock();
|
||||
$db->expects($this->atLeastOnce())
|
||||
->method('findOne')
|
||||
->willReturn(null);
|
||||
->willReturn(array());
|
||||
$db->expects($this->atLeastOnce())
|
||||
->method('load')
|
||||
->willReturn($model);
|
||||
@@ -263,7 +259,7 @@ class ServiceTest extends \BBTestCase
|
||||
$this->assertEquals($model, $result);
|
||||
}
|
||||
|
||||
public function testSetAsDefaultProvider()
|
||||
public function setAsDefaultProvider()
|
||||
{
|
||||
$firstModel = new \Model_Currency();
|
||||
$firstModel->loadBean(new \RedBeanPHP\OODBBean());
|
||||
@@ -282,7 +278,7 @@ class ServiceTest extends \BBTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider testSetAsDefaultProvider
|
||||
* @dataProvider setAsDefaultProvider
|
||||
*/
|
||||
public function testSetAsDefault($model, $expects)
|
||||
{
|
||||
@@ -302,11 +298,6 @@ class ServiceTest extends \BBTestCase
|
||||
$this->assertEquals(true, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @expectedException \Box_Exception
|
||||
*
|
||||
*/
|
||||
public function testSetAsDefaultException()
|
||||
{
|
||||
$service = new \Box\Mod\Currency\Service();
|
||||
@@ -324,6 +315,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$di['db'] = $db;
|
||||
$service->setDi($di);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$service->setAsDefault($model); //Currency code is null, should throw an \Box_Exception
|
||||
}
|
||||
|
||||
@@ -513,12 +505,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$this->assertEquals($result, $availableCurrencies);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @expectedException \Box_Exception
|
||||
*
|
||||
*/
|
||||
|
||||
public function testRmDefaultCurrencyException()
|
||||
{
|
||||
$service = new \Box\Mod\Currency\Service();
|
||||
@@ -536,6 +523,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$di['db'] = $db;
|
||||
$service->setDi($di);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$service->rm($model); //will throw \Box_Exception because default currency can not be removed
|
||||
}
|
||||
|
||||
@@ -561,12 +549,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$this->assertEquals($result, null);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @expectedException \Box_Exception
|
||||
*
|
||||
*/
|
||||
|
||||
public function testRmMissingCodeException()
|
||||
{
|
||||
$service = new \Box\Mod\Currency\Service();
|
||||
@@ -584,6 +567,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$di['db'] = $db;
|
||||
$service->setDi($di);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$service->rm($model); //will throw \Box_Exception because currency code is not set
|
||||
}
|
||||
|
||||
@@ -649,7 +633,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$result = $service->createCurrency($code, $format, 'Euros', 0.6);
|
||||
|
||||
$this->assertInternalType('string', $result);
|
||||
$this->assertIsString($result);
|
||||
$this->assertEquals(strlen($result), 3);
|
||||
$this->assertEquals($result, $code);
|
||||
|
||||
@@ -680,14 +664,11 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$result = $service->updateCurrency($code, $format, $title, $price_format, $conversion_rate);
|
||||
|
||||
$this->assertInternalType('boolean', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertEquals($result, true);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testUpdateCurrencyNotFoundException()
|
||||
{
|
||||
$code = 'EUR';
|
||||
@@ -700,12 +681,10 @@ class ServiceTest extends \BBTestCase
|
||||
$service->expects($this->atLeastOnce())
|
||||
->method('getByCode')
|
||||
->will($this->returnValue(false));
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$service->updateCurrency($code, $format, $title, $price_format, $conversion_rate); //Expecting \Box_Exception every time
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testUpdateConversionRateException()
|
||||
{
|
||||
$code = 'EUR';
|
||||
@@ -721,6 +700,7 @@ class ServiceTest extends \BBTestCase
|
||||
->method('getByCode')
|
||||
->will($this->returnValue($model));
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$service->updateCurrency($code, $format, $title, $price_format, $conversion_rate); //Expecting \Box_Exception every time
|
||||
}
|
||||
|
||||
@@ -763,7 +743,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$result = $service->updateCurrencyRates(array());
|
||||
|
||||
$this->assertInternalType('boolean', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertEquals($result, true);
|
||||
}
|
||||
|
||||
@@ -803,7 +783,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$result = $service->updateCurrencyRates(array());
|
||||
|
||||
$this->assertInternalType('boolean', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertEquals($result, true);
|
||||
}
|
||||
|
||||
@@ -840,13 +820,10 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$result = $service->deleteCurrencyByCode($code);
|
||||
|
||||
$this->assertInternalType('boolean', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertEquals($result, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_exception
|
||||
*/
|
||||
|
||||
public function testDeleteModelNotFoundException()
|
||||
{
|
||||
$code = 'EUR';
|
||||
@@ -856,9 +833,10 @@ class ServiceTest extends \BBTestCase
|
||||
->method('getByCode')
|
||||
->will($this->returnValue(null));
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $service->deleteCurrencyByCode($code);
|
||||
|
||||
$this->assertInternalType('boolean', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertEquals($result, true);
|
||||
}
|
||||
|
||||
@@ -869,13 +847,11 @@ class ServiceTest extends \BBTestCase
|
||||
$service->validateCurrencyFormat('${{price}}');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Exception
|
||||
*/
|
||||
public function testValidateCurrencyFormatPriceTagMissing()
|
||||
{
|
||||
$service = new \Box\Mod\Currency\Service();
|
||||
|
||||
$this->expectException(\Exception::class);
|
||||
$service->validateCurrencyFormat('$$$');
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace Box\Tests\Mod\Email\Api;
|
||||
|
||||
class AdminTest extends \BBTestCase
|
||||
class Api_AdminTest extends \BBTestCase
|
||||
{
|
||||
|
||||
public function testEmail_get_list()
|
||||
@@ -34,10 +34,10 @@ class AdminTest extends \BBTestCase
|
||||
$adminApi->setService($service);
|
||||
|
||||
$result = $adminApi->email_get_list(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
|
||||
$this->assertArrayHasKey('list', $result);
|
||||
$this->assertInternalType('array', $result['list']);
|
||||
$this->assertIsArray($result['list']);
|
||||
}
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ class AdminTest extends \BBTestCase
|
||||
|
||||
$result = $adminApi->email_get($data);
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertEquals($result, $expected);
|
||||
}
|
||||
|
||||
@@ -205,7 +205,8 @@ class AdminTest extends \BBTestCase
|
||||
$di['validator'] = $validatorMock;
|
||||
$adminApi->setDi($di);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Email not found');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Email not found');
|
||||
$adminApi->email_resend($data);
|
||||
}
|
||||
|
||||
@@ -233,7 +234,8 @@ class AdminTest extends \BBTestCase
|
||||
$di['validator'] = $validatorMock;
|
||||
$adminApi->setDi($di);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Email not found');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Email not found');
|
||||
$adminApi->email_delete($data);
|
||||
}
|
||||
|
||||
@@ -311,10 +313,10 @@ class AdminTest extends \BBTestCase
|
||||
$adminApi->setService($service);
|
||||
|
||||
$result = $adminApi->template_get_list(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
|
||||
$this->assertArrayHasKey('list', $result);
|
||||
$this->assertInternalType('array', $result['list']);
|
||||
$this->assertIsArray($result['list']);
|
||||
}
|
||||
|
||||
public function testTemplate_get()
|
||||
@@ -349,7 +351,7 @@ class AdminTest extends \BBTestCase
|
||||
$adminApi->setService($emailService);
|
||||
|
||||
$result = $adminApi->template_get($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testTemplate_delete()
|
||||
@@ -407,7 +409,8 @@ class AdminTest extends \BBTestCase
|
||||
$di['validator'] = $validatorMock;
|
||||
$adminApi->setDi($di);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Email template not found');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Email template not found');
|
||||
$adminApi->template_delete($data);
|
||||
}
|
||||
|
||||
@@ -450,9 +453,6 @@ class AdminTest extends \BBTestCase
|
||||
$this->assertEquals($result, $modelId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testTemplate_sendToNotSetException()
|
||||
{
|
||||
$adminApi = new \Box\Mod\Email\Api\Admin();
|
||||
@@ -462,6 +462,7 @@ class AdminTest extends \BBTestCase
|
||||
->will($this->returnValue(null));
|
||||
$di['validator'] = $validatorMock;
|
||||
$adminApi->setDi($di);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$adminApi->template_send(array('code' => 'code'));
|
||||
}
|
||||
|
||||
@@ -645,16 +646,24 @@ class AdminTest extends \BBTestCase
|
||||
->method('template_get')
|
||||
->will($this->returnValue(array('vars' => array(), 'content' => 'content')));
|
||||
|
||||
$twig = $this->getMockBuilder('Twig_Environment')->getMock();
|
||||
$twig->expects($this->atLeastOnce())
|
||||
->method('render')
|
||||
->will($this->returnValue('rendered'));
|
||||
$loader = new \Twig\Loader\ArrayLoader();
|
||||
$twig = $this->getMockBuilder('Twig\Environment')->setConstructorArgs([$loader,['debug' => false]])->getMock();
|
||||
|
||||
$di = new \Box_Di();
|
||||
$di['twig'] = $twig;
|
||||
$di['array_get'] = $di->protect(function (array $array, $key, $default = null) use ($di) {
|
||||
return isset ($array[$key]) ? $array[$key] : $default;
|
||||
});
|
||||
|
||||
$systemService = $this->getMockBuilder('Box\Mod\System\Service')->setMethods(['renderString'])->getMock();
|
||||
$systemService->expects($this->atLeastOnce())
|
||||
->method('renderString')
|
||||
->will($this->returnValue('rendered'));
|
||||
|
||||
$di['mod_service'] = $di->protect(function () use ($systemService) {
|
||||
return $systemService;
|
||||
});
|
||||
|
||||
$adminApi->setDi($di);
|
||||
|
||||
$result = $adminApi->template_render(array('id' => 5));
|
||||
@@ -679,4 +688,4 @@ class AdminTest extends \BBTestCase
|
||||
$this->assertEquals(true, $result);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
namespace Box\Tests\Mod\Email\Api;
|
||||
|
||||
|
||||
class ClientTest extends \BBTestCase
|
||||
class Api_ClientTest extends \BBTestCase
|
||||
{
|
||||
public function testGet_list()
|
||||
{
|
||||
@@ -36,10 +36,10 @@ class ClientTest extends \BBTestCase
|
||||
$clientApi->setIdentity($client);
|
||||
|
||||
$result = $clientApi->get_list(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
|
||||
$this->assertArrayHasKey('list', $result);
|
||||
$this->assertInternalType('array', $result['list']);
|
||||
$this->assertIsArray($result['list']);
|
||||
}
|
||||
|
||||
public function testGet()
|
||||
@@ -71,13 +71,10 @@ class ClientTest extends \BBTestCase
|
||||
$clientApi->setIdentity($client);
|
||||
|
||||
$result = $clientApi->get(array('id' => 1));
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
|
||||
public function testGetNotFoundException()
|
||||
{
|
||||
$clientApi = new \Box\Mod\Email\Api\Client();
|
||||
@@ -101,8 +98,9 @@ class ClientTest extends \BBTestCase
|
||||
|
||||
$clientApi->setService($service);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $clientApi->get(array('id' => 1));
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
|
||||
}
|
||||
|
||||
@@ -140,9 +138,6 @@ class ClientTest extends \BBTestCase
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testResendNotFoundException()
|
||||
{
|
||||
$clientApi = new \Box\Mod\Email\Api\Client();
|
||||
@@ -167,8 +162,9 @@ class ClientTest extends \BBTestCase
|
||||
|
||||
$clientApi->setService($service);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $clientApi->resend(array('id' => 1));
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
|
||||
}
|
||||
|
||||
@@ -206,10 +202,7 @@ class ClientTest extends \BBTestCase
|
||||
$this->assertTrue($result);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
|
||||
public function testDeleteNotFoundException()
|
||||
{
|
||||
$clientApi = new \Box\Mod\Email\Api\Client();
|
||||
@@ -234,10 +227,11 @@ class ClientTest extends \BBTestCase
|
||||
|
||||
$clientApi->setService($service);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $clientApi->delete(array('id' => 1));
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@ class ServiceTest extends \BBTestCase
|
||||
$this->assertEquals($di, $result);
|
||||
}
|
||||
|
||||
public function testGetSearchQueryProvider()
|
||||
public function getSearchQueryProvider()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
@@ -28,12 +28,13 @@ class ServiceTest extends \BBTestCase
|
||||
array(
|
||||
'search' => "search_query"
|
||||
),
|
||||
'SELECT * FROM activity_client_email WHERE (m.sender LIKE :sender OR m.recipients LIKE :recipient OR m.subject LIKE :subject OR m.content_text LIKE :context_text) ORDER BY id DESC',
|
||||
'SELECT * FROM activity_client_email WHERE (sender LIKE :sender OR recipients LIKE :recipient OR subject LIKE :subject OR content_text LIKE :content_text OR content_html LIKE :content_html) ORDER BY id DESC',
|
||||
array(
|
||||
':sender' => '%search_query%',
|
||||
':recipient' => '%search_query%',
|
||||
':subject' => '%search_query%',
|
||||
':content_text' => '%search_query%',
|
||||
':content_html' => '%search_query%',
|
||||
),
|
||||
),
|
||||
array(
|
||||
@@ -50,12 +51,13 @@ class ServiceTest extends \BBTestCase
|
||||
'search' => "search_query",
|
||||
'client_id' => 5
|
||||
),
|
||||
'SELECT * FROM activity_client_email WHERE (m.sender LIKE :sender OR m.recipients LIKE :recipient OR m.subject LIKE :subject OR m.content_text LIKE :context_text) AND client_id = :client_id ORDER BY id DESC',
|
||||
'SELECT * FROM activity_client_email WHERE (sender LIKE :sender OR recipients LIKE :recipient OR subject LIKE :subject OR content_text LIKE :content_text OR content_html LIKE :content_html) AND client_id = :client_id ORDER BY id DESC',
|
||||
array(
|
||||
':sender' => '%search_query%',
|
||||
':recipient' => '%search_query%',
|
||||
':subject' => '%search_query%',
|
||||
':content_text' => '%search_query%',
|
||||
':content_html' => '%search_query%',
|
||||
':client_id' => 5,
|
||||
)
|
||||
),
|
||||
@@ -63,7 +65,7 @@ class ServiceTest extends \BBTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider testGetSearchQueryProvider
|
||||
* @dataProvider getSearchQueryProvider
|
||||
*/
|
||||
public function testGetSearchQuery($data, $query, $bindings)
|
||||
{
|
||||
@@ -75,8 +77,8 @@ class ServiceTest extends \BBTestCase
|
||||
$service->setDi($di);
|
||||
$result = $service->getSearchQuery($data);
|
||||
|
||||
$this->assertInternalType('string', $result[0]);
|
||||
$this->assertInternalType('array', $result[1]);
|
||||
$this->assertIsString($result[0]);
|
||||
$this->assertIsArray($result[1]);
|
||||
|
||||
$this->assertEquals($result[0], $query);
|
||||
$this->assertEquals($result[1], $bindings);
|
||||
@@ -207,7 +209,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
|
||||
$result = $service->toApiArray($model);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertEquals($result, $expected);
|
||||
}
|
||||
|
||||
@@ -261,7 +263,7 @@ class ServiceTest extends \BBTestCase
|
||||
$t->vars = 'haNUZYeNjo1oXhH6OkoKuHGPxakyKY10qR3O/DSy9Og=';
|
||||
|
||||
$result = $service->getVars($t);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
@@ -349,11 +351,8 @@ class ServiceTest extends \BBTestCase
|
||||
->method('getParamValue')
|
||||
->will($this->returnValue('value'));
|
||||
|
||||
|
||||
$twig = $this->getMockBuilder('Twig_Environment')->getMock();
|
||||
$twig->expects($this->atLeastOnce())
|
||||
->method('render')
|
||||
->will($this->returnValue('value'));
|
||||
|
||||
$twig = $this->getMockBuilder('\Twig\Environment')->disableOriginalConstructor()->getMock();
|
||||
|
||||
$di['api_admin'] = function () use ($di) {
|
||||
$api = new \Api_Handler(new \Model_Admin());
|
||||
@@ -391,7 +390,7 @@ class ServiceTest extends \BBTestCase
|
||||
}
|
||||
|
||||
|
||||
public function testSendTemplateExistsStaffProvider()
|
||||
public function sendTemplateExistsStaffProvider()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
@@ -423,7 +422,7 @@ class ServiceTest extends \BBTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider testSendTemplateExistsStaffProvider
|
||||
* @dataProvider sendTemplateExistsStaffProvider
|
||||
*/
|
||||
public function testSendTemplateExistsStaff($data, $clientGetExpects, $staffgetListExpects)
|
||||
{
|
||||
@@ -452,6 +451,10 @@ class ServiceTest extends \BBTestCase
|
||||
->method('getParamValue')
|
||||
->will($this->returnValue('value'));
|
||||
|
||||
$system->expects($this->atLeastOnce())
|
||||
->method('renderString')
|
||||
->will($this->returnValue('value'));
|
||||
|
||||
|
||||
$staffServiceMock = $this->getMockBuilder('Box\Mod\Staff\Service')->getMock();
|
||||
$staffServiceMock->expects($staffgetListExpects)
|
||||
@@ -484,11 +487,10 @@ class ServiceTest extends \BBTestCase
|
||||
$clientServiceMock->expects($clientGetExpects)
|
||||
->method('toApiArray')
|
||||
->will($this->returnValue($clientApiArray));
|
||||
|
||||
$twig = $this->getMockBuilder('Twig_Environment')->getMock();
|
||||
$twig->expects($this->atLeastOnce())
|
||||
->method('render')
|
||||
->will($this->returnValue('value'));
|
||||
|
||||
$loader = new \Twig\Loader\ArrayLoader();
|
||||
$twig = $this->getMockBuilder('Twig\Environment')->setConstructorArgs([$loader,['debug' => false]])->getMock();
|
||||
|
||||
|
||||
$cryptMock = $this->getMockBuilder('\Box_Crypt')
|
||||
->disableOriginalConstructor()
|
||||
@@ -516,7 +518,7 @@ class ServiceTest extends \BBTestCase
|
||||
$di['mod_service'] = $di->protect(function ($name) use ($system, $staffServiceMock, $clientServiceMock) {
|
||||
if ($name == 'staff') {
|
||||
return $staffServiceMock;
|
||||
} elseif ($name == 'system') {
|
||||
} elseif ($name == 'System' || $name == 'system') {
|
||||
return $system;
|
||||
} elseif ($name == 'client') {
|
||||
return $clientServiceMock;
|
||||
@@ -578,7 +580,7 @@ class ServiceTest extends \BBTestCase
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
public function testTemplateGetSearchQueryProvider()
|
||||
public function templateGetSearchQueryProvider()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
@@ -624,7 +626,7 @@ class ServiceTest extends \BBTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider testTemplateGetSearchQueryProvider
|
||||
* @dataProvider templateGetSearchQueryProvider
|
||||
*/
|
||||
public function testTemplateGetSearchQuery($data, $query, $bindings)
|
||||
{
|
||||
@@ -636,8 +638,8 @@ class ServiceTest extends \BBTestCase
|
||||
$service->setDi($di);
|
||||
$result = $service->templateGetSearchQuery($data);
|
||||
|
||||
$this->assertInternalType('string', $result[0]);
|
||||
$this->assertInternalType('array', $result[1]);
|
||||
$this->assertIsString($result[0]);
|
||||
$this->assertIsArray($result[1]);
|
||||
|
||||
$this->assertEquals($result[0], $query);
|
||||
$this->assertEquals($result[1], $bindings);
|
||||
@@ -678,7 +680,7 @@ class ServiceTest extends \BBTestCase
|
||||
$service = new \Box\Mod\Email\Service();
|
||||
$result = $service->templateToApiArray($model);
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertEquals($result, $expected);
|
||||
}
|
||||
|
||||
@@ -724,14 +726,14 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$result = $serviceMock->templateToApiArray($model, true);
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertArrayHasKey('vars', $result);
|
||||
$this->assertInternalType('array', $result['vars']);
|
||||
$this->assertIsArray($result['vars']);
|
||||
|
||||
$this->assertEquals($result, $expected);
|
||||
}
|
||||
|
||||
public function testTemplate_updateProvider()
|
||||
public function template_updateProvider()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
@@ -758,7 +760,7 @@ class ServiceTest extends \BBTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider testTemplate_updateProvider
|
||||
* @dataProvider template_updateProvider
|
||||
*/
|
||||
public function testTemplate_update($data, $templateRenderExpects)
|
||||
{
|
||||
@@ -768,9 +770,6 @@ class ServiceTest extends \BBTestCase
|
||||
$model->id = $id;
|
||||
|
||||
$emailServiceMock = $this->getMockBuilder('Box\Mod\Email\Service')->setMethods(array('template_render'))->getMock();
|
||||
$emailServiceMock->expects($templateRenderExpects)
|
||||
->method('template_render')
|
||||
->will($this->returnValue('rendered_string'));
|
||||
|
||||
$db = $this->getMockBuilder('Box_Database')->getMock();
|
||||
$db->expects($this->atLeastOnce())
|
||||
@@ -786,16 +785,21 @@ class ServiceTest extends \BBTestCase
|
||||
->method('decodeJ')
|
||||
->will($this->returnValue(array()));
|
||||
|
||||
$twigMock = $this->getMockBuilder('\Twig_Environment')->disableOriginalConstructor()->getMock();
|
||||
$twigMock->expects($templateRenderExpects)
|
||||
->method('render');
|
||||
$twigMock = $this->getMockBuilder('Twig\Environment')->disableOriginalConstructor()->getMock();
|
||||
|
||||
$di = new \Box_Di();
|
||||
$di['db'] = $db;
|
||||
$di['logger'] = $loggerMock;
|
||||
$di['tools'] = $toolsMock;
|
||||
$di['crypt'] = $cryptMock;
|
||||
$di['twig'] = $twigMock;
|
||||
$di['twig'] = $twigMock;
|
||||
|
||||
$systemServiceMock = $this->getMockBuilder('Box\Mod\System\Service')->getMock();
|
||||
|
||||
$di['mod_service'] = $di->protect(function () use ($systemServiceMock) {
|
||||
return $systemServiceMock;
|
||||
});
|
||||
|
||||
$emailServiceMock->setDi($di);
|
||||
|
||||
$templateModel = new \Model_EmailTemplate();
|
||||
@@ -827,9 +831,6 @@ class ServiceTest extends \BBTestCase
|
||||
$this->assertEquals($id, $result->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testGetEmailByIdException()
|
||||
{
|
||||
$service = new \Box\Mod\Email\Service();
|
||||
@@ -843,6 +844,7 @@ class ServiceTest extends \BBTestCase
|
||||
$di['db'] = $db;
|
||||
$service->setDi($di);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$service->getEmailById(5);
|
||||
}
|
||||
|
||||
@@ -882,7 +884,7 @@ class ServiceTest extends \BBTestCase
|
||||
$this->assertEquals($emailTemplateModel, $result);
|
||||
}
|
||||
|
||||
public function testBatchTemplateGenerateProvider()
|
||||
public function batchTemplateGenerateProvider()
|
||||
{
|
||||
return array(
|
||||
array(true, false, $this->never(), $this->never()),
|
||||
@@ -891,7 +893,7 @@ class ServiceTest extends \BBTestCase
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @dataProvider testBatchTemplateGenerateProvider
|
||||
* @dataProvider batchTemplateGenerateProvider
|
||||
*/
|
||||
public function testBatchTemplateGenerate($findOneReturn, $isExtensionActiveReturn, $findOneExpects, $dispenseExpects)
|
||||
{
|
||||
@@ -986,12 +988,9 @@ class ServiceTest extends \BBTestCase
|
||||
$queueModel->to_name = 'To Name';
|
||||
|
||||
$db = $this->getMockBuilder('Box_Database')->getMock();
|
||||
$db->expects($this->at(0))
|
||||
$db->expects($this->exactly(2))
|
||||
->method('findOne')
|
||||
->will($this->returnValue($queueModel));
|
||||
$db->expects($this->at(1))
|
||||
->method('findOne')
|
||||
->will($this->returnValue(false));
|
||||
->will($this->onConsecutiveCalls($queueModel, false));
|
||||
$db->expects($this->atLeastOnce())
|
||||
->method('store')
|
||||
->will($this->returnValue(true));
|
||||
@@ -1065,9 +1064,7 @@ class ServiceTest extends \BBTestCase
|
||||
->method('decodeJ')
|
||||
->will($this->returnValue(array()));
|
||||
|
||||
$twigMock = $this->getMockBuilder('\Twig_Environment')->disableOriginalConstructor()->getMock();
|
||||
$twigMock->expects($this->atLeastOnce())
|
||||
->method('render');
|
||||
$twigMock = $this->getMockBuilder('Twig\Environment')->disableOriginalConstructor()->getMock();
|
||||
|
||||
$di = new \Box_Di();
|
||||
$di['db'] = $db;
|
||||
@@ -1078,6 +1075,13 @@ class ServiceTest extends \BBTestCase
|
||||
$di['array_get'] = $di->protect(function (array $array, $key, $default = null) use ($di) {
|
||||
return isset ($array[$key]) ? $array[$key] : $default;
|
||||
});
|
||||
|
||||
$systemService = $this->getMockBuilder('Box\Mod\System\Service')->getMock();
|
||||
|
||||
$di['mod_service'] = $di->protect(function () use ($systemService) {
|
||||
return $systemService;
|
||||
});
|
||||
|
||||
$service->setDi($di);
|
||||
|
||||
$result = $service->resetTemplateByCode('mod_email_test');
|
||||
@@ -1085,9 +1089,6 @@ class ServiceTest extends \BBTestCase
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testResetTemplateByCodeException()
|
||||
{
|
||||
$service = new \Box\Mod\Email\Service();
|
||||
@@ -1101,6 +1102,7 @@ class ServiceTest extends \BBTestCase
|
||||
$di['db'] = $db;
|
||||
$service->setDi($di);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$service->resetTemplateByCode('mod_email_test');
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ class AdminTest extends \BBTestCase {
|
||||
*/
|
||||
protected $api = null;
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->api= new \Box\Mod\Example\Api\Admin();
|
||||
}
|
||||
@@ -21,7 +21,7 @@ class AdminTest extends \BBTestCase {
|
||||
$data = array('microsoft' => '');
|
||||
$expected = array('apple', 'google', 'facebook', 'microsoft');
|
||||
$result = $this->api->get_something($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ class ClientTest extends \BBTestCase {
|
||||
*/
|
||||
protected $api = null;
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->api= new \Box\Mod\Example\Api\Client();
|
||||
}
|
||||
@@ -59,7 +59,7 @@ class ClientTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
|
||||
$result = $this->api->get_info($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertArrayHasKey('version', $result);
|
||||
$this->assertArrayHasKey('profile', $result);
|
||||
$this->assertArrayHasKey('messages', $result);
|
||||
|
||||
@@ -11,7 +11,7 @@ class GuestTest extends \BBTestCase {
|
||||
*/
|
||||
protected $api = null;
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->api= new \Box\Mod\Example\Api\Guest();
|
||||
}
|
||||
@@ -29,7 +29,7 @@ class GuestTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
|
||||
$result = $this->api->readme(array());
|
||||
$this->assertInternalType('string', $result);
|
||||
$this->assertIsString($result);
|
||||
}
|
||||
|
||||
public function testtop_songs()
|
||||
@@ -54,7 +54,7 @@ class GuestTest extends \BBTestCase {
|
||||
|
||||
$this->api->setDi($di);
|
||||
$result = $this->api->top_songs($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,8 +36,8 @@ class AdminTest extends \BBTestCase {
|
||||
$this->assertArrayHasKey('group', $result);
|
||||
$this->assertArrayHasKey('subpages', $result);
|
||||
|
||||
$this->assertInternalType('array', $result['group']);
|
||||
$this->assertInternalType('array', $result['subpages']);
|
||||
$this->assertIsArray($result['group']);
|
||||
$this->assertIsArray($result['subpages']);
|
||||
}
|
||||
|
||||
public function testregister()
|
||||
|
||||
@@ -9,7 +9,7 @@ class ServiceTest extends \BBTestCase {
|
||||
*/
|
||||
private $service = null;
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->service = new \Box\Mod\Example\Service();
|
||||
}
|
||||
@@ -22,7 +22,7 @@ class ServiceTest extends \BBTestCase {
|
||||
});
|
||||
$this->service->setDi($di);
|
||||
$result = $this->service->getSearchQuery(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testtoApiArray()
|
||||
|
||||
@@ -16,7 +16,7 @@ class AdminTest extends \BBTestCase {
|
||||
protected $api = null;
|
||||
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->service = new \Box\Mod\Extension\Service();
|
||||
$this->api = new \Box\Mod\Extension\Api\Admin();
|
||||
@@ -43,7 +43,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->get_list($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
/*
|
||||
* @todo enable when extensions are available
|
||||
@@ -62,7 +62,7 @@ class AdminTest extends \BBTestCase {
|
||||
|
||||
$this->api->setDi($di);
|
||||
$result = $this->api->get_latest($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testget_latestException()
|
||||
@@ -80,7 +80,7 @@ class AdminTest extends \BBTestCase {
|
||||
|
||||
$this->api->setDi($di);
|
||||
$result = $this->api->get_latest($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertEquals(array(), $result);
|
||||
}
|
||||
*/
|
||||
@@ -99,7 +99,7 @@ class AdminTest extends \BBTestCase {
|
||||
|
||||
$result = $this->api->get_navigation($data);
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testlanguages()
|
||||
@@ -115,7 +115,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
$result = $this->api->languages();
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testupdate_core()
|
||||
@@ -157,7 +157,8 @@ class AdminTest extends \BBTestCase {
|
||||
|
||||
$this->api->setDi($di);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'You have latest version of BoxBilling. You do not need to update', 930);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('You have latest version of BoxBilling. You do not need to update', 930);
|
||||
$result = $this->api->update_core(array());
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
@@ -187,7 +188,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setService($serviceMock);
|
||||
$result = $this->api->update($data);
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
|
||||
@@ -210,7 +211,8 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
|
||||
$this->api->setService($serviceMock);
|
||||
$this->setExpectedException('\Box_Exception', 'Extension not found');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Extension not found');
|
||||
$this->api->update($data);
|
||||
}
|
||||
|
||||
@@ -236,7 +238,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->activate($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testdeactivate()
|
||||
@@ -357,7 +359,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
|
||||
$result = $this->api->install($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
@@ -406,7 +408,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
|
||||
$result = $this->api->install($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
@@ -431,7 +433,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setService($serviceMock);
|
||||
$result = $this->api->config_get($data);
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testconfig_save()
|
||||
|
||||
@@ -16,7 +16,7 @@ class GuestTest extends \BBTestCase {
|
||||
protected $api = null;
|
||||
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->service = new \Box\Mod\Extension\Service();
|
||||
$this->api = new \Box\Mod\Extension\Api\Guest();
|
||||
@@ -82,7 +82,7 @@ class GuestTest extends \BBTestCase {
|
||||
|
||||
$this->api->setDi($di);
|
||||
$result = $this->api->theme();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testsettings()
|
||||
@@ -96,14 +96,15 @@ class GuestTest extends \BBTestCase {
|
||||
|
||||
$this->api->setService($serviceMock);
|
||||
$result = $this->api->settings($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testsettingsExtExtension()
|
||||
{
|
||||
$data = array();
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Parameter ext is missing');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Parameter ext is missing');
|
||||
$this->api->settings($data);
|
||||
|
||||
}
|
||||
@@ -120,7 +121,7 @@ class GuestTest extends \BBTestCase {
|
||||
|
||||
$this->api->setDi($di);
|
||||
$result = $this->api->languages();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ class ServiceTest extends \BBTestCase {
|
||||
*/
|
||||
protected $service = null;
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->service = new \Box\Mod\Extension\Service();
|
||||
}
|
||||
@@ -46,7 +46,7 @@ class ServiceTest extends \BBTestCase {
|
||||
$this->service->setDi($di);
|
||||
|
||||
$result = $this->service->isCoreModule('extension');
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ class ServiceTest extends \BBTestCase {
|
||||
$this->service->setDi($di);
|
||||
|
||||
$result = $this->service->isExtensionActive('mod', 'extension');
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ class ServiceTest extends \BBTestCase {
|
||||
$this->service->setDi($di);
|
||||
|
||||
$result = $this->service->isExtensionActive('mod', 'ModDoesNotExists');
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ class ServiceTest extends \BBTestCase {
|
||||
$this->service->setDi($di);
|
||||
|
||||
$result = $this->service->removeNotExistingModules();
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertTrue($result > 0);
|
||||
}
|
||||
|
||||
@@ -142,8 +142,8 @@ class ServiceTest extends \BBTestCase {
|
||||
$this->service->setDi($di);
|
||||
list($sql, $params) = $this->service->getSearchQuery($data);
|
||||
|
||||
$this->assertInternalType('string', $sql);
|
||||
$this->assertInternalType('array', $params);
|
||||
$this->assertIsString($sql);
|
||||
$this->assertIsArray($params);
|
||||
|
||||
$this->assertTrue(strpos($sql, $expectedStr) !== false, $sql);
|
||||
$this->assertTrue(array_diff_key($params, $expectedParams) == array());
|
||||
@@ -197,7 +197,7 @@ class ServiceTest extends \BBTestCase {
|
||||
$this->service->setDi($di);
|
||||
|
||||
$result = $this->service->getExtensionsList($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ class ServiceTest extends \BBTestCase {
|
||||
$this->service->setDi($di);
|
||||
|
||||
$result = $this->service->getExtensionsList($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
|
||||
}
|
||||
|
||||
@@ -291,7 +291,7 @@ class ServiceTest extends \BBTestCase {
|
||||
$this->service->setDi($di);
|
||||
$result = $this->service->getAdminNavigation(new \Model_Admin());
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
|
||||
@@ -332,7 +332,9 @@ class ServiceTest extends \BBTestCase {
|
||||
$di['extension'] = $extensionMock;
|
||||
|
||||
$this->service->setDi($di);
|
||||
$this->setExpectedException('\Box_Exception', 'Visit extension site for update information.', 252);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionCode(252);
|
||||
$this->expectExceptionMessage('Visit extension site for update information.');
|
||||
$this->service->update($model);
|
||||
}
|
||||
|
||||
@@ -358,7 +360,9 @@ class ServiceTest extends \BBTestCase {
|
||||
$di['extension'] = $extensionMock;
|
||||
|
||||
$this->service->setDi($di);
|
||||
$this->setExpectedException('\Box_Exception', sprintf('Could not retrieve %s information', $model->name), 744);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionCode(744);
|
||||
$this->expectExceptionMessage(sprintf('Could not retrieve %s information', $model->name));
|
||||
$this->service->update($model);
|
||||
}
|
||||
|
||||
@@ -380,7 +384,8 @@ class ServiceTest extends \BBTestCase {
|
||||
$di['extension'] = $extensionMock;
|
||||
|
||||
$this->service->setDi($di);
|
||||
$this->setExpectedException('\Box_Exception', sprintf('Latest %s version installed. No need to update', $model->name), 785);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage(sprintf('Latest %s version installed. No need to update', $model->name), 785);
|
||||
$this->service->update($model);
|
||||
}
|
||||
|
||||
@@ -400,7 +405,9 @@ class ServiceTest extends \BBTestCase {
|
||||
$di['extension'] = $extensionMock;
|
||||
|
||||
$this->service->setDi($di);
|
||||
$this->setExpectedException('\Box_Exception', 'Could not retrieve version information for extension '.$model->name, 745);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionCode(745);
|
||||
$this->expectExceptionMessage(sprintf('Could not retrieve version information for extension %s', $model->name));
|
||||
$this->service->update($model);
|
||||
|
||||
}
|
||||
@@ -452,7 +459,7 @@ class ServiceTest extends \BBTestCase {
|
||||
|
||||
$this->service->setDi($di);
|
||||
$result = $this->service->activate($ext);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
}
|
||||
|
||||
@@ -503,7 +510,8 @@ class ServiceTest extends \BBTestCase {
|
||||
|
||||
$this->service->setDi($di);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'BoxBilling core modules can not be managed');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('BoxBilling core modules can not be managed');
|
||||
$this->service->deactivate($ext);
|
||||
}
|
||||
|
||||
@@ -530,7 +538,8 @@ class ServiceTest extends \BBTestCase {
|
||||
|
||||
$this->service->setDi($di);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', $exceptionMessage);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage($exceptionMessage);
|
||||
$this->service->deactivate($ext);
|
||||
}
|
||||
|
||||
@@ -654,7 +663,8 @@ class ServiceTest extends \BBTestCase {
|
||||
$di['zip_archive'] = $zipArchiveMock;
|
||||
|
||||
$this->service->setDi($di);
|
||||
$this->setExpectedException('\Box_Exception', 'Extension does not support auto-install feature. Extension must be installed manually');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Extension does not support auto-install feature. Extension must be installed manually');
|
||||
$this->service->downloadAndExtract('notDefinedType', 'extensionId');
|
||||
}
|
||||
|
||||
@@ -700,7 +710,9 @@ class ServiceTest extends \BBTestCase {
|
||||
$di['tools'] = $toolsMock;
|
||||
|
||||
$this->service->setDi($di);
|
||||
$this->setExpectedException('\Box_Exception', 'Extension can not be moved. Make sure your server write permissions to bb-locale folder.', 440);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionCode(440);
|
||||
$this->expectExceptionMessage('Extension can not be moved. Make sure your server write permissions to bb-locale folder.');
|
||||
$this->service->downloadAndExtract('translation', 'extensionId');
|
||||
}
|
||||
|
||||
@@ -742,7 +754,9 @@ class ServiceTest extends \BBTestCase {
|
||||
$di['tools'] = $toolsMock;
|
||||
|
||||
$this->service->setDi($di);
|
||||
$this->setExpectedException('\Box_Exception', 'Extension can not be moved. Make sure your server write permissions to bb-themes folder.', 439);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage(439);
|
||||
$this->expectExceptionMessage('Extension can not be moved. Make sure your server write permissions to bb-themes folder.');
|
||||
$this->service->downloadAndExtract('theme', 'extensionId');
|
||||
}
|
||||
|
||||
@@ -784,7 +798,9 @@ class ServiceTest extends \BBTestCase {
|
||||
$di['tools'] = $toolsMock;
|
||||
|
||||
$this->service->setDi($di);
|
||||
$this->setExpectedException('\Box_Exception', 'Extension can not be moved. Make sure your server write permissions to bb-modules folder.', 437);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionCode(437);
|
||||
$this->expectExceptionMessage('Extension can not be moved. Make sure your server write permissions to bb-modules folder.');
|
||||
$this->service->downloadAndExtract('mod', 'extensionId');
|
||||
}
|
||||
|
||||
@@ -823,7 +839,9 @@ class ServiceTest extends \BBTestCase {
|
||||
$di['tools'] = $toolsMock;
|
||||
|
||||
$this->service->setDi($di);
|
||||
$this->setExpectedException('\Box_Exception', 'Module already installed.', 436);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionCode(436);
|
||||
$this->expectExceptionMessage('Module already installed.');
|
||||
$this->service->downloadAndExtract('mod', 'extensionId');
|
||||
}
|
||||
|
||||
@@ -850,7 +868,8 @@ class ServiceTest extends \BBTestCase {
|
||||
$di['zip_archive'] = $zipArchiveMock;
|
||||
|
||||
$this->service->setDi($di);
|
||||
$this->setExpectedException('\Box_Exception', 'Could not extract extension zip file');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Could not extract extension zip file');
|
||||
$this->service->downloadAndExtract('mod', 'extensionId');
|
||||
}
|
||||
|
||||
@@ -866,7 +885,7 @@ class ServiceTest extends \BBTestCase {
|
||||
$di['extension'] = $extensionMock;
|
||||
|
||||
$this->service->setDi($di);
|
||||
$this->setExpectedException('\Exception', 'Extensions download url is not valid');
|
||||
$this->expectException('\Exception', 'Extensions download url is not valid');
|
||||
$this->service->downloadAndExtract('mod', 'extensionId');
|
||||
}
|
||||
|
||||
@@ -934,7 +953,7 @@ class ServiceTest extends \BBTestCase {
|
||||
$serviceMock->setDi($di);
|
||||
|
||||
$result = $serviceMock->activateExistingExtension($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testactivateException()
|
||||
@@ -966,7 +985,7 @@ class ServiceTest extends \BBTestCase {
|
||||
|
||||
$serviceMock->setDi($di);
|
||||
|
||||
$this->setExpectedException('\Exception');
|
||||
$this->expectException(\Exception::class);
|
||||
$serviceMock->activateExistingExtension($data);
|
||||
}
|
||||
|
||||
@@ -1002,7 +1021,7 @@ class ServiceTest extends \BBTestCase {
|
||||
$this->service->setDi($di);
|
||||
|
||||
$result = $this->service->getConfig($data['ext']);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testgetConfigExtensionMetaNotFound()
|
||||
@@ -1031,8 +1050,8 @@ class ServiceTest extends \BBTestCase {
|
||||
$this->service->setDi($di);
|
||||
$result = $this->service->getConfig($data['ext']);
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertEquals(array(), $result, $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertEquals(array(), $result);
|
||||
}
|
||||
|
||||
public function testsetConfig()
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace Box\Tests\Mod\Filemanager\Api;
|
||||
|
||||
|
||||
class AdminTest extends \BBTestCase
|
||||
class Api_AdminTest extends \BBTestCase
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -11,7 +11,7 @@ class AdminTest extends \BBTestCase
|
||||
*/
|
||||
protected $adminApi = null;
|
||||
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->adminApi = new \Box\Mod\Filemanager\Api\Admin();
|
||||
}
|
||||
@@ -100,7 +100,7 @@ class AdminTest extends \BBTestCase
|
||||
|
||||
$result = $this->adminApi->get_list(array());
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ class AdminTest extends \BBTestCase {
|
||||
$result = $controller->fetchNavigation();
|
||||
|
||||
$this->assertArrayHasKey('subpages', $result);
|
||||
$this->assertInternalType('array', $result['subpages']);
|
||||
$this->assertIsArray($result['subpages']);
|
||||
}
|
||||
|
||||
public function testregister()
|
||||
@@ -104,7 +104,8 @@ class AdminTest extends \BBTestCase {
|
||||
$di['is_admin_logged'] = true;
|
||||
|
||||
$controller->setDi($di);
|
||||
$this->setExpectedException('\Box_Exception', 'File does not exist', 404);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('File does not exist', 404);
|
||||
$controller->get_editor($boxAppMock);
|
||||
}
|
||||
|
||||
@@ -126,7 +127,8 @@ class AdminTest extends \BBTestCase {
|
||||
$di['is_admin_logged'] = true;
|
||||
|
||||
$controller->setDi($di);
|
||||
$this->setExpectedException('\Box_Exception', 'File does not exist', 405);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('File does not exist', 405);
|
||||
$controller->get_editor($boxAppMock);
|
||||
}
|
||||
|
||||
@@ -156,7 +158,7 @@ class AdminTest extends \BBTestCase {
|
||||
|
||||
$controller->setDi($di);
|
||||
$result = $controller->get_editor($boxAppMock);
|
||||
$this->assertInternalType('string', $result);
|
||||
$this->assertIsString($result);
|
||||
}
|
||||
|
||||
public function testget_editor_TypeisImage()
|
||||
@@ -182,7 +184,7 @@ class AdminTest extends \BBTestCase {
|
||||
|
||||
$controller->setDi($di);
|
||||
$result = $controller->get_editor($boxAppMock);
|
||||
$this->assertInternalType('string', $result);
|
||||
$this->assertIsString($result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ class ServiceTest extends \BBTestCase
|
||||
*/
|
||||
protected $service = null;
|
||||
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->service = new \Box\Mod\Filemanager\Service();
|
||||
}
|
||||
@@ -78,9 +78,6 @@ class ServiceTest extends \BBTestCase
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testCreateDirectoryExistsException()
|
||||
{
|
||||
$type = 'dir';
|
||||
@@ -94,18 +91,16 @@ class ServiceTest extends \BBTestCase
|
||||
$di = new \Box_Di();
|
||||
$di['tools'] = $toolsMock;
|
||||
$this->service->setDi($di);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $this->service->create($path, $type);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testCreateDirectoryTypeNotExists()
|
||||
{
|
||||
$type = 'non-existing-type';
|
||||
$path = 'tests/test_dir';
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $this->service->create($path, $type);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
@@ -133,11 +128,11 @@ class ServiceTest extends \BBTestCase
|
||||
$result = $this->service->getFiles('../tests');
|
||||
$file = $result['files'][0];
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertArrayHasKey('files', $result);
|
||||
$this->assertArrayHasKey('filecount', $result);
|
||||
$this->assertInternalType('array', $result['files']);
|
||||
$this->assertInternalType('integer', $result['filecount']);
|
||||
$this->assertIsArray($result['files']);
|
||||
$this->assertIsInt($result['filecount']);
|
||||
$this->assertEquals($result['filecount'], count($result['files']));
|
||||
|
||||
$this->assertArrayHasKey('filename', $file);
|
||||
@@ -150,20 +145,20 @@ class ServiceTest extends \BBTestCase
|
||||
{
|
||||
$result = $this->service->getFiles('../tests/test_dir');
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertArrayHasKey('files', $result);
|
||||
$this->assertArrayHasKey('filecount', $result);
|
||||
$this->assertInternalType('integer', $result['filecount']);
|
||||
$this->assertIsInt($result['filecount']);
|
||||
|
||||
$this->assertNull($result['files']);
|
||||
$this->assertEquals(count($result['files']), 0);
|
||||
$this->assertEquals($result['filecount'], 0);
|
||||
|
||||
}
|
||||
public function testGetFilesNonExistingDir()
|
||||
{
|
||||
$result = $this->service->getFiles('non-existing-dir');
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertArrayHasKey('files', $result);
|
||||
$this->assertArrayHasKey('filecount', $result);
|
||||
$this->assertNull($result['files']);
|
||||
|
||||
@@ -21,7 +21,7 @@ class AdminTest extends \BBTestCase {
|
||||
return $this->getMockBuilder('\Box\Mod\Formbuilder\Service')->getMock();
|
||||
}
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->service = new \Box\Mod\Formbuilder\Service();
|
||||
$this->api = new \Box\Mod\Formbuilder\Api\Admin();
|
||||
@@ -56,7 +56,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
|
||||
$result = $this->api->create_form($data);
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($createdFormId, $result);
|
||||
}
|
||||
|
||||
@@ -72,7 +72,8 @@ class AdminTest extends \BBTestCase {
|
||||
->will($this->returnValue(null));
|
||||
$di['validator'] = $validatorMock;
|
||||
$this->api->setDi($di);
|
||||
$this->setExpectedException('\Box_Exception', 'Form style was not found in predefined list', 3657);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Form style was not found in predefined list', 3657);
|
||||
$this->api->create_form($data);
|
||||
}
|
||||
|
||||
@@ -101,14 +102,16 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->add_field($data);
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($newFieldId, $result);
|
||||
}
|
||||
|
||||
public function testadd_fieldMissingType()
|
||||
{
|
||||
$data = array();
|
||||
$this->setExpectedException('\Box_Exception', 'Form field type is not valid', 2684);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionCode(2684);
|
||||
$this->expectExceptionMessage('Form field type is not valid');
|
||||
$this->api->add_field($data);
|
||||
}
|
||||
|
||||
@@ -120,7 +123,9 @@ class AdminTest extends \BBTestCase {
|
||||
);
|
||||
|
||||
$this->api->setService($this->service);
|
||||
$this->setExpectedException('\Box_Exception', 'This input type must have unique values', 3658);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionCode(3658);
|
||||
$this->expectExceptionMessage('This input type must have unique values');
|
||||
$this->api->add_field($data);
|
||||
}
|
||||
|
||||
@@ -133,7 +138,9 @@ class AdminTest extends \BBTestCase {
|
||||
|
||||
$this->api->setService($this->service);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Form id was not passed', 9846);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionCode(9846);
|
||||
$this->expectExceptionMessage('Form id was not passed');
|
||||
$this->api->add_field($data);
|
||||
}
|
||||
|
||||
@@ -155,7 +162,7 @@ class AdminTest extends \BBTestCase {
|
||||
|
||||
$this->api->setService($serviceMock);
|
||||
$result = $this->api->get_form($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testget_form_fields()
|
||||
@@ -176,7 +183,7 @@ class AdminTest extends \BBTestCase {
|
||||
|
||||
$this->api->setService($serviceMock);
|
||||
$result = $this->api->get_form_fields($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testget_field()
|
||||
@@ -198,7 +205,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->get_field($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testget_forms()
|
||||
@@ -211,7 +218,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->get_forms();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testdelete_form()
|
||||
@@ -284,7 +291,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->update_field($data);
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($updatedFieldId, $result);
|
||||
}
|
||||
|
||||
@@ -299,7 +306,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->get_pairs($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testcopy_form()
|
||||
@@ -317,7 +324,7 @@ class AdminTest extends \BBTestCase {
|
||||
|
||||
$this->api->setService($serviceMock);
|
||||
$result = $this->api->copy_form($data);
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($newFormId, $result);
|
||||
}
|
||||
|
||||
@@ -325,7 +332,9 @@ class AdminTest extends \BBTestCase {
|
||||
{
|
||||
$data = array();
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Form id was not passed', 9958);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionCode(9958);
|
||||
$this->expectExceptionMessage('Form id was not passed');
|
||||
$this->api->copy_form($data);
|
||||
}
|
||||
|
||||
@@ -333,7 +342,9 @@ class AdminTest extends \BBTestCase {
|
||||
{
|
||||
$data = array('form_id' => 1);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Form name was not passed', 9842);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionCode(9842);
|
||||
$this->expectExceptionMessage('Form name was not passed');
|
||||
$this->api->copy_form($data);
|
||||
}
|
||||
|
||||
@@ -380,7 +391,8 @@ class AdminTest extends \BBTestCase {
|
||||
);
|
||||
unset($data[ $missingField ]);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', $exceptionMessage, $exceptionCode);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage($exceptionMessage, $exceptionCode);
|
||||
$this->api->update_form_settings($data);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Box\Mod\Formbuilder\Api;
|
||||
|
||||
class GuestTest extends \BBTestCase {
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->api = new \Box\Mod\Formbuilder\Api\Guest();
|
||||
}
|
||||
@@ -38,7 +38,7 @@ class GuestTest extends \BBTestCase {
|
||||
|
||||
$this->api->setService($serviceMock);
|
||||
$result = $this->api->get($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ class ServiceTest extends \BBTestCase {
|
||||
protected $service = null;
|
||||
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->service = new \Box\Mod\Formbuilder\Service();
|
||||
}
|
||||
@@ -103,7 +103,7 @@ class ServiceTest extends \BBTestCase {
|
||||
|
||||
$result = $this->service->addNewForm($data);
|
||||
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($newFormId, $result);
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ class ServiceTest extends \BBTestCase {
|
||||
|
||||
$result = $this->service->addNewField($data);
|
||||
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($newFieldId, $result);
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@ class ServiceTest extends \BBTestCase {
|
||||
$this->service->setDi($di);
|
||||
|
||||
$result = $this->service->updateField($data);
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($updateFIeldId, $result);
|
||||
}
|
||||
|
||||
@@ -222,6 +222,7 @@ class ServiceTest extends \BBTestCase {
|
||||
{
|
||||
$data = array(
|
||||
'id' => 2,
|
||||
'form_id' => 1,
|
||||
'name' => 'testFIeld',
|
||||
'type' => 'select',
|
||||
);
|
||||
@@ -237,7 +238,9 @@ class ServiceTest extends \BBTestCase {
|
||||
$serviceMock->expects($this->atLeastOnce())
|
||||
->method('getField');
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Unfortunately field with this name exists in this form already. Form must have different field names.', 7628);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionCode(7628);
|
||||
$this->expectExceptionMessage('Unfortunately field with this name exists in this form already. Form must have different field names.');
|
||||
$serviceMock->updateField($data);
|
||||
}
|
||||
|
||||
@@ -264,7 +267,9 @@ class ServiceTest extends \BBTestCase {
|
||||
$serviceMock->expects($this->atLeastOnce())
|
||||
->method('getField');
|
||||
|
||||
$this->setExpectedException('\Box_Exception', ucfirst($data['type']).' values must be unique', 1597);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionCode(1597);
|
||||
$this->expectExceptionMessage(ucfirst($data['type']).' values must be unique');
|
||||
$serviceMock->updateField($data);
|
||||
}
|
||||
|
||||
@@ -291,7 +296,9 @@ class ServiceTest extends \BBTestCase {
|
||||
$serviceMock->expects($this->atLeastOnce())
|
||||
->method('getField');
|
||||
|
||||
$this->setExpectedException('\Box_Exception', ucfirst($data['type']).' labels must be unique', 1598);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionCode(1598);
|
||||
$this->expectExceptionMessage(ucfirst($data['type']).' labels must be unique');
|
||||
$serviceMock->updateField($data);
|
||||
}
|
||||
|
||||
@@ -320,7 +327,9 @@ class ServiceTest extends \BBTestCase {
|
||||
$serviceMock->expects($this->atLeastOnce())
|
||||
->method('getField');
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Textarea size options must be integer values', 3510);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionCode(3510);
|
||||
$this->expectExceptionMessage('Textarea size options must be integer values');
|
||||
$serviceMock->updateField($data);
|
||||
}
|
||||
|
||||
@@ -360,7 +369,7 @@ class ServiceTest extends \BBTestCase {
|
||||
|
||||
$this->service->setDi($di);
|
||||
$result = $this->service->getForm($formId);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testgetFormFields()
|
||||
@@ -377,7 +386,7 @@ class ServiceTest extends \BBTestCase {
|
||||
|
||||
$this->service->setDi($di);
|
||||
$result = $this->service->getFormFields($formId);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testgetFormFieldsCount()
|
||||
@@ -393,7 +402,7 @@ class ServiceTest extends \BBTestCase {
|
||||
|
||||
$this->service->setDi($di);
|
||||
$result = $this->service->getFormFieldsCount($formId);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testgetFormPairs()
|
||||
@@ -409,7 +418,7 @@ class ServiceTest extends \BBTestCase {
|
||||
|
||||
$this->service->setDi($di);
|
||||
$result = $this->service->getFormPairs($formId);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testgetField()
|
||||
@@ -444,7 +453,7 @@ class ServiceTest extends \BBTestCase {
|
||||
|
||||
$this->service->setDi($di);
|
||||
$result = $this->service->getField($fieldId);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertEquals($expectedArray, $result);
|
||||
}
|
||||
|
||||
@@ -521,7 +530,7 @@ class ServiceTest extends \BBTestCase {
|
||||
|
||||
$this->service->setDi($di);
|
||||
$result = $this->service->getForms(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testdublicateForm()
|
||||
@@ -558,7 +567,7 @@ class ServiceTest extends \BBTestCase {
|
||||
|
||||
$serviceMock->setDi($di);
|
||||
$result = $serviceMock->dublicateForm($data);
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($newFormId, $result);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ class AdminTest extends \BBTestCase {
|
||||
*/
|
||||
protected $api = null;
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->api = new \Box\Mod\Hook\Api\Admin();
|
||||
}
|
||||
@@ -47,7 +47,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
$this->api->setService($serviceMock);
|
||||
$result = $this->api->get_list(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testcall()
|
||||
@@ -81,7 +81,7 @@ class AdminTest extends \BBTestCase {
|
||||
$data['event'] = null;
|
||||
|
||||
$result = $this->api->call($data);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ class ServiceTest extends \BBTestCase {
|
||||
*/
|
||||
protected $service = null;
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->service= new \Box\Mod\Hook\Service();
|
||||
}
|
||||
@@ -29,8 +29,8 @@ class ServiceTest extends \BBTestCase {
|
||||
{
|
||||
list ($sql, $params) = $this->service->getSearchQuery(array());
|
||||
|
||||
$this->assertInternalType('string', $sql);
|
||||
$this->assertInternalType('array', $params);
|
||||
$this->assertIsString($sql);
|
||||
$this->assertIsArray($params);
|
||||
|
||||
$this->assertTrue(strpos($sql, 'SELECT id, rel_type, rel_id, meta_value as event, created_at, updated_at') !== false);
|
||||
$this->assertEquals($params, array());
|
||||
|
||||
@@ -10,7 +10,7 @@ class AdminTest extends \BBTestCase {
|
||||
*/
|
||||
protected $api = null;
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->api = new \Box\Mod\Invoice\Api\Admin();
|
||||
}
|
||||
@@ -45,7 +45,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
$this->api->setService($serviceMock);
|
||||
$result = $this->api->get_list(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testget()
|
||||
@@ -76,7 +76,7 @@ class AdminTest extends \BBTestCase {
|
||||
|
||||
$data['id'] = 1;
|
||||
$result = $this->api->get($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testmark_as_paid()
|
||||
@@ -148,7 +148,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->prepare($data);
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($newInvoiceId, $result);
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->approve($data);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->refund($data);
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($newNegativeInvoiceId, $result);
|
||||
}
|
||||
|
||||
@@ -253,7 +253,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->update($data);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -288,7 +288,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
|
||||
$result = $this->api->item_delete($data);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -323,7 +323,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->delete($data);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -359,7 +359,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->renewal_invoice($data);
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($newInvoiceId, $result);
|
||||
}
|
||||
public function testrenewal_invoiceOrderIsFree()
|
||||
@@ -388,7 +388,8 @@ class AdminTest extends \BBTestCase {
|
||||
|
||||
$this->api->setDi($di);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', sprintf('Order %d is free. No need to generate invoice.', $model->id));
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage(sprintf('Order %d is free. No need to generate invoice.', $model->id));
|
||||
$this->api->renewal_invoice($data);
|
||||
}
|
||||
|
||||
@@ -402,7 +403,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->batch_pay_with_credits(array());
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -437,7 +438,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->pay_with_credits($data);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -451,7 +452,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->batch_generate(array());
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -465,7 +466,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->batch_activate_paid(array());
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -479,7 +480,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->batch_send_reminders(array());
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -493,7 +494,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->batch_invoke_due_event(array());
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -529,7 +530,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->send_reminder($data);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -543,7 +544,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->get_statuses(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testtransaction_process_all()
|
||||
@@ -558,7 +559,7 @@ class AdminTest extends \BBTestCase {
|
||||
|
||||
$this->api->setDi($di);
|
||||
$result = $this->api->transaction_process_all(array());
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -599,7 +600,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
|
||||
$result = $this->api->transaction_process($data);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -634,7 +635,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
|
||||
$result = $this->api->transaction_update($data);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -651,7 +652,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
|
||||
$result = $this->api->transaction_create(array());
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($newTransactionId, $result);
|
||||
}
|
||||
|
||||
@@ -686,7 +687,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
|
||||
$result = $this->api->transaction_delete($data);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -721,7 +722,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
|
||||
$result = $this->api->transaction_get($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testtransaction_get_list()
|
||||
@@ -745,7 +746,7 @@ class AdminTest extends \BBTestCase {
|
||||
|
||||
$this->api->setDi($di);
|
||||
$result = $this->api->transaction_get_list(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testtransaction_get_statuses()
|
||||
@@ -761,7 +762,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
|
||||
$result = $this->api->transaction_get_statuses(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testtransaction_get_statuses_pairs()
|
||||
@@ -777,7 +778,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
|
||||
$result = $this->api->transaction_get_statuses_pairs(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testtransaction_statuses()
|
||||
@@ -793,7 +794,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
|
||||
$result = $this->api->transaction_statuses(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testtransaction_gateway_statuses()
|
||||
@@ -809,7 +810,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
|
||||
$result = $this->api->transaction_gateway_statuses(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testtransaction_types()
|
||||
@@ -825,7 +826,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
|
||||
$result = $this->api->transaction_types(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testgateway_get_list()
|
||||
@@ -849,7 +850,7 @@ class AdminTest extends \BBTestCase {
|
||||
|
||||
$this->api->setDi($di);
|
||||
$result = $this->api->gateway_get_list(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testgateway_get_pairs()
|
||||
@@ -864,7 +865,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
|
||||
$result = $this->api->gateway_get_pairs(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testgateway_get_available()
|
||||
@@ -879,7 +880,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
|
||||
$result = $this->api->gateway_get_available(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testgateway_install()
|
||||
@@ -903,7 +904,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
|
||||
$result = $this->api->gateway_install($data);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -938,7 +939,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
|
||||
$result = $this->api->gateway_get($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testgateway_copy()
|
||||
@@ -972,7 +973,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
|
||||
$result = $this->api->gateway_copy($data);
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($newGatewayId, $result);
|
||||
}
|
||||
|
||||
@@ -1007,7 +1008,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
|
||||
$result = $this->api->gateway_update($data);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -1042,7 +1043,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
|
||||
$result = $this->api->gateway_delete($data);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -1064,7 +1065,7 @@ class AdminTest extends \BBTestCase {
|
||||
|
||||
$this->api->setDi($di);
|
||||
$result = $this->api->subscription_get_list(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testsubscription_create()
|
||||
@@ -1105,7 +1106,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
|
||||
$result = $this->api->subscription_create($data);
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($newSubscriptionId, $result);
|
||||
}
|
||||
|
||||
@@ -1139,7 +1140,8 @@ class AdminTest extends \BBTestCase {
|
||||
|
||||
$this->api->setDi($di);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Client currency must match subscription currency. Check if clients currency is defined.');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Client currency must match subscription currency. Check if clients currency is defined.');
|
||||
$this->api->subscription_create($data);
|
||||
}
|
||||
|
||||
@@ -1174,7 +1176,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
|
||||
$result = $this->api->subscription_update($data);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -1204,7 +1206,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
|
||||
$result = $this->api->subscription_get($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testsubscription_delete()
|
||||
@@ -1238,7 +1240,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
|
||||
$result = $this->api->subscription_delete($data);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -1273,7 +1275,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
|
||||
$result = $this->api->tax_delete($data);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -1300,7 +1302,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
|
||||
$result = $this->api->tax_create($data);
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($newTaxId, $result);
|
||||
}
|
||||
|
||||
@@ -1323,7 +1325,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
|
||||
$result = $this->api->tax_get_list(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
|
||||
@@ -1341,7 +1343,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
|
||||
$result = $this->api->tax_setup_eu(array());
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -1448,7 +1450,7 @@ class AdminTest extends \BBTestCase {
|
||||
|
||||
$data['id'] = 1;
|
||||
$result = $this->api->tax_get($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
|
||||
@@ -1481,7 +1483,7 @@ class AdminTest extends \BBTestCase {
|
||||
|
||||
$data['id'] = 1;
|
||||
$result = $this->api->tax_update($data);
|
||||
$this->assertInternalType('boolean', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ class ClientTest extends \BBTestCase {
|
||||
*/
|
||||
protected $api = null;
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->api = new \Box\Mod\Invoice\Api\Client();
|
||||
}
|
||||
@@ -51,7 +51,7 @@ class ClientTest extends \BBTestCase {
|
||||
|
||||
$data['hash'] = md5(1);
|
||||
$result = $this->api->get($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testgetInvoiceNotFound()
|
||||
@@ -75,7 +75,8 @@ class ClientTest extends \BBTestCase {
|
||||
$this->api->setIdentity(new \Model_Admin());
|
||||
|
||||
$data['hash'] = md5(1);
|
||||
$this->setExpectedException('\Box_Exception', 'Invoice was not found');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Invoice was not found');
|
||||
$this->api->get($data);
|
||||
}
|
||||
|
||||
@@ -109,7 +110,7 @@ class ClientTest extends \BBTestCase {
|
||||
|
||||
$data['hash'] = md5(1);
|
||||
$result = $this->api->update($data);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
|
||||
@@ -134,7 +135,8 @@ class ClientTest extends \BBTestCase {
|
||||
$this->api->setIdentity(new \Model_Admin());
|
||||
|
||||
$data['hash'] = md5(1);
|
||||
$this->setExpectedException('\Box_Exception', 'Invoice was not found');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Invoice was not found');
|
||||
$this->api->update($data);
|
||||
}
|
||||
|
||||
@@ -160,7 +162,8 @@ class ClientTest extends \BBTestCase {
|
||||
$this->api->setIdentity(new \Model_Admin());
|
||||
|
||||
$data['hash'] = md5(1);
|
||||
$this->setExpectedException('\Box_Exception', 'Paid Invoice can not be modified');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Paid Invoice can not be modified');
|
||||
$this->api->update($data);
|
||||
}
|
||||
|
||||
@@ -205,7 +208,7 @@ class ClientTest extends \BBTestCase {
|
||||
|
||||
$data['order_id'] = 1;
|
||||
$result = $this->api->renewal_invoice($data);
|
||||
$this->assertInternalType('string', $result);
|
||||
$this->assertIsString($result);
|
||||
$this->assertEquals($generatedHash, $result);
|
||||
}
|
||||
|
||||
@@ -237,7 +240,8 @@ class ClientTest extends \BBTestCase {
|
||||
|
||||
$data['order_id'] = 1;
|
||||
|
||||
$this->setExpectedException('\Box_Exception', sprintf('Order %d is free. No need to generate invoice.', $clientOrder->id));
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage(sprintf('Order %d is free. No need to generate invoice.', $clientOrder->id));
|
||||
$this->api->renewal_invoice($data);
|
||||
|
||||
}
|
||||
@@ -268,7 +272,8 @@ class ClientTest extends \BBTestCase {
|
||||
|
||||
$data['order_id'] = 1;
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Order not found');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Order not found');
|
||||
$this->api->renewal_invoice($data);
|
||||
}
|
||||
|
||||
@@ -303,7 +308,7 @@ class ClientTest extends \BBTestCase {
|
||||
|
||||
$data['amount'] = 10;
|
||||
$result = $this->api->funds_invoice($data);
|
||||
$this->assertInternalType('string', $result);
|
||||
$this->assertIsString($result);
|
||||
$this->assertEquals($generatedHash, $result);
|
||||
}
|
||||
|
||||
@@ -340,7 +345,7 @@ class ClientTest extends \BBTestCase {
|
||||
|
||||
$data['hash'] = md5(1);
|
||||
$result = $this->api->delete($data);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -369,7 +374,7 @@ class ClientTest extends \BBTestCase {
|
||||
$identity->loadBean(new \RedBeanPHP\OODBBean());
|
||||
$this->api->setIdentity($identity);
|
||||
$result = $this->api->transaction_get_list(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testget_tax_rate()
|
||||
|
||||
@@ -10,7 +10,7 @@ class GuestTest extends \BBTestCase {
|
||||
*/
|
||||
protected $api = null;
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->api = new \Box\Mod\Invoice\Api\Guest();
|
||||
}
|
||||
@@ -51,7 +51,7 @@ class GuestTest extends \BBTestCase {
|
||||
|
||||
$data['hash'] = md5(1);
|
||||
$result = $this->api->get($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testgetInvoiceNotFound()
|
||||
@@ -75,7 +75,8 @@ class GuestTest extends \BBTestCase {
|
||||
$this->api->setIdentity(new \Model_Admin());
|
||||
|
||||
$data['hash'] = md5(1);
|
||||
$this->setExpectedException('\Box_Exception', 'Invoice was not found');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Invoice was not found');
|
||||
$this->api->get($data);
|
||||
}
|
||||
|
||||
@@ -109,7 +110,7 @@ class GuestTest extends \BBTestCase {
|
||||
|
||||
$data['hash'] = md5(1);
|
||||
$result = $this->api->update($data);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
|
||||
@@ -134,7 +135,8 @@ class GuestTest extends \BBTestCase {
|
||||
$this->api->setIdentity(new \Model_Admin());
|
||||
|
||||
$data['hash'] = md5(1);
|
||||
$this->setExpectedException('\Box_Exception', 'Invoice was not found');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Invoice was not found');
|
||||
$this->api->update($data);
|
||||
}
|
||||
|
||||
@@ -160,7 +162,8 @@ class GuestTest extends \BBTestCase {
|
||||
$this->api->setIdentity(new \Model_Admin());
|
||||
|
||||
$data['hash'] = md5(1);
|
||||
$this->setExpectedException('\Box_Exception', 'Paid Invoice can not be modified');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Paid Invoice can not be modified');
|
||||
$this->api->update($data);
|
||||
}
|
||||
|
||||
@@ -177,7 +180,7 @@ class GuestTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
|
||||
$result = $this->api->gateways(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testpayment()
|
||||
@@ -194,7 +197,7 @@ class GuestTest extends \BBTestCase {
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->payment($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testpaymentMissingHashParam()
|
||||
@@ -203,7 +206,9 @@ class GuestTest extends \BBTestCase {
|
||||
'gateway_id' => '',
|
||||
);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Invoice hash not passed. Missing param hash', 810);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionCode(810);
|
||||
$this->expectExceptionMessage('Invoice hash not passed. Missing param hash');
|
||||
$this->api->payment($data);
|
||||
}
|
||||
|
||||
@@ -213,7 +218,9 @@ class GuestTest extends \BBTestCase {
|
||||
'hash' => '',
|
||||
);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Payment method not found. Missing param gateway_id', 811);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionCode(811);
|
||||
$this->expectExceptionMessage('Payment method not found. Missing param gateway_id');
|
||||
$this->api->payment($data);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ class ServiceInvoiceItemTest extends \BBTestCase
|
||||
*/
|
||||
protected $service = null;
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->service = new \Box\Mod\Invoice\ServiceInvoiceItem();
|
||||
}
|
||||
@@ -95,7 +95,8 @@ class ServiceInvoiceItemTest extends \BBTestCase
|
||||
$di['db'] = $dbMock;
|
||||
$serviceMock->setDi($di);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', sprintf('Could not activate proforma item. Order %d not found', $orderId));
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage(sprintf('Could not activate proforma item. Order %d not found', $orderId));
|
||||
$serviceMock->executeTask($invoiceItemModel);
|
||||
}
|
||||
|
||||
@@ -214,7 +215,7 @@ class ServiceInvoiceItemTest extends \BBTestCase
|
||||
$invoiceModel = new \Model_Invoice();
|
||||
$invoiceModel->loadBean(new \RedBeanPHP\OODBBean());
|
||||
$result = $this->service->addNew($invoiceModel, $data);
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($newId, $result);
|
||||
}
|
||||
|
||||
@@ -230,7 +231,7 @@ class ServiceInvoiceItemTest extends \BBTestCase
|
||||
$expected = $price * $quantity;
|
||||
|
||||
$result = $this->service->getTotal($invoiceItemModel);
|
||||
$this->assertInternalType('float', $result);
|
||||
$this->assertIsFloat($result);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
@@ -255,7 +256,7 @@ class ServiceInvoiceItemTest extends \BBTestCase
|
||||
|
||||
$result = $this->service->getTax($invoiceItemModel);
|
||||
$expected = round(($price * $rate / 100), 2);
|
||||
$this->assertInternalType('float', $result);
|
||||
$this->assertIsFloat($result);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
@@ -391,7 +392,7 @@ class ServiceInvoiceItemTest extends \BBTestCase
|
||||
->will($this->returnValue($tax));
|
||||
|
||||
$result = $serviceMock->getTotalWithTax($invoiceItemModel);
|
||||
$this->assertInternalType('float', $result);
|
||||
$this->assertIsFloat($result);
|
||||
$expected = $total + $tax * $quantity;
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
@@ -405,7 +406,7 @@ class ServiceInvoiceItemTest extends \BBTestCase
|
||||
$invoiceItemModel->type = \Model_InvoiceItem::TYPE_ORDER;
|
||||
|
||||
$result = $this->service->getOrderId($invoiceItemModel);
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($orderId, $result);
|
||||
}
|
||||
|
||||
@@ -415,7 +416,7 @@ class ServiceInvoiceItemTest extends \BBTestCase
|
||||
$invoiceItemModel->loadBean(new \RedBeanPHP\OODBBean());
|
||||
|
||||
$result = $this->service->getOrderId($invoiceItemModel);
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$expected = 0;
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
@@ -433,7 +434,7 @@ class ServiceInvoiceItemTest extends \BBTestCase
|
||||
$this->service->setDi($di);
|
||||
|
||||
$result = $this->service->getAllNotExecutePaidItems();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ class ServicePayGatewayTest extends \BBTestCase {
|
||||
*/
|
||||
protected $service = null;
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->service = new \Box\Mod\Invoice\ServicePayGateway();
|
||||
}
|
||||
@@ -33,9 +33,9 @@ class ServicePayGatewayTest extends \BBTestCase {
|
||||
$this->service->setDi($di);
|
||||
$data = array();
|
||||
$result = $this->service->getSearchQuery($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertInternalType('string', $result[0]);
|
||||
$this->assertInternalType('array', $result[1]);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertIsString($result[0]);
|
||||
$this->assertIsArray($result[1]);
|
||||
$this->assertEquals(array(), $result[1]);
|
||||
}
|
||||
|
||||
@@ -50,10 +50,10 @@ class ServicePayGatewayTest extends \BBTestCase {
|
||||
$expectedParams = array('search' => "%$data[search]%");
|
||||
|
||||
$result = $this->service->getSearchQuery($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertInternalType('string', $result[0]);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertIsString($result[0]);
|
||||
$this->assertTrue(strpos($result[0], 'AND m.name LIKE :search') > 0);
|
||||
$this->assertInternalType('array', $result[1]);
|
||||
$this->assertIsArray($result[1]);
|
||||
$this->assertEquals($expectedParams, $result[1]);
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ class ServicePayGatewayTest extends \BBTestCase {
|
||||
$this->service->setDi($di);
|
||||
|
||||
$result = $this->service->getPairs();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ class ServicePayGatewayTest extends \BBTestCase {
|
||||
$this->service->setDi($di);
|
||||
|
||||
$result = $this->service->getAvailable();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testinstallPayGateway()
|
||||
@@ -127,7 +127,7 @@ class ServicePayGatewayTest extends \BBTestCase {
|
||||
$serviceMock->setDi($di);
|
||||
|
||||
$result = $serviceMock->install($code);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -142,7 +142,8 @@ class ServicePayGatewayTest extends \BBTestCase {
|
||||
->method('getAvailable')
|
||||
->will($this->returnValue(array()));
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Payment gateway is not available for installation.');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Payment gateway is not available for installation.');
|
||||
$serviceMock->install($code);
|
||||
}
|
||||
|
||||
@@ -192,7 +193,7 @@ class ServicePayGatewayTest extends \BBTestCase {
|
||||
$serviceMock->setDi($di);
|
||||
|
||||
$result = $serviceMock->toApiArray($payGatewayModel, false, new \Model_Admin());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
@@ -217,7 +218,7 @@ class ServicePayGatewayTest extends \BBTestCase {
|
||||
$this->service->setDi($di);
|
||||
|
||||
$result = $this->service->copy($payGatewayModel);
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
@@ -289,7 +290,7 @@ class ServicePayGatewayTest extends \BBTestCase {
|
||||
|
||||
$data = array('format' => 'pairs');
|
||||
$result = $this->service->getActive($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testcanPerformRecurrentPayment()
|
||||
@@ -301,7 +302,7 @@ class ServicePayGatewayTest extends \BBTestCase {
|
||||
$payGatewayModel->allow_recurrent = $expected;
|
||||
|
||||
$result = $this->service->canPerformRecurrentPayment($payGatewayModel);
|
||||
$this->assertInternalType('bool',$result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
@@ -371,7 +372,8 @@ class ServicePayGatewayTest extends \BBTestCase {
|
||||
$di['url'] = $urlMock;
|
||||
$serviceMock->setDi($di);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Payment gateway was not found');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Payment gateway was not found');
|
||||
$serviceMock->getPaymentAdapter($payGatewayModel, $invoiceModel);
|
||||
}
|
||||
|
||||
@@ -390,7 +392,7 @@ class ServicePayGatewayTest extends \BBTestCase {
|
||||
->will($this->returnValue($expected));
|
||||
|
||||
$result = $serviceMock->getAdapterConfig($payGatewayModel);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testgetAdapterConfigClassDoesNotExists()
|
||||
@@ -407,7 +409,8 @@ class ServicePayGatewayTest extends \BBTestCase {
|
||||
->method('getAdapterClassName')
|
||||
->will($this->returnValue($expected));
|
||||
|
||||
$this->setExpectedException('\Box_Exception', sprintf("Payment gateway class %s was not found", $expected));
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage(sprintf("Payment gateway class %s was not found", $expected));
|
||||
$serviceMock->getAdapterConfig($payGatewayModel);
|
||||
}
|
||||
|
||||
@@ -423,7 +426,8 @@ class ServicePayGatewayTest extends \BBTestCase {
|
||||
$serviceMock->expects($this->atLeastOnce())
|
||||
->method('getAdapterClassName');
|
||||
|
||||
$this->setExpectedException('\Box_Exception', sprintf("Payment gateway %s was not found", $payGatewayModel->gateway));
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage(sprintf("Payment gateway %s was not found", $payGatewayModel->gateway));
|
||||
$serviceMock->getAdapterConfig($payGatewayModel);
|
||||
}
|
||||
|
||||
@@ -436,7 +440,7 @@ class ServicePayGatewayTest extends \BBTestCase {
|
||||
$expected = 'Payment_Adapter_Custom';
|
||||
|
||||
$result = $this->service->getAdapterClassName($payGatewayModel);
|
||||
$this->assertInternalType('string', $result);
|
||||
$this->assertIsString($result);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
@@ -447,7 +451,7 @@ class ServicePayGatewayTest extends \BBTestCase {
|
||||
$payGatewayModel->accepted_currencies = '{}';
|
||||
|
||||
$result = $this->service->getAcceptedCurrencies($payGatewayModel);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testgetFormElements()
|
||||
@@ -464,7 +468,7 @@ class ServicePayGatewayTest extends \BBTestCase {
|
||||
->will($this->returnValue($config));
|
||||
|
||||
$result = $serviceMock->getFormElements($payGatewayModel);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testgetFormElementsEmptyFormConfig()
|
||||
@@ -481,7 +485,7 @@ class ServicePayGatewayTest extends \BBTestCase {
|
||||
->will($this->returnValue($config));
|
||||
|
||||
$result = $serviceMock->getFormElements($payGatewayModel);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$emptyArray = array();
|
||||
$this->assertEquals($emptyArray, $result);
|
||||
}
|
||||
@@ -500,7 +504,7 @@ class ServicePayGatewayTest extends \BBTestCase {
|
||||
->will($this->returnValue($config));
|
||||
|
||||
$result = $serviceMock->getDescription($payGatewayModel);
|
||||
$this->assertInternalType('string', $result);
|
||||
$this->assertIsString($result);
|
||||
}
|
||||
|
||||
public function testgetDescriptionEmptyDescription()
|
||||
@@ -517,7 +521,7 @@ class ServicePayGatewayTest extends \BBTestCase {
|
||||
->will($this->returnValue($config));
|
||||
|
||||
$result = $serviceMock->getDescription($payGatewayModel);
|
||||
$this->assertInternalType('null', $result);
|
||||
$this->assertNull($result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ class ServiceSubscriptionTest extends \BBTestCase
|
||||
*/
|
||||
protected $service = null;
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->service = new \Box\Mod\Invoice\ServiceSubscription();
|
||||
}
|
||||
@@ -59,7 +59,7 @@ class ServiceSubscriptionTest extends \BBTestCase
|
||||
);
|
||||
|
||||
$result = $this->service->create(new \Model_Client(), new \Model_PayGateway(), $data);
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($newId, $result);
|
||||
}
|
||||
|
||||
@@ -146,9 +146,9 @@ class ServiceSubscriptionTest extends \BBTestCase
|
||||
);
|
||||
|
||||
$result = $this->service->toApiArray($subscriptionModel);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertInternalType('array', $result['client']);
|
||||
$this->assertInternalType('array', $result['gateway']);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertIsArray($result['client']);
|
||||
$this->assertIsArray($result['gateway']);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
@@ -225,9 +225,9 @@ class ServiceSubscriptionTest extends \BBTestCase
|
||||
$this->service->setDi($di);
|
||||
$result = $this->service->getSearchQuery($data);
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertInternalType('string', $result[0]);
|
||||
$this->assertInternalType('array', $result[1]);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertIsString($result[0]);
|
||||
$this->assertIsArray($result[1]);
|
||||
|
||||
$this->assertEquals($expectedParams, $result[1]);
|
||||
$this->assertTrue(strpos($result[0], $expectedSqlPart) !== false);
|
||||
@@ -247,7 +247,7 @@ class ServiceSubscriptionTest extends \BBTestCase
|
||||
|
||||
$invoice_id = 2;
|
||||
$result = $this->service->isSubscribable($invoice_id);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
@@ -272,7 +272,7 @@ class ServiceSubscriptionTest extends \BBTestCase
|
||||
|
||||
$invoice_id = 2;
|
||||
$result = $this->service->isSubscribable($invoice_id);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -300,7 +300,7 @@ class ServiceSubscriptionTest extends \BBTestCase
|
||||
$invoiceModel->loadBean(new \RedBeanPHP\OODBBean());
|
||||
|
||||
$result = $serviceMock->getSubscriptionPeriod($invoiceModel);
|
||||
$this->assertInternalType('string', $result);
|
||||
$this->assertIsString($result);
|
||||
$this->assertEquals($period, $result);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ class ServiceTaxTest extends \BBTestCase
|
||||
*/
|
||||
protected $service = null;
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->service = new \Box\Mod\Invoice\ServiceTax();
|
||||
}
|
||||
@@ -54,7 +54,7 @@ class ServiceTaxTest extends \BBTestCase
|
||||
$this->service->setDi($di);
|
||||
|
||||
$result = $this->service->getTaxRateForClient($clientModel);
|
||||
$this->assertInternalType('float', $result);
|
||||
$this->assertIsFloat($result);
|
||||
$this->assertEquals($taxRateExpected, $result);
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ class ServiceTaxTest extends \BBTestCase
|
||||
$this->service->setDi($di);
|
||||
|
||||
$result = $this->service->getTaxRateForClient($clientModel);
|
||||
$this->assertInternalType('float', $result);
|
||||
$this->assertIsFloat($result);
|
||||
$this->assertEquals($taxRateExpected, $result);
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ class ServiceTaxTest extends \BBTestCase
|
||||
$this->service->setDi($di);
|
||||
|
||||
$result = $this->service->getTaxRateForClient($clientModel);
|
||||
$this->assertInternalType('float', $result);
|
||||
$this->assertIsFloat($result);
|
||||
$this->assertEquals($taxRateExpected, $result);
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ class ServiceTaxTest extends \BBTestCase
|
||||
|
||||
$taxRateExpected = 0;
|
||||
$result = $this->service->getTaxRateForClient($clientModel);
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($taxRateExpected, $result);
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ class ServiceTaxTest extends \BBTestCase
|
||||
|
||||
$taxRateExpected = 0;
|
||||
$result = $this->service->getTaxRateForClient($clientModel);
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($taxRateExpected, $result);
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ class ServiceTaxTest extends \BBTestCase
|
||||
$invoiceModel->taxrate = 0;
|
||||
|
||||
$result = $this->service->getTax($invoiceModel);
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals(0, $result);
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ class ServiceTaxTest extends \BBTestCase
|
||||
|
||||
$this->service->setDi($di);
|
||||
$result = $this->service->getTax($invoiceModel);
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
}
|
||||
|
||||
public function testdelete()
|
||||
@@ -273,7 +273,7 @@ class ServiceTaxTest extends \BBTestCase
|
||||
'taxrate' => '0.18',
|
||||
);
|
||||
$result = $this->service->create($data);
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($newId, $result);
|
||||
}
|
||||
|
||||
@@ -298,7 +298,7 @@ class ServiceTaxTest extends \BBTestCase
|
||||
'taxrate' => '0.18',
|
||||
);
|
||||
$result = $this->service->update($taxModel, $data);
|
||||
$this->assertInternalType('boolean', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -306,8 +306,8 @@ class ServiceTaxTest extends \BBTestCase
|
||||
public function testgetSearchQuery()
|
||||
{
|
||||
$result = $this->service->getSearchQuery(array());
|
||||
$this->assertInternalType('string', $result[0]);
|
||||
$this->assertInternalType('array', $result[1]);
|
||||
$this->assertIsString($result[0]);
|
||||
$this->assertIsArray($result[1]);
|
||||
$this->assertEquals(array(), $result[1]);
|
||||
}
|
||||
|
||||
@@ -370,7 +370,7 @@ class ServiceTaxTest extends \BBTestCase
|
||||
$this->service->setDi($di);
|
||||
|
||||
$result = $this->service->toApiArray($taxModel);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ class ServiceTest extends \BBTestCase
|
||||
*/
|
||||
protected $service = null;
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->service = new \Box\Mod\Invoice\Service();
|
||||
}
|
||||
@@ -147,8 +147,8 @@ class ServiceTest extends \BBTestCase
|
||||
});
|
||||
$this->service->setDi($di);
|
||||
$result = $this->service->getSearchQuery($data);
|
||||
$this->assertInternalType('string', $result[0]);
|
||||
$this->assertInternalType('array', $result[1]);
|
||||
$this->assertIsString($result[0]);
|
||||
$this->assertIsArray($result[1]);
|
||||
|
||||
$this->assertTrue(strpos($result[0], $expectedStr) !== false, $result[0]);
|
||||
$this->assertTrue(array_diff_key($result[1], $expectedParams) == array());
|
||||
@@ -249,7 +249,7 @@ class ServiceTest extends \BBTestCase
|
||||
$this->service->setDi($di);
|
||||
|
||||
$result = $this->service->toApiArray($invoiceModel);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testonAfterAdminInvoicePaymentReceived()
|
||||
@@ -301,7 +301,7 @@ class ServiceTest extends \BBTestCase
|
||||
->will($this->returnValue($di));
|
||||
|
||||
$result = $this->service->onAfterAdminInvoicePaymentReceived($eventMock);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -356,7 +356,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
|
||||
$result = $this->service->onAfterAdminInvoicePaymentReceived($eventMock);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -504,7 +504,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$serviceMock->setDi($di);
|
||||
$result = $serviceMock->markAsPaid($invoiceModel, true, true);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -537,7 +537,7 @@ class ServiceTest extends \BBTestCase
|
||||
$this->service->setDi($di);
|
||||
|
||||
$result = $this->service->getNextInvoiceNumber($invoiceModel);
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
@@ -767,7 +767,7 @@ class ServiceTest extends \BBTestCase
|
||||
$invoiceModel->loadBean(new \RedBeanPHP\OODBBean());
|
||||
|
||||
$result = $serviceMock->getTotalWithTax($invoiceModel);
|
||||
$this->assertInternalType('float', $result);
|
||||
$this->assertIsFloat($result);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
@@ -797,7 +797,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$this->service->setDi($di);
|
||||
$result = $this->service->getTotal($invoiceModel);
|
||||
$this->assertInternalType('float', $result);
|
||||
$this->assertIsFloat($result);
|
||||
$this->assertEquals($itemTotal, $result);
|
||||
}
|
||||
|
||||
@@ -858,7 +858,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$serviceMock->setDi($di);
|
||||
$result = $serviceMock->refundInvoice($invoiceModel, 'custonNote');
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($newId, $result);
|
||||
}
|
||||
|
||||
@@ -1046,7 +1046,8 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$this->service->setDi($di);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', sprintf("Invoice is related to order #%d. Please cancel order first.", $rel_id));
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage(sprintf("Invoice is related to order #%d. Please cancel order first.", $rel_id));
|
||||
$this->service->deleteInvoiceByClient($invoiceModel);
|
||||
}
|
||||
|
||||
@@ -1079,7 +1080,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$serviceMock->setDi($di);
|
||||
$result = $serviceMock->renewInvoice($clientOrder, array());
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($newId, $result);
|
||||
}
|
||||
|
||||
@@ -1108,7 +1109,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$serviceMock->setDi($di);
|
||||
$result = $serviceMock->doBatchPayWithCredits(array());
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -1128,7 +1129,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$serviceMock->setDi($di);
|
||||
$result = $serviceMock->payInvoiceWithCredits($invoiceModel);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -1205,7 +1206,8 @@ class ServiceTest extends \BBTestCase
|
||||
$clientOrder->loadBean(new \RedBeanPHP\OODBBean());
|
||||
$clientOrder->price = 0;
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Invoices are not generated for 0 amount orders');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Invoices are not generated for 0 amount orders');
|
||||
$this->service->generateForOrder($clientOrder);
|
||||
}
|
||||
|
||||
@@ -1221,7 +1223,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$this->service->setDi($di);
|
||||
$result = $this->service->generateInvoicesForExpiringOrders();
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -1262,7 +1264,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$serviceMock->setDi($di);
|
||||
$result = $serviceMock->generateInvoicesForExpiringOrders();
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -1291,7 +1293,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$this->service->setDi($di);
|
||||
$result = $this->service->doBatchPaidInvoiceActivation();
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -1321,7 +1323,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$this->service->setDi($di);
|
||||
$result = $this->service->doBatchPaidInvoiceActivation();
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -1349,7 +1351,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$serviceMock->setDi($di);
|
||||
$result = $serviceMock->doBatchRemindersSend();
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -1380,7 +1382,7 @@ class ServiceTest extends \BBTestCase
|
||||
$this->service->setDi($di);
|
||||
|
||||
$result = $this->service->doBatchInvokeDueEvent(array());
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -1391,7 +1393,7 @@ class ServiceTest extends \BBTestCase
|
||||
$invoiceModel->status = \Model_Invoice::STATUS_PAID;
|
||||
|
||||
$result = $this->service->sendInvoiceReminder($invoiceModel);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -1416,7 +1418,7 @@ class ServiceTest extends \BBTestCase
|
||||
$this->service->setDi($di);
|
||||
|
||||
$result = $this->service->sendInvoiceReminder($invoiceModel);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -1436,7 +1438,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$this->service->setDi($di);
|
||||
$result = $this->service->counter();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testgenerateFundsInvoiceNoActiveOrder()
|
||||
@@ -1444,7 +1446,8 @@ class ServiceTest extends \BBTestCase
|
||||
$clientModel = new \Model_Client();
|
||||
$clientModel->loadBean(new \RedBeanPHP\OODBBean());
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'You must have at least one active order before you can add funds so you cannot proceed at the current time!');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('You must have at least one active order before you can add funds so you cannot proceed at the current time!');
|
||||
$this->service->generateFundsInvoice($clientModel, 10);
|
||||
}
|
||||
|
||||
@@ -1467,7 +1470,9 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$this->service->setDi($di);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Amount is not valid', 981);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionCode(981);
|
||||
$this->expectExceptionMessage('Amount is not valid');
|
||||
$this->service->generateFundsInvoice($clientModel, $fundsAmount);
|
||||
}
|
||||
|
||||
@@ -1490,7 +1495,9 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$this->service->setDi($di);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Amount is not valid', 982);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionCode(982);
|
||||
$this->expectExceptionMessage('Amount is not valid');
|
||||
$this->service->generateFundsInvoice($clientModel, $fundsAmount);
|
||||
}
|
||||
|
||||
@@ -1563,7 +1570,9 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$this->service->setDi($di);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Invoice not found', 812);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionCode(812);
|
||||
$this->expectExceptionMessage('Invoice not found');
|
||||
$this->service->processInvoice($data);
|
||||
}
|
||||
|
||||
@@ -1590,7 +1599,9 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$this->service->setDi($di);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Payment method not found', 813);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionCode(813);
|
||||
$this->expectExceptionMessage('Payment method not found');
|
||||
$this->service->processInvoice($data);
|
||||
}
|
||||
|
||||
@@ -1620,7 +1631,9 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$this->service->setDi($di);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Payment method not enabled', 814);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionCode(814);
|
||||
$this->expectExceptionMessage('Payment method not enabled');
|
||||
$this->service->processInvoice($data);
|
||||
}
|
||||
|
||||
@@ -1694,7 +1707,7 @@ class ServiceTest extends \BBTestCase
|
||||
$serviceMock->setDi($di);
|
||||
$result = $serviceMock->processInvoice($data);
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertArrayHasKey('type', $result);
|
||||
$this->assertArrayHasKey('service_url', $result);
|
||||
$this->assertArrayHasKey('subscription', $result);
|
||||
@@ -1743,7 +1756,7 @@ class ServiceTest extends \BBTestCase
|
||||
$this->service->setDi($di);
|
||||
|
||||
$result = $this->service->findAllUnpaid();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testfindAllPaid()
|
||||
@@ -1761,7 +1774,7 @@ class ServiceTest extends \BBTestCase
|
||||
$this->service->setDi($di);
|
||||
|
||||
$result = $this->service->findAllPaid();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertInstanceOf('\Model_Invoice', $result[0]);
|
||||
}
|
||||
|
||||
@@ -1781,7 +1794,7 @@ class ServiceTest extends \BBTestCase
|
||||
$this->service->setDi($di);
|
||||
|
||||
$result = $this->service->getUnpaidInvoicesLateFor();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertInstanceOf('\Model_Invoice', $result[0]);
|
||||
}
|
||||
|
||||
@@ -1805,7 +1818,7 @@ class ServiceTest extends \BBTestCase
|
||||
);
|
||||
|
||||
$result = $this->service->getBuyer($invoiceModel);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
@@ -1882,4 +1895,4 @@ class ServiceTest extends \BBTestCase
|
||||
$result = $this->service->isInvoiceTypeDeposit($modelInvoice);
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ class ServiceTransactionTest extends \BBTestCase
|
||||
*/
|
||||
protected $service = null;
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->service = new \Box\Mod\Invoice\ServiceTransaction();
|
||||
}
|
||||
@@ -140,7 +140,7 @@ class ServiceTransactionTest extends \BBTestCase
|
||||
'bb_invoice_id' => 2,
|
||||
);
|
||||
$result = $this->service->create($data);
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($newId, $result);
|
||||
}
|
||||
|
||||
@@ -160,7 +160,8 @@ class ServiceTransactionTest extends \BBTestCase
|
||||
'bb_gateway_id' => 1,
|
||||
);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Transaction invoice id is missing');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Transaction invoice id is missing');
|
||||
$this->service->create($data);
|
||||
}
|
||||
|
||||
@@ -180,7 +181,8 @@ class ServiceTransactionTest extends \BBTestCase
|
||||
'bb_invoice_id' => 2,
|
||||
);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Payment gateway id is missing');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Payment gateway id is missing');
|
||||
$this->service->create($data);
|
||||
}
|
||||
|
||||
@@ -241,7 +243,7 @@ class ServiceTransactionTest extends \BBTestCase
|
||||
$transactionModel->gateway_id = 1;
|
||||
|
||||
$result = $this->service->toApiArray($transactionModel, true);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
@@ -298,8 +300,8 @@ class ServiceTransactionTest extends \BBTestCase
|
||||
});
|
||||
$this->service->setDi($di);
|
||||
$result = $this->service->getSearchQuery($data);
|
||||
$this->assertInternalType('string', $result[0]);
|
||||
$this->assertInternalType('array', $result[1]);
|
||||
$this->assertIsString($result[0]);
|
||||
$this->assertIsArray($result[1]);
|
||||
|
||||
$this->assertTrue(strpos($result[0], $expectedStringPart) !== false);
|
||||
$this->assertEquals($expectedParams, $result[1]);
|
||||
@@ -318,7 +320,7 @@ class ServiceTransactionTest extends \BBTestCase
|
||||
$this->service->setDi($di);
|
||||
|
||||
$result = $this->service->counter();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$expected = array(
|
||||
'total' => 1,
|
||||
'received' => 1,
|
||||
@@ -332,7 +334,7 @@ class ServiceTransactionTest extends \BBTestCase
|
||||
public function testgetStatusPairs()
|
||||
{
|
||||
$result = $this->service->getStatusPairs();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
|
||||
$expected = array(
|
||||
'received' => 'Received',
|
||||
@@ -346,7 +348,7 @@ class ServiceTransactionTest extends \BBTestCase
|
||||
public function testgetStatus()
|
||||
{
|
||||
$result = $this->service->getStatuses();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
|
||||
$expected = array(
|
||||
'received' => 'Received',
|
||||
@@ -360,7 +362,7 @@ class ServiceTransactionTest extends \BBTestCase
|
||||
public function testgetGatewayStatuses()
|
||||
{
|
||||
$result = $this->service->getGatewayStatuses();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
|
||||
$expected = array(
|
||||
'pending' => 'Pending validation',
|
||||
@@ -373,7 +375,7 @@ class ServiceTransactionTest extends \BBTestCase
|
||||
public function testgetTypes()
|
||||
{
|
||||
$result = $this->service->getTypes();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
|
||||
$expected = array(
|
||||
'payment' => 'Payment',
|
||||
@@ -399,7 +401,7 @@ class ServiceTransactionTest extends \BBTestCase
|
||||
->will($this->returnValue($transactionModel));
|
||||
|
||||
$result = $serviceMock->oldProcessLogic($transactionModel);
|
||||
$this->assertInternalType('string', $result);
|
||||
$this->assertIsString($result);
|
||||
}
|
||||
|
||||
public function testpreProcessTransaction()
|
||||
@@ -425,7 +427,7 @@ class ServiceTransactionTest extends \BBTestCase
|
||||
$serviceMock->setDi($di);
|
||||
|
||||
$result = $serviceMock->preProcessTransaction($transactionModel);
|
||||
$this->assertInternalType('string', $result);
|
||||
$this->assertIsString($result);
|
||||
}
|
||||
|
||||
public function testpreProcessTransaction_supportOldLogic()
|
||||
@@ -454,7 +456,7 @@ class ServiceTransactionTest extends \BBTestCase
|
||||
$serviceMock->setDi($di);
|
||||
|
||||
$result = $serviceMock->preProcessTransaction($transactionModel);
|
||||
$this->assertInternalType('string', $result);
|
||||
$this->assertIsString($result);
|
||||
}
|
||||
|
||||
public function testpreProcessTransaction_registerException()
|
||||
@@ -479,7 +481,8 @@ class ServiceTransactionTest extends \BBTestCase
|
||||
$di['db'] = $dbMock;
|
||||
$serviceMock->setDi($di);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', $exceptionMessage);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage($exceptionMessage);
|
||||
$serviceMock->preProcessTransaction($transactionModel);
|
||||
}
|
||||
|
||||
@@ -532,7 +535,8 @@ class ServiceTransactionTest extends \BBTestCase
|
||||
$di['api_admin'] = new \Api_Handler(new \Model_Admin());
|
||||
$this->service->setDi($di);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', sprintf("Payment adapter %s does not support action %s", $payGatewayModel->name, 'processTransaction'));
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage(sprintf("Payment adapter %s does not support action %s", $payGatewayModel->name, 'processTransaction'));
|
||||
$this->service->processTransaction($id);
|
||||
}
|
||||
|
||||
@@ -616,7 +620,7 @@ class ServiceTransactionTest extends \BBTestCase
|
||||
$serviceMock->setDi($di);
|
||||
|
||||
$result = $serviceMock->getReceived();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testdebitTransaction()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace Box\Tests\Mod\Kb\Api;
|
||||
|
||||
class AdminTest extends \BBTestCase
|
||||
class Api_AdminTest extends \BBTestCase
|
||||
{
|
||||
public function testArticle_get_list()
|
||||
{
|
||||
@@ -26,7 +26,7 @@ class AdminTest extends \BBTestCase
|
||||
$adminApi->setService($kbService);
|
||||
|
||||
$result = $adminApi->article_get_list($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
|
||||
}
|
||||
|
||||
@@ -65,13 +65,9 @@ class AdminTest extends \BBTestCase
|
||||
$adminApi->setService($kbService);
|
||||
|
||||
$result = $adminApi->article_get($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testArticle_getNotFoundException()
|
||||
{
|
||||
$adminApi = new \Box\Mod\Kb\Api\Admin();
|
||||
@@ -93,6 +89,7 @@ class AdminTest extends \BBTestCase
|
||||
->will($this->returnValue(null));
|
||||
$di['validator'] = $validatorMock;
|
||||
$adminApi->setDi($di);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$adminApi->article_get($data);
|
||||
}
|
||||
|
||||
@@ -125,7 +122,7 @@ class AdminTest extends \BBTestCase
|
||||
$adminApi->setDi($di);
|
||||
|
||||
$result = $adminApi->article_create($data);
|
||||
$this->assertInternalType('integer', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($result, $id);
|
||||
}
|
||||
|
||||
@@ -200,10 +197,6 @@ class AdminTest extends \BBTestCase
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testArticle_deleteNotFoundException()
|
||||
{
|
||||
$adminApi = new \Box\Mod\Kb\Api\Admin();
|
||||
@@ -229,6 +222,7 @@ class AdminTest extends \BBTestCase
|
||||
->will($this->returnValue(true));
|
||||
$adminApi->setService($kbService);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $adminApi->article_delete(array('id' => rand(1, 100)));
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
@@ -264,7 +258,7 @@ class AdminTest extends \BBTestCase
|
||||
$adminApi->setService($kbService);
|
||||
|
||||
$result = $adminApi->category_get_list(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertEquals($result, $willReturn);
|
||||
}
|
||||
|
||||
@@ -296,12 +290,9 @@ class AdminTest extends \BBTestCase
|
||||
'id' => rand(1, 100)
|
||||
);
|
||||
$result = $adminApi->category_get($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testCategory_getIdNotSetException()
|
||||
{
|
||||
$adminApi = new \Box\Mod\Kb\Api\Admin();
|
||||
@@ -326,13 +317,11 @@ class AdminTest extends \BBTestCase
|
||||
->will($this->returnValue(array()));
|
||||
$adminApi->setService($kbService);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $adminApi->category_get(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
|
||||
public function testCategory_getNotFoundException()
|
||||
{
|
||||
$adminApi = new \Box\Mod\Kb\Api\Admin();
|
||||
@@ -361,8 +350,9 @@ class AdminTest extends \BBTestCase
|
||||
'id' => rand(1, 100)
|
||||
);
|
||||
|
||||
$result = $adminApi->category_get($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $adminApi->category_get($data);;
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testCategory_create()
|
||||
@@ -392,7 +382,7 @@ class AdminTest extends \BBTestCase
|
||||
$adminApi->setDi($di);
|
||||
|
||||
$result = $adminApi->category_create($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testCategory_update()
|
||||
@@ -434,12 +424,9 @@ class AdminTest extends \BBTestCase
|
||||
);
|
||||
|
||||
$result = $adminApi->category_update($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testCategory_updateIdNotSet()
|
||||
{
|
||||
$adminApi = new \Box\Mod\Kb\Api\Admin();
|
||||
@@ -468,13 +455,11 @@ class AdminTest extends \BBTestCase
|
||||
|
||||
$data = array();
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $adminApi->category_update($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testCategory_updateNotFound()
|
||||
{
|
||||
$adminApi = new \Box\Mod\Kb\Api\Admin();
|
||||
@@ -508,8 +493,9 @@ class AdminTest extends \BBTestCase
|
||||
'description' => 'Description',
|
||||
);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $adminApi->category_update($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testCategory_delete()
|
||||
@@ -541,12 +527,9 @@ class AdminTest extends \BBTestCase
|
||||
'id' => rand(1, 100),
|
||||
);
|
||||
$result = $adminApi->category_delete($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testCategory_deleteIdNotSet()
|
||||
{
|
||||
$adminApi = new \Box\Mod\Kb\Api\Admin();
|
||||
@@ -573,14 +556,11 @@ class AdminTest extends \BBTestCase
|
||||
$adminApi->setDi($di);
|
||||
|
||||
$data = array();
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $adminApi->category_delete($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testCategory_deleteNotFound()
|
||||
{
|
||||
$adminApi = new \Box\Mod\Kb\Api\Admin();
|
||||
@@ -609,8 +589,10 @@ class AdminTest extends \BBTestCase
|
||||
$data = array(
|
||||
'id' => rand(1, 100)
|
||||
);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $adminApi->category_delete($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testCategory_get_pairs()
|
||||
@@ -624,8 +606,8 @@ class AdminTest extends \BBTestCase
|
||||
$adminApi->setService($kbService);
|
||||
|
||||
$result = $adminApi->category_get_pairs(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace Box\Tests\Mod\Kb\Api;
|
||||
|
||||
class GuestTest extends \BBTestCase
|
||||
class Api_GuestTest extends \BBTestCase
|
||||
{
|
||||
public function testArticle_get_list()
|
||||
{
|
||||
@@ -34,7 +34,7 @@ class GuestTest extends \BBTestCase
|
||||
});
|
||||
$guestApi->setDi($di);
|
||||
$result = $guestApi->article_get_list(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertEquals($result, $willReturn);
|
||||
|
||||
}
|
||||
@@ -68,7 +68,7 @@ class GuestTest extends \BBTestCase
|
||||
'id' => rand(1, 100)
|
||||
);
|
||||
$result = $guestApi->article_get($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testArticle_getWithSlug()
|
||||
@@ -100,12 +100,10 @@ class GuestTest extends \BBTestCase
|
||||
'slug' => 'article-slug'
|
||||
);
|
||||
$result = $guestApi->article_get($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
|
||||
public function testArticle_getIdAndSlugNotSetException()
|
||||
{
|
||||
$guestApi = new \Box\Mod\Kb\Api\Guest();
|
||||
@@ -125,14 +123,11 @@ class GuestTest extends \BBTestCase
|
||||
->will($this->returnValue(array()));
|
||||
$guestApi->setService($kbService);
|
||||
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $guestApi->article_get(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
|
||||
public function testArticle_getNotFoundById()
|
||||
{
|
||||
$guestApi = new \Box\Mod\Kb\Api\Guest();
|
||||
@@ -161,13 +156,11 @@ class GuestTest extends \BBTestCase
|
||||
return isset ($array[$key]) ? $array[$key] : $default;
|
||||
});
|
||||
$guestApi->setDi($di);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $guestApi->article_get($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testArticle_getNotFoundBySlug()
|
||||
{
|
||||
$guestApi = new \Box\Mod\Kb\Api\Guest();
|
||||
@@ -197,8 +190,9 @@ class GuestTest extends \BBTestCase
|
||||
'slug' => 'article-slug'
|
||||
);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $guestApi->article_get($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testCategory_get_list()
|
||||
@@ -232,7 +226,7 @@ class GuestTest extends \BBTestCase
|
||||
$guestApi->setService($kbService);
|
||||
|
||||
$result = $guestApi->category_get_list(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertEquals($result, $willReturn);
|
||||
}
|
||||
|
||||
@@ -252,7 +246,7 @@ class GuestTest extends \BBTestCase
|
||||
$guestApi->setService($kbService);
|
||||
|
||||
$result = $guestApi->category_get_pairs(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertEquals($result, $expected);
|
||||
}
|
||||
|
||||
@@ -282,7 +276,7 @@ class GuestTest extends \BBTestCase
|
||||
});
|
||||
$guestApi->setDi($di);
|
||||
$result = $guestApi->category_get($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testCategory_getWithSlug()
|
||||
@@ -311,12 +305,9 @@ class GuestTest extends \BBTestCase
|
||||
'slug' => 'category-slug'
|
||||
);
|
||||
$result = $guestApi->category_get($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testCategory_getIdAndSlugNotSetException()
|
||||
{
|
||||
$guestApi = new \Box\Mod\Kb\Api\Guest();
|
||||
@@ -333,14 +324,11 @@ class GuestTest extends \BBTestCase
|
||||
->will($this->returnValue(array()));
|
||||
$guestApi->setService($kbService);
|
||||
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $guestApi->category_get(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testCategory_getNotFoundById()
|
||||
{
|
||||
$guestApi = new \Box\Mod\Kb\Api\Guest();
|
||||
@@ -367,13 +355,11 @@ class GuestTest extends \BBTestCase
|
||||
});
|
||||
$guestApi->setDi($di);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $guestApi->category_get($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testCategory_getNotFoundBySlug()
|
||||
{
|
||||
$guestApi = new \Box\Mod\Kb\Api\Guest();
|
||||
@@ -400,9 +386,10 @@ class GuestTest extends \BBTestCase
|
||||
});
|
||||
$guestApi->setDi($di);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $guestApi->category_get($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -30,10 +30,10 @@ class ServiceTest extends \BBTestCase
|
||||
$service->setDi($di);
|
||||
|
||||
$result = $service->searchArticles('active', 'keyword', 'category');
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
|
||||
$this->assertArrayHasKey('list', $result);
|
||||
$this->assertInternalType('array', $result['list']);
|
||||
$this->assertIsArray($result['list']);
|
||||
|
||||
$this->assertArrayHasKey('pages', $result);
|
||||
$this->assertArrayHasKey('page', $result);
|
||||
@@ -93,7 +93,7 @@ class ServiceTest extends \BBTestCase
|
||||
$service->setDi($di);
|
||||
|
||||
$result = $service->findActive();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testHitView()
|
||||
@@ -141,7 +141,7 @@ class ServiceTest extends \BBTestCase
|
||||
$this->assertNull($result);
|
||||
}
|
||||
|
||||
public function testToApiArrayProvider()
|
||||
public function toApiArrayProvider()
|
||||
{
|
||||
$model = new \Model_KbArticle();
|
||||
$model->loadBean(new \RedBeanPHP\OODBBean());
|
||||
@@ -230,7 +230,7 @@ class ServiceTest extends \BBTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider testToApiArrayProvider
|
||||
* @dataProvider toApiArrayProvider
|
||||
*/
|
||||
public function testToApiArray($model, $expected, $deep, $identity, $category)
|
||||
{
|
||||
@@ -274,7 +274,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$service->setDi($di);
|
||||
$result = $service->createArticle(rand(1, 100), 'Title', 'Active', 'Content');
|
||||
$this->assertInternalType('integer', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($result, $randId);
|
||||
}
|
||||
|
||||
@@ -307,13 +307,10 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$service->setDi($di);
|
||||
$result = $service->updateArticle($randId, $kb_article_category_id, $title, $slug, $status, $content, $views);
|
||||
$this->assertInternalType('boolean', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
|
||||
public function testUpdateArticleNotFoundException()
|
||||
{
|
||||
$service = new \Box\Mod\Kb\Service();
|
||||
@@ -339,13 +336,14 @@ class ServiceTest extends \BBTestCase
|
||||
$di['db'] = $db;
|
||||
$di['logger'] = $this->getMockBuilder('Box_Log')->getMock();
|
||||
|
||||
$service->setDi($di);
|
||||
$service->setDi($di);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $service->updateArticle($randId, $kb_article_category_id, $title, $slug, $status, $content, $views);
|
||||
$this->assertInternalType('boolean', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
public function testCategoryGetSearchQueryProvider()
|
||||
public function categoryGetSearchQueryProvider()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
@@ -401,7 +399,7 @@ class ServiceTest extends \BBTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider testCategoryGetSearchQueryProvider
|
||||
* @dataProvider categoryGetSearchQueryProvider
|
||||
*/
|
||||
public function testCategoryGetSearchQuery($data, $query, $bindings)
|
||||
{
|
||||
@@ -415,8 +413,8 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$result = $service->categoryGetSearchQuery($data);
|
||||
|
||||
$this->assertInternalType('string', $result[0]);
|
||||
$this->assertInternalType('array', $result[1]);
|
||||
$this->assertIsString($result[0]);
|
||||
$this->assertIsArray($result[1]);
|
||||
|
||||
$this->assertEquals(trim(preg_replace('/\s+/', '', str_replace("\n", " ", $result[0]))), trim(preg_replace('/\s+/', '', str_replace("\n", " ", $query))));
|
||||
$this->assertEquals($result[1], $bindings);
|
||||
@@ -437,7 +435,7 @@ class ServiceTest extends \BBTestCase
|
||||
$service->setDi($di);
|
||||
|
||||
$result = $service->categoryFindAll();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testCategoryGetPairs()
|
||||
@@ -454,7 +452,7 @@ class ServiceTest extends \BBTestCase
|
||||
$service->setDi($di);
|
||||
|
||||
$result = $service->categoryGetPairs();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testCategoryRm()
|
||||
@@ -481,9 +479,6 @@ class ServiceTest extends \BBTestCase
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testCategoryRmHasArticlesException()
|
||||
{
|
||||
$service = new \Box\Mod\Kb\Service();
|
||||
@@ -504,6 +499,7 @@ class ServiceTest extends \BBTestCase
|
||||
$model->KbArticle = new \Model_KbArticle();
|
||||
$model->KbArticle->loadBean(new \RedBeanPHP\OODBBean());
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $service->categoryRm($model);
|
||||
$this->assertNull($result);
|
||||
}
|
||||
@@ -538,7 +534,7 @@ class ServiceTest extends \BBTestCase
|
||||
$model->id = rand(1, 100);
|
||||
|
||||
$result = $serviceMock->categoryToApiArray($model);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testCreateCategory()
|
||||
@@ -579,7 +575,7 @@ class ServiceTest extends \BBTestCase
|
||||
$service->setDi($di);
|
||||
|
||||
$result = $service->createCategory('Title', 'Description');
|
||||
$this->assertInternalType('integer', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($result, $randId);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
class AdminTest extends \BBTestCase
|
||||
class Api_AdminTest extends \BBTestCase
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -8,7 +8,7 @@ class AdminTest extends \BBTestCase
|
||||
*/
|
||||
protected $api = null;
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->api = new \Box\Mod\Order\Api\Admin();
|
||||
}
|
||||
@@ -43,7 +43,7 @@ class AdminTest extends \BBTestCase
|
||||
);
|
||||
$result = $apiMock->get($data);
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testGet_list()
|
||||
@@ -75,7 +75,7 @@ class AdminTest extends \BBTestCase
|
||||
|
||||
$result = $this->api->get_list(array());
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testCreate()
|
||||
@@ -91,12 +91,9 @@ class AdminTest extends \BBTestCase
|
||||
->will($this->returnValue(null));
|
||||
|
||||
$dbMock = $this->getMockBuilder('\Box_Database')->disableOriginalConstructor()->getMock();
|
||||
$dbMock->expects($this->at(0))
|
||||
$dbMock->expects($this->exactly(2))
|
||||
->method('getExistingModelById')
|
||||
->will($this->returnValue(new \Model_Client()));
|
||||
$dbMock->expects($this->at(1))
|
||||
->method('getExistingModelById')
|
||||
->will($this->returnValue(new \Model_Product()));
|
||||
->will($this->onConsecutiveCalls(new \Model_Client(), new \Model_Product()));
|
||||
|
||||
$di = new \Box_Di();
|
||||
$di['validator'] = $validatorMock;
|
||||
@@ -110,7 +107,7 @@ class AdminTest extends \BBTestCase
|
||||
);
|
||||
$result = $this->api->create($data);
|
||||
|
||||
$this->assertInternalType('integer', $result);
|
||||
$this->assertIsInt($result);
|
||||
}
|
||||
|
||||
public function testUpdate()
|
||||
@@ -261,9 +258,6 @@ class AdminTest extends \BBTestCase
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testUnsuspendNotSuspendedException()
|
||||
{
|
||||
$order = new Model_ClientOrder();
|
||||
@@ -283,6 +277,7 @@ class AdminTest extends \BBTestCase
|
||||
$apiMock->setService($serviceMock);
|
||||
|
||||
$data = array();
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $apiMock->unsuspend($data);
|
||||
|
||||
$this->assertTrue($result);
|
||||
@@ -340,9 +335,6 @@ class AdminTest extends \BBTestCase
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testUncancelNotCanceledException()
|
||||
{
|
||||
$order = new Model_ClientOrder();
|
||||
@@ -362,6 +354,7 @@ class AdminTest extends \BBTestCase
|
||||
$apiMock->setService($serviceMock);
|
||||
|
||||
$data = array();
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $apiMock->uncancel($data);
|
||||
|
||||
$this->assertTrue($result);
|
||||
@@ -473,9 +466,6 @@ class AdminTest extends \BBTestCase
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testUpdate_configNotSetConfigException()
|
||||
{
|
||||
$order = new Model_ClientOrder();
|
||||
@@ -495,6 +485,7 @@ class AdminTest extends \BBTestCase
|
||||
$apiMock->setService($serviceMock);
|
||||
|
||||
$data = array();
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $apiMock->update_config($data);
|
||||
|
||||
$this->assertTrue($result);
|
||||
@@ -526,7 +517,7 @@ class AdminTest extends \BBTestCase
|
||||
);
|
||||
$result = $apiMock->service($data);
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
|
||||
@@ -563,7 +554,7 @@ class AdminTest extends \BBTestCase
|
||||
|
||||
$result = $apiMock->status_history_get_list(array());
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testStatus_history_add()
|
||||
@@ -641,19 +632,19 @@ class AdminTest extends \BBTestCase
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->get_statuses();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testGet_invoice_options()
|
||||
{
|
||||
$result = $this->api->get_invoice_options(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testGet_status_pairs()
|
||||
{
|
||||
$result = $this->api->get_status_pairs(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testAddons()
|
||||
@@ -680,8 +671,8 @@ class AdminTest extends \BBTestCase
|
||||
);
|
||||
$result = $apiMock->addons($data);
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertInternalType('array', $result[0]);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertIsArray($result[0]);
|
||||
}
|
||||
|
||||
public function testGetOrder()
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
* Date: 8/5/14
|
||||
* Time: 4:52 PM
|
||||
*/
|
||||
class ClientTest extends PHPUnit_Framework_TestCase
|
||||
class Api_ClientTest extends PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @var \Box\Mod\Order\Api\Client
|
||||
*/
|
||||
protected $api = null;
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->api = new \Box\Mod\Order\Api\Client();
|
||||
}
|
||||
@@ -71,7 +71,7 @@ class ClientTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$result = $this->api->get_list(array());
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testGet_listExpiring()
|
||||
@@ -105,7 +105,7 @@ class ClientTest extends PHPUnit_Framework_TestCase
|
||||
);
|
||||
$result = $this->api->get_list($data);
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testGet()
|
||||
@@ -130,7 +130,7 @@ class ClientTest extends PHPUnit_Framework_TestCase
|
||||
);
|
||||
$result = $apiMock->get($data);
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testAddons()
|
||||
@@ -157,8 +157,8 @@ class ClientTest extends PHPUnit_Framework_TestCase
|
||||
);
|
||||
$result = $apiMock->addons($data);
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertInternalType('array', $result[0]);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertIsArray($result[0]);
|
||||
}
|
||||
|
||||
public function testService()
|
||||
@@ -187,7 +187,7 @@ class ClientTest extends PHPUnit_Framework_TestCase
|
||||
);
|
||||
$result = $apiMock->service($data);
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testUpgradables()
|
||||
@@ -222,7 +222,7 @@ class ClientTest extends PHPUnit_Framework_TestCase
|
||||
$data = array();
|
||||
|
||||
$result = $apiMock->upgradables($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testDelete()
|
||||
@@ -251,9 +251,6 @@ class ClientTest extends PHPUnit_Framework_TestCase
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testDeleteNotPendingException()
|
||||
{
|
||||
$order = new Model_ClientOrder();
|
||||
@@ -273,7 +270,9 @@ class ClientTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$data = array(
|
||||
'id' => rand(1, 100)
|
||||
);
|
||||
);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $apiMock->delete($data);
|
||||
|
||||
$this->assertTrue($result);
|
||||
@@ -315,9 +314,6 @@ class ClientTest extends PHPUnit_Framework_TestCase
|
||||
$this->api->get($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testGetOrderNotFoundException()
|
||||
{
|
||||
$validatorMock = $this->getMockBuilder('\Box_Validate')->disableOriginalConstructor()->getMock();
|
||||
@@ -348,6 +344,8 @@ class ClientTest extends PHPUnit_Framework_TestCase
|
||||
$data = array(
|
||||
'id' => rand(1, 100)
|
||||
);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->api->get($data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ class ServiceTest extends \BBTestCase
|
||||
*/
|
||||
protected $service = null;
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->service = new \Box\Mod\Order\Service();
|
||||
}
|
||||
@@ -50,7 +50,7 @@ class ServiceTest extends \BBTestCase
|
||||
$this->service->setDi($di);
|
||||
|
||||
$result = $this->service->counter();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertArrayHasKey('total', $result);
|
||||
$this->assertEquals(array_sum($counter), $result['total']);
|
||||
$this->assertArrayHasKey(\Model_ClientOrder::STATUS_PENDING_SETUP, $result);
|
||||
@@ -903,10 +903,10 @@ class ServiceTest extends \BBTestCase
|
||||
$order->loadBean(new \RedBeanPHP\OODBBean());
|
||||
|
||||
$result = $this->service->getConfig($order);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testProductHasOrdersProvider()
|
||||
public function productHasOrdersProvider()
|
||||
{
|
||||
$order = new \Model_ClientOrder();
|
||||
$order->loadBean(new \RedBeanPHP\OODBBean());
|
||||
@@ -918,7 +918,7 @@ class ServiceTest extends \BBTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider testProductHasOrdersProvider
|
||||
* @dataProvider productHasOrdersProvider
|
||||
*/
|
||||
public function testProductHasOrders($order, $expectedResult)
|
||||
{
|
||||
@@ -1030,8 +1030,8 @@ class ServiceTest extends \BBTestCase
|
||||
':days_until_expiration' => $randId,
|
||||
);
|
||||
|
||||
$this->assertInternalType('string', $result[0]);
|
||||
$this->assertInternalType('array', $result[1]);
|
||||
$this->assertIsString($result[0]);
|
||||
$this->assertIsArray($result[1]);
|
||||
|
||||
$this->assertEquals($expectedQuery, $result[0]);
|
||||
$this->assertEquals($expectedBindings, $result[1]);
|
||||
@@ -1056,7 +1056,7 @@ class ServiceTest extends \BBTestCase
|
||||
$this->service->setDi($di);
|
||||
|
||||
$result = $this->service->getRelatedOrderIdByType($model, 'domain');
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($id, $result);
|
||||
}
|
||||
|
||||
@@ -1279,8 +1279,8 @@ class ServiceTest extends \BBTestCase
|
||||
$this->service->setDi($di);
|
||||
|
||||
$result = $this->service->getSearchQuery($data);
|
||||
$this->assertInternalType('string', $result[0]);
|
||||
$this->assertInternalType('array', $result[1]);
|
||||
$this->assertIsString($result[0]);
|
||||
$this->assertIsArray($result[1]);
|
||||
|
||||
$this->assertTrue(strpos($result[0], $expectedStr) !== false, $result[0]);
|
||||
$this->assertTrue(array_diff_key($result[1], $expectedParams) == array());
|
||||
@@ -1303,7 +1303,9 @@ class ServiceTest extends \BBTestCase
|
||||
$di['license'] = $licenseMock;
|
||||
|
||||
$this->service->setDi($di);
|
||||
$this->setExpectedException('\Box_Exception', 'This feature is available in BoxBilling PRO version.', 876);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionCode(876);
|
||||
$this->expectExceptionMessage('This feature is available in BoxBilling PRO version.');
|
||||
$this->service->createOrder($modelClient, $modelProduct, array());
|
||||
}
|
||||
|
||||
@@ -1334,7 +1336,8 @@ class ServiceTest extends \BBTestCase
|
||||
});
|
||||
|
||||
$this->service->setDi($di);
|
||||
$this->setExpectedException('\Box_Exception', 'Currency could not be determined for order');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Currency could not be determined for order');
|
||||
$this->service->createOrder($modelClient, $modelProduct, array());
|
||||
}
|
||||
|
||||
@@ -1387,7 +1390,9 @@ class ServiceTest extends \BBTestCase
|
||||
$di['events_manager'] = $eventMock;
|
||||
|
||||
$this->service->setDi($di);
|
||||
$this->setExpectedException('\Box_Exception', 'Product 1 is out of stock.', 831);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionCode(831);
|
||||
$this->expectExceptionMessage('Product 1 is out of stock.');
|
||||
$this->service->createOrder($modelClient, $modelProduct, array());
|
||||
}
|
||||
|
||||
@@ -1441,7 +1446,9 @@ class ServiceTest extends \BBTestCase
|
||||
$di['events_manager'] = $eventMock;
|
||||
|
||||
$this->service->setDi($di);
|
||||
$this->setExpectedException('\Box_Exception', 'Group ID parameter is missing for addon product order', 832);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionCode(832);
|
||||
$this->expectExceptionMessage('Group ID parameter is missing for addon product order');
|
||||
$this->service->createOrder($modelClient, $modelProduct, array());
|
||||
}
|
||||
|
||||
@@ -1501,7 +1508,8 @@ class ServiceTest extends \BBTestCase
|
||||
->willReturn(null);
|
||||
|
||||
$serviceMock->setDi($di);
|
||||
$this->setExpectedException('\Box_Exception', 'Parent order 1 was not found');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Parent order 1 was not found');
|
||||
$serviceMock->createOrder($modelClient, $modelProduct, array('group_id' => 1));
|
||||
}
|
||||
|
||||
@@ -1610,7 +1618,8 @@ class ServiceTest extends \BBTestCase
|
||||
$clientOrderModel = new \Model_ClientOrder();
|
||||
$clientOrderModel->loadBean(new \RedBeanPHP\OODBBean());
|
||||
$clientOrderModel->status = \Model_ClientOrder::STATUS_CANCELED;
|
||||
$this->setExpectedException('\Box_Exception', 'Only pending setup or failed orders can be activated');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Only pending setup or failed orders can be activated');
|
||||
$this->service->activateOrder($clientOrderModel);
|
||||
}
|
||||
|
||||
@@ -1693,7 +1702,7 @@ class ServiceTest extends \BBTestCase
|
||||
$this->service->setDi($di);
|
||||
|
||||
$result = $this->service->getOrderAddonsList($modelClientOrder);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertInstanceOf('\Model_ClientOrder', $result[0]);
|
||||
}
|
||||
|
||||
@@ -1846,7 +1855,8 @@ class ServiceTest extends \BBTestCase
|
||||
$di['events_manager'] = $eventMock;
|
||||
|
||||
$this->service->setDi($di);
|
||||
$this->setExpectedException('\Box_Exception', 'Only active orders can be suspended');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Only active orders can be suspended');
|
||||
$this->service->suspendFromOrder($clientOrderModel);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ class AdminTest extends \BBTestCase {
|
||||
*/
|
||||
protected $api = null;
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->api = new \Box\Mod\Page\Api\Admin();
|
||||
}
|
||||
@@ -35,7 +35,7 @@ class AdminTest extends \BBTestCase {
|
||||
|
||||
$this->api->setService($serviceMock);
|
||||
$result = $this->api->get_pairs();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ class ServiceTest extends \BBTestCase {
|
||||
|
||||
$service->setDi($di);
|
||||
$result = $service->getPairs();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ class ServiceTest extends \BBTestCase {
|
||||
*/
|
||||
protected $service = null;
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->service= new \Box\Mod\Paidsupport\Service();
|
||||
}
|
||||
@@ -92,7 +92,8 @@ class ServiceTest extends \BBTestCase {
|
||||
});
|
||||
$this->service->setDi($di);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', $paidSupportConfig['error_msg']);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage($paidSupportConfig['error_msg']);
|
||||
$this->service->enoughInBalanceToOpenTicket($clientModel);
|
||||
}
|
||||
|
||||
@@ -449,7 +450,7 @@ class ServiceTest extends \BBTestCase {
|
||||
|
||||
$this->service->setDi($di);
|
||||
$result = $this->service->getPaidHelpdeskConfig();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertNotEmpty($result);
|
||||
$this->assertEquals($helpdeskConfig, $result);
|
||||
|
||||
@@ -468,7 +469,7 @@ class ServiceTest extends \BBTestCase {
|
||||
|
||||
$this->service->setDi($di);
|
||||
$result = $this->service->getPaidHelpdeskConfig();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertEmpty($result);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ class AdminTest extends \BBTestCase {
|
||||
*/
|
||||
protected $api = null;
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->api= new \Box\Mod\Product\Api\Admin();
|
||||
}
|
||||
@@ -48,7 +48,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setService($serviceMock);
|
||||
$this->api->setDi($di);
|
||||
$result = $this->api->get_list(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testget_pairs()
|
||||
@@ -61,7 +61,7 @@ class AdminTest extends \BBTestCase {
|
||||
|
||||
$this->api->setService($serviceMock);
|
||||
$result = $this->api->get_pairs(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testget()
|
||||
@@ -92,7 +92,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
$this->api->setService($serviceMock);
|
||||
$result = $this->api->get($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testget_types()
|
||||
@@ -105,7 +105,7 @@ class AdminTest extends \BBTestCase {
|
||||
|
||||
$this->api->setService($serviceMock);
|
||||
$result = $this->api->get_types();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testprepareDomainProductAlreadyCreated()
|
||||
@@ -129,7 +129,9 @@ class AdminTest extends \BBTestCase {
|
||||
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'You have already created domain product', 413);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionCode(413);
|
||||
$this->expectExceptionMessage('You have already created domain product');
|
||||
$this->api->prepare($data);
|
||||
}
|
||||
|
||||
@@ -159,7 +161,9 @@ class AdminTest extends \BBTestCase {
|
||||
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', sprintf('Product type %s is not registered', $data['type']), 413);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionCode(413);
|
||||
$this->expectExceptionMessage(sprintf('Product type %s is not registered', $data['type']));
|
||||
$this->api->prepare($data);
|
||||
}
|
||||
|
||||
@@ -198,7 +202,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->prepare($data);
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($newProductId, $result);
|
||||
}
|
||||
|
||||
@@ -229,7 +233,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->update($data);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -237,7 +241,8 @@ class AdminTest extends \BBTestCase {
|
||||
{
|
||||
$data = array();
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'priority params is missing');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('priority params is missing');
|
||||
$this->api->update_priority($data);
|
||||
}
|
||||
|
||||
@@ -255,7 +260,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->update_priority($data);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -287,7 +292,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->update_config($data);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -301,7 +306,7 @@ class AdminTest extends \BBTestCase {
|
||||
|
||||
$this->api->setService($serviceMock);
|
||||
$result = $this->api->addon_get_pairs(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testaddon_create()
|
||||
@@ -327,7 +332,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->addon_create($data);
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($newAddonId, $result);
|
||||
}
|
||||
|
||||
@@ -361,7 +366,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->addon_get($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testaddon_update()
|
||||
@@ -397,7 +402,7 @@ class AdminTest extends \BBTestCase {
|
||||
$apiMock->setDi($di);
|
||||
|
||||
$result = $apiMock->addon_update($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testaddon_delete()
|
||||
@@ -411,7 +416,7 @@ class AdminTest extends \BBTestCase {
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$result = $apiMock->addon_delete(array());
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -444,7 +449,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
|
||||
$result = $this->api->delete($data);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -458,7 +463,7 @@ class AdminTest extends \BBTestCase {
|
||||
|
||||
$this->api->setService($serviceMock);
|
||||
$result = $this->api->category_get_pairs(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testcategory_update()
|
||||
@@ -493,7 +498,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
|
||||
$result = $this->api->category_update($data);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -526,7 +531,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
|
||||
$result = $this->api->category_get($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testcategory_create()
|
||||
@@ -552,7 +557,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->category_create($data);
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($newCategoryId, $result);
|
||||
}
|
||||
|
||||
@@ -585,7 +590,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
|
||||
$result = $this->api->category_delete($data);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -612,7 +617,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setService($serviceMock);
|
||||
$this->api->setDi($di);
|
||||
$result = $this->api->promo_get_list(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testpromo_create()
|
||||
@@ -641,7 +646,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->promo_create($data);
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($newPromoId, $result);
|
||||
}
|
||||
|
||||
@@ -649,7 +654,8 @@ class AdminTest extends \BBTestCase {
|
||||
{
|
||||
$data = array();
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Promo id is missing');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Promo id is missing');
|
||||
$this->api->promo_get($data);
|
||||
}
|
||||
|
||||
@@ -682,7 +688,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
|
||||
$result = $this->api->promo_get($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testpromo_update()
|
||||
@@ -713,7 +719,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
$this->api->setService($serviceMock);
|
||||
$result = $this->api->promo_update($data);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -744,7 +750,7 @@ class AdminTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
$this->api->setService($serviceMock);
|
||||
$result = $this->api->promo_delete($data);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ class GuestTest extends \BBTestCase {
|
||||
*/
|
||||
protected $api = null;
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->api= new \Box\Mod\Product\Api\Guest();
|
||||
}
|
||||
@@ -46,7 +46,7 @@ class GuestTest extends \BBTestCase {
|
||||
$this->api->setService($serviceMock);
|
||||
$this->api->setDi($di);
|
||||
$result = $this->api->get_list(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testget_pairs()
|
||||
@@ -59,14 +59,15 @@ class GuestTest extends \BBTestCase {
|
||||
|
||||
$this->api->setService($serviceMock);
|
||||
$result = $this->api->get_pairs(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testgetMissingRequiredParams()
|
||||
{
|
||||
$data = array();
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Product ID or slug is missing');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Product ID or slug is missing');
|
||||
$this->api->get($data);
|
||||
}
|
||||
|
||||
@@ -93,7 +94,7 @@ class GuestTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
$this->api->setService($serviceMock);
|
||||
$result = $this->api->get($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testgetWithSetSlug()
|
||||
@@ -119,7 +120,7 @@ class GuestTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
$this->api->setService($serviceMock);
|
||||
$result = $this->api->get($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testgetProductNotFound()
|
||||
@@ -141,7 +142,8 @@ class GuestTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Product not found');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Product not found');
|
||||
$this->api->get($data);
|
||||
}
|
||||
|
||||
@@ -183,7 +185,7 @@ class GuestTest extends \BBTestCase {
|
||||
$this->api->setService($serviceMock);
|
||||
$this->api->setDi($di);
|
||||
$result = $this->api->category_get_list(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testcategory_get_pairs()
|
||||
@@ -195,7 +197,7 @@ class GuestTest extends \BBTestCase {
|
||||
|
||||
$this->api->setService($serviceMock);
|
||||
$result = $this->api->category_get_pairs(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testget_sliderEmptyList()
|
||||
@@ -214,7 +216,7 @@ class GuestTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
|
||||
$result = $this->api->get_slider(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertEquals(array(), $result);
|
||||
}
|
||||
|
||||
@@ -248,7 +250,7 @@ class GuestTest extends \BBTestCase {
|
||||
|
||||
$this->api->setService($serviceMock);
|
||||
$result = $this->api->get_slider(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testget_sliderJsonFormat()
|
||||
@@ -282,11 +284,11 @@ class GuestTest extends \BBTestCase {
|
||||
|
||||
$this->api->setService($serviceMock);
|
||||
$result = $this->api->get_slider(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
|
||||
$result = $this->api->get_slider(array('format' => 'json'));
|
||||
$this->assertInternalType('string', $result);
|
||||
$this->assertInternalType('array', json_decode($result, 1));
|
||||
$this->assertIsString($result);
|
||||
$this->assertIsArray(json_decode($result, 1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ class ServiceTest extends \BBTestCase
|
||||
*/
|
||||
protected $service = null;
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->service = new \Box\Mod\Product\Service();
|
||||
}
|
||||
@@ -60,7 +60,7 @@ class ServiceTest extends \BBTestCase
|
||||
$this->service->setDi($di);
|
||||
|
||||
$result = $this->service->getPairs($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertEquals($expectArray, $result);
|
||||
}
|
||||
|
||||
@@ -68,14 +68,11 @@ class ServiceTest extends \BBTestCase
|
||||
{
|
||||
$serviceMock = $this->getMockBuilder('\Box\Mod\Product\Service')
|
||||
->setMethods(array(
|
||||
'getAddonsApiArray',
|
||||
'getStartingFromPrice',
|
||||
'getUpgradablePairs',
|
||||
'toProductPaymentApiArray',))
|
||||
->getMock();
|
||||
|
||||
$serviceMock->expects($this->any())
|
||||
->method('getAddonsApiArray');
|
||||
$serviceMock->expects($this->atLeastOnce())
|
||||
->method('getStartingFromPrice');
|
||||
$serviceMock->expects($this->atLeastOnce())
|
||||
@@ -121,7 +118,7 @@ class ServiceTest extends \BBTestCase
|
||||
$serviceMock->setDi($di);
|
||||
|
||||
$result = $serviceMock->toApiArray($model, true, new \Model_Admin());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testgetTypes()
|
||||
@@ -152,7 +149,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$this->service->setDi($di);
|
||||
$result = $this->service->getTypes();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertEquals($expectedArray, $result);
|
||||
}
|
||||
|
||||
@@ -183,7 +180,7 @@ class ServiceTest extends \BBTestCase
|
||||
);
|
||||
|
||||
$result = $this->service->getPaymentTypes();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
@@ -226,7 +223,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$this->service->setDi($di);
|
||||
$result = $this->service->createProduct('title', 'domain');
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($newProductId, $result);
|
||||
|
||||
}
|
||||
@@ -253,7 +250,8 @@ class ServiceTest extends \BBTestCase
|
||||
$modelProduct = new \Model_Product();
|
||||
$modelProduct->loadBean(new \RedBeanPHP\OODBBean());
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Pricing type is required');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Pricing type is required');
|
||||
$serviceMock->updateProduct($modelProduct, $data);
|
||||
}
|
||||
|
||||
@@ -426,7 +424,7 @@ class ServiceTest extends \BBTestCase
|
||||
$this->service->setDi($di);
|
||||
|
||||
$result = $this->service->getAddons();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
@@ -460,7 +458,7 @@ class ServiceTest extends \BBTestCase
|
||||
$this->service->setDi($di);
|
||||
|
||||
$result = $this->service->createAddon('title');
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($newProductId, $result);
|
||||
}
|
||||
|
||||
@@ -478,7 +476,8 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$this->service->setDi($di);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Can not remove product which has active orders.');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Can not remove product which has active orders.');
|
||||
$this->service->deleteProduct($model);
|
||||
}
|
||||
|
||||
@@ -505,7 +504,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$this->service->setDi($di);
|
||||
$result = $this->service->getProductCategoryPairs();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertEquals($expectArray, $result);
|
||||
}
|
||||
|
||||
@@ -529,7 +528,7 @@ class ServiceTest extends \BBTestCase
|
||||
$this->service->setDi($di);
|
||||
|
||||
$result = $this->service->updateCategory($model, 'title', 'decription', 'http://urltoimg.com/img.jpg');
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
|
||||
}
|
||||
@@ -563,7 +562,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$result = $this->service->createCategory('title');
|
||||
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($newCategoryId, $result);
|
||||
}
|
||||
|
||||
@@ -585,7 +584,8 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$this->service->setDi($di);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Can not remove product category with products');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Can not remove product category with products');
|
||||
$this->service->removeProductCategory($modelProductCategory);
|
||||
|
||||
}
|
||||
@@ -612,7 +612,7 @@ class ServiceTest extends \BBTestCase
|
||||
$this->service->setDi($di);
|
||||
|
||||
$result = $this->service->removeProductCategory($modelProductCategory);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -632,8 +632,8 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
list($sql, $params) = $this->service->getPromoSearchQuery($data);
|
||||
|
||||
$this->assertInternalType('string', $sql);
|
||||
$this->assertInternalType('array', $params);
|
||||
$this->assertIsString($sql);
|
||||
$this->assertIsArray($params);
|
||||
}
|
||||
|
||||
public function testcreatePromo()
|
||||
@@ -665,7 +665,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$this->service->setDi($di);
|
||||
$result = $this->service->createPromo('code', 'percentage', 50, array(), array(), array(), array());
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($newPromoId, $result);
|
||||
}
|
||||
|
||||
@@ -688,7 +688,7 @@ class ServiceTest extends \BBTestCase
|
||||
$this->service->setDi($di);
|
||||
|
||||
$result = $this->service->toPromoApiArray($model);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testupdatePromo()
|
||||
@@ -725,7 +725,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$this->service->setDi($di);
|
||||
$result = $this->service->updatePromo($model, $data);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -746,7 +746,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$this->service->setDi($di);
|
||||
$result = $this->service->deletePromo($model);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -767,8 +767,8 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
list($sql, $params) = $this->service->getProductSearchQuery($data);
|
||||
|
||||
$this->assertInternalType('string', $sql);
|
||||
$this->assertInternalType('array', $params);
|
||||
$this->assertIsString($sql);
|
||||
$this->assertIsArray($params);
|
||||
}
|
||||
|
||||
public function testtoProductCategoryApiArray()
|
||||
@@ -811,7 +811,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$serviceMock->setDi($di);
|
||||
$result = $serviceMock->toProductCategoryApiArray($model);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
|
||||
@@ -870,7 +870,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$serviceMock->setDi($di);
|
||||
$result = $serviceMock->toProductCategoryApiArray($model);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertEquals($min, $result['price_starting_from']);
|
||||
}
|
||||
|
||||
@@ -913,8 +913,8 @@ class ServiceTest extends \BBTestCase
|
||||
{
|
||||
list($sql, $params) = $this->service->getProductCategorySearchQuery(array());
|
||||
|
||||
$this->assertInternalType('string', $sql);
|
||||
$this->assertInternalType('array', $params);
|
||||
$this->assertIsString($sql);
|
||||
$this->assertIsArray($params);
|
||||
$this->assertEquals(array(), $params);
|
||||
}
|
||||
|
||||
@@ -940,7 +940,7 @@ class ServiceTest extends \BBTestCase
|
||||
$this->service->setDi($di);
|
||||
$result = $this->service->getStartingFromPrice($productModel);
|
||||
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals('0', $result);
|
||||
}
|
||||
|
||||
@@ -985,7 +985,7 @@ class ServiceTest extends \BBTestCase
|
||||
$expected = array();
|
||||
|
||||
$result = $this->service->getUpgradablePairs($productModel);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
@@ -1020,7 +1020,7 @@ class ServiceTest extends \BBTestCase
|
||||
$this->service->setDi($di);
|
||||
|
||||
$result = $this->service->getProductTitlesByIds($ids);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testgetCategoryProducts()
|
||||
@@ -1041,7 +1041,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$this->service->setDi($di);
|
||||
$result = $this->service->getCategoryProducts($productCategoryModel);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testtoProductPaymentApiArray()
|
||||
@@ -1050,7 +1050,7 @@ class ServiceTest extends \BBTestCase
|
||||
$productPaymentModel->loadBean(new \RedBeanPHP\OODBBean());
|
||||
|
||||
$result = $this->service->toProductPaymentApiArray($productPaymentModel);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testgetStartingPrice()
|
||||
@@ -1077,7 +1077,7 @@ class ServiceTest extends \BBTestCase
|
||||
$productPaymentModel->tria_price = 14;
|
||||
|
||||
$result = $this->service->getStartingPrice($productPaymentModel);
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($minPrice, $result);
|
||||
}
|
||||
|
||||
@@ -1092,7 +1092,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$this->service->setDi($di);
|
||||
$result = $this->service->getSavePath($filename);
|
||||
$this->assertInternalType('string', $result);
|
||||
$this->assertIsString($result);
|
||||
$this->assertNotEmpty($result);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
@@ -1114,7 +1114,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$this->service->setDi($di);
|
||||
$result = $this->service->removeOldFile($config);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -1133,7 +1133,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$this->service->setDi($di);
|
||||
$result = $this->service->removeOldFile($config);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
|
||||
@@ -93,20 +93,16 @@ class AdminTest extends \BBTestCase
|
||||
public function testChangePasswordExceptions()
|
||||
{
|
||||
$adminApi = new \Box\Mod\Profile\Api\Admin();
|
||||
|
||||
$this->expectException(\Exception::class);
|
||||
$adminApi->change_password(array());
|
||||
$this->fail('password should be passed');
|
||||
|
||||
|
||||
try {
|
||||
$adminApi->change_password(array());
|
||||
$this->fail('password should be passed');
|
||||
} catch(\Exception $e) {
|
||||
//ok
|
||||
}
|
||||
|
||||
try {
|
||||
$adminApi->change_password(array('password'=>'new_pass'));
|
||||
$this->fail('password confirmation should be passed');
|
||||
} catch(\Exception $e) {
|
||||
//ok
|
||||
}
|
||||
$this->expectException(\Exception::class);
|
||||
$adminApi->change_password(array('password'=>'new_pass'));
|
||||
$this->fail('password confirmation should be passed');
|
||||
|
||||
}
|
||||
|
||||
public function testChangePassword()
|
||||
|
||||
@@ -9,7 +9,7 @@ class ClientTest extends \BBTestCase
|
||||
*/
|
||||
protected $clientApi = null;
|
||||
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->clientApi = new \Box\Mod\Profile\Api\Client();
|
||||
}
|
||||
@@ -29,7 +29,7 @@ class ClientTest extends \BBTestCase
|
||||
$this->clientApi->setIdentity(new \Model_Client());
|
||||
|
||||
$result = $this->clientApi->get();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testUpdate()
|
||||
@@ -99,9 +99,6 @@ class ClientTest extends \BBTestCase
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testChange_passwordPasswordsDoNotMatchException()
|
||||
{
|
||||
$service = $this->getMockBuilder('\Box\Mod\Profile\Service')->getMock();
|
||||
@@ -123,6 +120,8 @@ class ClientTest extends \BBTestCase
|
||||
'password_confirm' => '16047a3e69f5245756d73b419348f0c7',
|
||||
'password' => '7c0f843914b37d6575425f96e3a74061' //passwords do not match
|
||||
);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $this->clientApi->change_password($data);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$service = new Service();
|
||||
$result = $service->getAdminIdentityArray($model);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testUpdateAdmin()
|
||||
@@ -215,9 +215,6 @@ class ServiceTest extends \BBTestCase
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testUpdateClientEmailChangeNotAllowedException()
|
||||
{
|
||||
$emMock = $this->getMockBuilder('\Box_EventManager')
|
||||
@@ -270,14 +267,11 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$service = new Service();
|
||||
$service->setDi($di);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $service->updateClient($model, $data);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testUpdateClientEmailAlreadyRegisteredException()
|
||||
{
|
||||
$emMock = $this->getMockBuilder('\Box_EventManager')
|
||||
@@ -330,6 +324,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$service = new Service();
|
||||
$service->setDi($di);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $service->updateClient($model, $data);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
@@ -353,7 +348,7 @@ class ServiceTest extends \BBTestCase
|
||||
$service = new Service();
|
||||
$service->setDi($di);
|
||||
$result = $service->resetApiKey($model);
|
||||
$this->assertInternalType('string', $result);
|
||||
$this->assertIsString($result);
|
||||
$this->assertEquals(strlen($result), 32);
|
||||
}
|
||||
|
||||
@@ -424,4 +419,4 @@ class ServiceTest extends \BBTestCase
|
||||
$result = $service->logoutClient($model, 'new password');
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ class ServiceTest extends \BBTestCase
|
||||
*/
|
||||
protected $service = null;
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->service= new \Box\Mod\Serviceboxbillinglicense\Service();
|
||||
}
|
||||
@@ -88,7 +88,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$this->service->setDi($di);
|
||||
$result = $this->service->getModuleConfig();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertArrayHasKey('api_key', $result);
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$this->service->setDi($di);
|
||||
$result = $this->service->getModuleConfig();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertArrayHasKey('api_key', $result);
|
||||
}
|
||||
}
|
||||
@@ -2,14 +2,14 @@
|
||||
namespace Box\Tests\Mod\Servicecustom\Api;
|
||||
|
||||
|
||||
class AdminTest extends \BBTestCase
|
||||
class Api_AdminTest extends \BBTestCase
|
||||
{
|
||||
/**
|
||||
* @var \Box\Mod\Servicecustom\Api\Admin
|
||||
*/
|
||||
protected $api = null;
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->api = new \Box\Mod\Servicecustom\Api\Admin();
|
||||
}
|
||||
@@ -33,9 +33,6 @@ class AdminTest extends \BBTestCase
|
||||
$this->api->update($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testUpdateOrderIdNotSetException()
|
||||
{
|
||||
$serviceMock = $this->getMockBuilder('Box\Mod\Servicecustom\Service')->setMethods(array('updateConfig'))->getMock();
|
||||
@@ -50,7 +47,7 @@ class AdminTest extends \BBTestCase
|
||||
);
|
||||
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$this->expectException(\Exception::class);
|
||||
$result = $this->api->update($data);
|
||||
|
||||
$this->assertTrue($result);
|
||||
@@ -112,9 +109,6 @@ class AdminTest extends \BBTestCase
|
||||
$this->api->__call('delete', $arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testCallArgumentsNotSetException()
|
||||
{
|
||||
$serviceMock = $this->getMockBuilder('Box\Mod\Servicecustom\Service')->getMock();
|
||||
@@ -128,13 +122,10 @@ class AdminTest extends \BBTestCase
|
||||
$arguments = array();
|
||||
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$this->expectException(\Exception::class);
|
||||
$this->api->__call('delete', $arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testCallOrderIdNotSetException()
|
||||
{
|
||||
$serviceMock = $this->getMockBuilder('Box\Mod\Servicecustom\Service')->getMock();
|
||||
@@ -150,7 +141,7 @@ class AdminTest extends \BBTestCase
|
||||
);
|
||||
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$this->expectException(\Exception::class);
|
||||
$this->api->__call('delete', $arguments);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
namespace Box\Tests\Mod\Servicecustom\Api;
|
||||
|
||||
|
||||
class ClientTest extends \BBTestCase
|
||||
class Api_ClientTest extends \BBTestCase
|
||||
{
|
||||
/**
|
||||
* @var \Box\Mod\Servicecustom\Api\Client
|
||||
*/
|
||||
protected $api = null;
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->api = new \Box\Mod\Servicecustom\Api\Client();
|
||||
}
|
||||
@@ -35,9 +35,6 @@ class ClientTest extends \BBTestCase
|
||||
$this->api->__call('delete', $arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testCallArgumentsNotSetException()
|
||||
{
|
||||
$serviceMock = $this->getMockBuilder('Box\Mod\Servicecustom\Service')->getMock();
|
||||
@@ -51,13 +48,10 @@ class ClientTest extends \BBTestCase
|
||||
$arguments = array();
|
||||
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$this->expectException(\Exception::class);
|
||||
$this->api->__call('delete', $arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testCallOrderIdNotSetException()
|
||||
{
|
||||
$serviceMock = $this->getMockBuilder('Box\Mod\Servicecustom\Service')->getMock();
|
||||
@@ -73,7 +67,7 @@ class ClientTest extends \BBTestCase
|
||||
);
|
||||
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$this->expectException(\Exception::class);
|
||||
$this->api->__call('delete', $arguments);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ class ServiceTest extends \BBTestCase
|
||||
*/
|
||||
protected $service = null;
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->service = new \Box\Mod\Servicecustom\Service();
|
||||
}
|
||||
@@ -61,9 +61,6 @@ class ServiceTest extends \BBTestCase
|
||||
$this->assertNull($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testValidateCustomFormFieldNameNotSetException()
|
||||
{
|
||||
$form = array(
|
||||
@@ -94,13 +91,11 @@ class ServiceTest extends \BBTestCase
|
||||
'form_id' => rand(1, 100)
|
||||
);
|
||||
$data = array();
|
||||
$this->expectException(\Exception::class);
|
||||
$result = $this->service->validateCustomForm($data, $product);
|
||||
$this->assertNull($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testValidateCustomFormReadonlyFieldChangeException()
|
||||
{
|
||||
$form = array(
|
||||
@@ -133,6 +128,8 @@ class ServiceTest extends \BBTestCase
|
||||
$data = array(
|
||||
'field_name' => 'field_name'
|
||||
);
|
||||
|
||||
$this->expectException(\Exception::class);
|
||||
$result = $this->service->validateCustomForm($data, $product);
|
||||
$this->assertNull($result);
|
||||
}
|
||||
@@ -197,9 +194,6 @@ class ServiceTest extends \BBTestCase
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testActionActivateOrderServiceNotCreatedException()
|
||||
{
|
||||
$order = new \Model_ClientOrder();
|
||||
@@ -217,7 +211,7 @@ class ServiceTest extends \BBTestCase
|
||||
return $serviceMock;
|
||||
});
|
||||
$this->service->setDi($di);
|
||||
|
||||
$this->expectException(\Exception::class);
|
||||
$this->service->action_activate($order);
|
||||
}
|
||||
|
||||
@@ -253,9 +247,6 @@ class ServiceTest extends \BBTestCase
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testActiveServiceNotFoundException()
|
||||
{
|
||||
$order = new \Model_ClientOrder();
|
||||
@@ -274,7 +265,7 @@ class ServiceTest extends \BBTestCase
|
||||
return $serviceMock;
|
||||
});
|
||||
$this->service->setDi($di);
|
||||
|
||||
$this->expectException(\Exception::class);
|
||||
$result = $this->service->action_renew($order);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
@@ -502,11 +493,9 @@ class ServiceTest extends \BBTestCase
|
||||
$this->service->customCall($model, 'custom_call');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testCustomCallForbiddenMethodException()
|
||||
{
|
||||
$this->expectException(\Exception::class);
|
||||
$this->service->customCall(new \Model_ServiceCustom(), 'delete');
|
||||
}
|
||||
|
||||
@@ -534,9 +523,6 @@ class ServiceTest extends \BBTestCase
|
||||
$this->assertInstanceOf('Model_ServiceCustom', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testGetServiceCustomByOrderIdOrderServiceNotFoundException()
|
||||
{
|
||||
$dbMock = $this->getMockBuilder('\Box_Database')->getMock();
|
||||
@@ -555,7 +541,7 @@ class ServiceTest extends \BBTestCase
|
||||
return $orderService;
|
||||
});
|
||||
$this->service->setDi($di);
|
||||
|
||||
$this->expectException(\Exception::class);
|
||||
$this->service->getServiceCustomByOrderId(rand(1, 100));
|
||||
}
|
||||
|
||||
@@ -586,9 +572,6 @@ class ServiceTest extends \BBTestCase
|
||||
$this->assertNull($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testUpdateConfigNotArrayException()
|
||||
{
|
||||
$model = new \Model_ServiceCustom();
|
||||
@@ -612,6 +595,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
|
||||
$config = '';
|
||||
$this->expectException(\Exception::class);
|
||||
$serviceMock->updateConfig(rand(1, 100), $config);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ class Api_AdminTest extends \BBTestCase
|
||||
*/
|
||||
protected $adminApi = null;
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->adminApi = new \Box\Mod\Servicedomain\Api\Admin();
|
||||
}
|
||||
@@ -221,7 +221,7 @@ class Api_AdminTest extends \BBTestCase
|
||||
$data = array();
|
||||
$result = $this->adminApi->tld_get_list($data);
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testTld_get()
|
||||
@@ -246,13 +246,9 @@ class Api_AdminTest extends \BBTestCase
|
||||
);
|
||||
$result = $this->adminApi->tld_get($data);
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testTld_getTldNotFoundException()
|
||||
{
|
||||
$serviceMock = $this->getMockBuilder('\Box\Mod\Servicedomain\Service')->getMock();
|
||||
@@ -273,6 +269,7 @@ class Api_AdminTest extends \BBTestCase
|
||||
$data = array(
|
||||
'tld' => '.com'
|
||||
);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->adminApi->tld_get($data);
|
||||
}
|
||||
|
||||
@@ -298,12 +295,9 @@ class Api_AdminTest extends \BBTestCase
|
||||
);
|
||||
$result = $this->adminApi->tld_delete($data);
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testTld_deleteTldNotFoundException()
|
||||
{
|
||||
$serviceMock = $this->getMockBuilder('\Box\Mod\Servicedomain\Service')->getMock();
|
||||
@@ -324,6 +318,8 @@ class Api_AdminTest extends \BBTestCase
|
||||
$data = array(
|
||||
'tld' => '.com'
|
||||
);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->adminApi->tld_delete($data);
|
||||
}
|
||||
|
||||
@@ -354,12 +350,9 @@ class Api_AdminTest extends \BBTestCase
|
||||
);
|
||||
|
||||
$result = $this->adminApi->tld_create($data);
|
||||
$this->assertInternalType('integer', $result);
|
||||
$this->assertIsInt($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testTld_createAlreadyRegisteredException()
|
||||
{
|
||||
$serviceMock = $this->getMockBuilder('\Box\Mod\Servicedomain\Service')->getMock();
|
||||
@@ -379,8 +372,9 @@ class Api_AdminTest extends \BBTestCase
|
||||
'tld' => '.com'
|
||||
);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $this->adminApi->tld_create($data);
|
||||
$this->assertInternalType('integer', $result);
|
||||
$this->assertIsInt($result);
|
||||
}
|
||||
|
||||
|
||||
@@ -407,12 +401,9 @@ class Api_AdminTest extends \BBTestCase
|
||||
);
|
||||
$result = $this->adminApi->tld_update($data);
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testTld_updateTldNotFoundException()
|
||||
{
|
||||
$serviceMock = $this->getMockBuilder('\Box\Mod\Servicedomain\Service')->getMock();
|
||||
@@ -434,6 +425,8 @@ class Api_AdminTest extends \BBTestCase
|
||||
$data = array(
|
||||
'tld' => '.com'
|
||||
);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->adminApi->tld_update($data);
|
||||
}
|
||||
|
||||
@@ -468,7 +461,7 @@ class Api_AdminTest extends \BBTestCase
|
||||
$data = array();
|
||||
$result = $this->adminApi->registrar_get_list($data);
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testRegistrar_get_pairs()
|
||||
@@ -481,7 +474,7 @@ class Api_AdminTest extends \BBTestCase
|
||||
|
||||
$result = $this->adminApi->registrar_get_pairs(array());
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testRegistrar_get_available()
|
||||
@@ -494,7 +487,7 @@ class Api_AdminTest extends \BBTestCase
|
||||
|
||||
$result = $this->adminApi->registrar_get_available(array());
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testRegistrar_install()
|
||||
@@ -526,9 +519,6 @@ class Api_AdminTest extends \BBTestCase
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testRegistrar_installRegistrarNotAvailableException()
|
||||
{
|
||||
$registrars = array(
|
||||
@@ -552,6 +542,8 @@ class Api_AdminTest extends \BBTestCase
|
||||
$data = array(
|
||||
'code' => 'ResellerClub'
|
||||
);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $this->adminApi->registrar_install($data);
|
||||
|
||||
$this->assertTrue($result);
|
||||
@@ -590,9 +582,6 @@ class Api_AdminTest extends \BBTestCase
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testRegistrar_deleteIdNotSetException()
|
||||
{
|
||||
$registrar = new \Model_TldRegistrar();
|
||||
@@ -620,6 +609,7 @@ class Api_AdminTest extends \BBTestCase
|
||||
|
||||
$data = array();
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $this->adminApi->registrar_delete($data);
|
||||
|
||||
$this->assertTrue($result);
|
||||
@@ -658,9 +648,6 @@ class Api_AdminTest extends \BBTestCase
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testRegistrar_copyIdNotSetException()
|
||||
{
|
||||
$registrar = new \Model_TldRegistrar();
|
||||
@@ -688,6 +675,7 @@ class Api_AdminTest extends \BBTestCase
|
||||
|
||||
$data = array();
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $this->adminApi->registrar_copy($data);
|
||||
|
||||
$this->assertTrue($result);
|
||||
@@ -723,12 +711,9 @@ class Api_AdminTest extends \BBTestCase
|
||||
);
|
||||
$result = $this->adminApi->registrar_get($data);
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testRegistrar_getIdNotSetException()
|
||||
{
|
||||
$registrar = new \Model_TldRegistrar();
|
||||
@@ -756,9 +741,10 @@ class Api_AdminTest extends \BBTestCase
|
||||
|
||||
$data = array();
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $this->adminApi->registrar_get($data);
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testBatch_sync_expiration_dates()
|
||||
@@ -807,9 +793,6 @@ class Api_AdminTest extends \BBTestCase
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testRegistrar_updateIdNotSetException()
|
||||
{
|
||||
$registrar = new \Model_TldRegistrar();
|
||||
@@ -837,6 +820,7 @@ class Api_AdminTest extends \BBTestCase
|
||||
|
||||
$data = array();
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $this->adminApi->registrar_update($data);
|
||||
|
||||
$this->assertTrue($result);
|
||||
@@ -880,9 +864,6 @@ class Api_AdminTest extends \BBTestCase
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testGetServiceOrderIdMissingException()
|
||||
{
|
||||
$serviceMock = $this->getMockBuilder('\Box\Mod\Servicedomain\Service')->getMock();
|
||||
@@ -914,14 +895,13 @@ class Api_AdminTest extends \BBTestCase
|
||||
$this->adminApi->setDi($di);
|
||||
|
||||
$data = array();
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $this->adminApi->update($data);
|
||||
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testGetServiceOrderNotActivatedException()
|
||||
{
|
||||
$serviceMock = $this->getMockBuilder('\Box\Mod\Servicedomain\Service')->getMock();
|
||||
@@ -955,6 +935,8 @@ class Api_AdminTest extends \BBTestCase
|
||||
$data = array(
|
||||
'order_id' => rand(1, 100)
|
||||
);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $this->adminApi->update($data);
|
||||
|
||||
$this->assertTrue($result);
|
||||
|
||||
@@ -8,7 +8,7 @@ class Api_ClientTest extends \BBTestCase
|
||||
*/
|
||||
protected $clientApi = null;
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->clientApi = new \Box\Mod\Servicedomain\Api\Client();
|
||||
}
|
||||
@@ -215,9 +215,6 @@ class Api_ClientTest extends \BBTestCase
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testGetServiceOrderIdMissingException()
|
||||
{
|
||||
$serviceMock = $this->getMockBuilder('\Box\Mod\Servicedomain\Service')->getMock();
|
||||
@@ -243,14 +240,13 @@ class Api_ClientTest extends \BBTestCase
|
||||
$this->clientApi->setIdentity(new \Model_Client());
|
||||
|
||||
$data = array();
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $this->clientApi->lock($data);
|
||||
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testGetServiceOrderNotFoundException()
|
||||
{
|
||||
$serviceMock = $this->getMockBuilder('\Box\Mod\Servicedomain\Service')->getMock();
|
||||
@@ -278,14 +274,13 @@ class Api_ClientTest extends \BBTestCase
|
||||
$data = array(
|
||||
'order_id' => rand(1, 100)
|
||||
);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $this->clientApi->lock($data);
|
||||
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testGetServiceOrderNotActivatedException()
|
||||
{
|
||||
$serviceMock = $this->getMockBuilder('\Box\Mod\Servicedomain\Service')->getMock();
|
||||
@@ -313,6 +308,8 @@ class Api_ClientTest extends \BBTestCase
|
||||
$data = array(
|
||||
'order_id' => rand(1, 100)
|
||||
);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $this->clientApi->lock($data);
|
||||
|
||||
$this->assertTrue($result);
|
||||
|
||||
@@ -8,7 +8,7 @@ class Api_GuestTest extends \BBTestCase
|
||||
*/
|
||||
protected $guestApi = null;
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->guestApi = new \Box\Mod\Servicedomain\Api\Guest();
|
||||
}
|
||||
@@ -36,8 +36,8 @@ class Api_GuestTest extends \BBTestCase
|
||||
$this->guestApi->setDi($di);
|
||||
|
||||
$result = $this->guestApi->tlds(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertInternalType('array', $result[0]);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertIsArray($result[0]);
|
||||
}
|
||||
|
||||
public function testPricing()
|
||||
@@ -62,12 +62,9 @@ class Api_GuestTest extends \BBTestCase
|
||||
);
|
||||
|
||||
$result = $this->guestApi->pricing($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testPricingTldNotFoundException()
|
||||
{
|
||||
$serviceMock = $this->getMockBuilder('\Box\Mod\Servicedomain\Service')
|
||||
@@ -89,8 +86,9 @@ class Api_GuestTest extends \BBTestCase
|
||||
'tld' => '.com'
|
||||
);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $this->guestApi->pricing($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testCheck()
|
||||
@@ -121,9 +119,6 @@ class Api_GuestTest extends \BBTestCase
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testCheckSldNotValidException()
|
||||
{
|
||||
$validatorMock = $this->getMockBuilder('\Box_Validate')->getMock();
|
||||
@@ -142,12 +137,10 @@ class Api_GuestTest extends \BBTestCase
|
||||
'sld' => 'example'
|
||||
);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->guestApi->check($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testCheckTldNotFoundException()
|
||||
{
|
||||
$serviceMock = $this->getMockBuilder('\Box\Mod\Servicedomain\Service')
|
||||
@@ -175,12 +168,10 @@ class Api_GuestTest extends \BBTestCase
|
||||
'sld' => 'example'
|
||||
);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->guestApi->check($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testCheckDomainNotAvailableException()
|
||||
{
|
||||
$serviceMock = $this->getMockBuilder('\Box\Mod\Servicedomain\Service')
|
||||
@@ -208,6 +199,7 @@ class Api_GuestTest extends \BBTestCase
|
||||
'sld' => 'example'
|
||||
);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->guestApi->check($data);
|
||||
}
|
||||
|
||||
@@ -238,9 +230,6 @@ class Api_GuestTest extends \BBTestCase
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testCan_be_transferredTldNotFoundException()
|
||||
{
|
||||
$serviceMock = $this->getMockBuilder('\Box\Mod\Servicedomain\Service')
|
||||
@@ -262,12 +251,11 @@ class Api_GuestTest extends \BBTestCase
|
||||
'tld' => '.com',
|
||||
'sld' => 'example'
|
||||
);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->guestApi->can_be_transferred($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testCan_be_transferredCanNotBeTransferredException()
|
||||
{
|
||||
$serviceMock = $this->getMockBuilder('\Box\Mod\Servicedomain\Service')
|
||||
@@ -289,6 +277,8 @@ class Api_GuestTest extends \BBTestCase
|
||||
'tld' => '.com',
|
||||
'sld' => 'example'
|
||||
);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->guestApi->can_be_transferred($data);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ class ServiceTest extends \BBTestCase
|
||||
*/
|
||||
protected $service = null;
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->service = new \Box\Mod\Servicedomain\Service();
|
||||
}
|
||||
@@ -23,7 +23,7 @@ class ServiceTest extends \BBTestCase
|
||||
$this->assertEquals($di, $getDi);
|
||||
}
|
||||
|
||||
public function testGetCartProductTitleProvider()
|
||||
public function getCartProductTitleProvider()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
@@ -50,7 +50,7 @@ class ServiceTest extends \BBTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider testGetCartProductTitleProvider
|
||||
* @dataProvider getCartProductTitleProvider
|
||||
*/
|
||||
public function testGetCartProductTitle($data, $expected)
|
||||
{
|
||||
@@ -63,7 +63,7 @@ class ServiceTest extends \BBTestCase
|
||||
$this->assertEquals($result, $expected);
|
||||
}
|
||||
|
||||
public function testValidateOrderDataProvider()
|
||||
public function validateOrderDataProvider()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
@@ -101,7 +101,7 @@ class ServiceTest extends \BBTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider testValidateOrderDataProvider
|
||||
* @dataProvider validateOrderDataProvider
|
||||
*/
|
||||
public function testValidateOrderData($data, $finOneByTldCalled, $canBeTransferedCalled, $isDomainAvailableCalled)
|
||||
{
|
||||
@@ -132,7 +132,7 @@ class ServiceTest extends \BBTestCase
|
||||
$this->assertNull($result);
|
||||
}
|
||||
|
||||
public function testValidateOrderDataExceptionsProvider()
|
||||
public function validateOrderDataExceptionsProvider()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
@@ -144,9 +144,7 @@ class ServiceTest extends \BBTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider testValidateOrderDataExceptionsProvider
|
||||
*
|
||||
* @expectedException \Box_Exception
|
||||
* @dataProvider validateOrderDataExceptionsProvider
|
||||
*/
|
||||
public function testValidateOrderDataExceptions($data)
|
||||
{
|
||||
@@ -156,11 +154,12 @@ class ServiceTest extends \BBTestCase
|
||||
$di['validator'] = $validatorMock;
|
||||
$this->service->setDi($di);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $this->service->validateOrderData($data);
|
||||
$this->assertNull($result);
|
||||
}
|
||||
|
||||
public function testValidateOrderDateOwndomainExceptionsProvider()
|
||||
public function validateOrderDateOwndomainExceptionsProvider()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
@@ -185,9 +184,7 @@ class ServiceTest extends \BBTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider testValidateOrderDateOwndomainExceptionsProvider
|
||||
*
|
||||
* @expectedException \Box_Exception
|
||||
* @dataProvider validateOrderDateOwndomainExceptionsProvider
|
||||
*/
|
||||
public function testValidateOrderDateOwndomainOwndomain($data, $isSldValidCalled, $isSldValidReturn)
|
||||
{
|
||||
@@ -202,12 +199,13 @@ class ServiceTest extends \BBTestCase
|
||||
$di['validator'] = $validatorMock;
|
||||
$this->service->setDi($di);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $this->service->validateOrderData($data);
|
||||
$this->assertNull($result);
|
||||
}
|
||||
|
||||
|
||||
public function testValidateOrderDateTransferExceptionsProvider()
|
||||
public function validateOrderDateTransferExceptionsProvider()
|
||||
{
|
||||
$tldModel = new \Model_Tld();
|
||||
$tldModel->loadBean(new \RedBeanPHP\OODBBean());
|
||||
@@ -256,9 +254,7 @@ class ServiceTest extends \BBTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider testValidateOrderDateTransferExceptionsProvider
|
||||
*
|
||||
* @expectedException \Box_Exception
|
||||
* @dataProvider validateOrderDateTransferExceptionsProvider
|
||||
*/
|
||||
public function testValidateOrderDateTransferExceptions($data, $isSldValidArr, $tldFindOneByTldArr, $canBeTransfered)
|
||||
{
|
||||
@@ -279,11 +275,12 @@ class ServiceTest extends \BBTestCase
|
||||
$di['validator'] = $validatorMock;
|
||||
$serviceMock->setDi($di);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $serviceMock->validateOrderData($data);
|
||||
$this->assertNull($result);
|
||||
}
|
||||
|
||||
public function testValidateOrderDateRegisterExceptionsProvider()
|
||||
public function validateOrderDateRegisterExceptionsProvider()
|
||||
{
|
||||
$tldModel = new \Model_Tld();
|
||||
$tldModel->loadBean(new \RedBeanPHP\OODBBean());
|
||||
@@ -355,9 +352,7 @@ class ServiceTest extends \BBTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider testValidateOrderDateRegisterExceptionsProvider
|
||||
*
|
||||
* @expectedException \Box_Exception
|
||||
* @dataProvider validateOrderDateRegisterExceptionsProvider
|
||||
*/
|
||||
public function testValidateOrderDateRegisterExceptions($data, $isSldValidArr, $tldFindOneByTldArr, $canBeTransfered)
|
||||
{
|
||||
@@ -378,6 +373,7 @@ class ServiceTest extends \BBTestCase
|
||||
$di['validator'] = $validatorMock;
|
||||
$serviceMock->setDi($di);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $serviceMock->validateOrderData($data);
|
||||
$this->assertNull($result);
|
||||
}
|
||||
@@ -467,9 +463,6 @@ class ServiceTest extends \BBTestCase
|
||||
$this->assertInstanceOf('Model_ServiceDomain', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testActionCreateNameserversException()
|
||||
{
|
||||
$tldModel = new \Model_Tld();
|
||||
@@ -511,10 +504,11 @@ class ServiceTest extends \BBTestCase
|
||||
$order = new \Model_ClientOrder();
|
||||
$order->loadBean(new \RedBeanPHP\OODBBean());
|
||||
$order->client_id = rand(1, 100);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$serviceMock->action_create($order);
|
||||
}
|
||||
|
||||
public function testActionActivateProvider()
|
||||
public function actionActivateProvider()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
@@ -531,7 +525,7 @@ class ServiceTest extends \BBTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider testActionActivateProvider
|
||||
* @dataProvider actionActivateProvider
|
||||
*/
|
||||
public function testActionActivate($action, $registerDomainCalled, $transferDomainCalled)
|
||||
{
|
||||
@@ -582,9 +576,6 @@ class ServiceTest extends \BBTestCase
|
||||
$this->assertInstanceOf('Model_ServiceDomain', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testActionActivateServiceNotFoundException()
|
||||
{
|
||||
$orderServiceMock = $this->getMockBuilder('\Box\Mod\Order\Service')
|
||||
@@ -601,6 +592,8 @@ class ServiceTest extends \BBTestCase
|
||||
$order = new \Model_ClientOrder();
|
||||
$order->loadBean(new \RedBeanPHP\OODBBean());
|
||||
$order->client_id = rand(1, 100);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->service->action_activate($order);
|
||||
}
|
||||
|
||||
@@ -660,9 +653,6 @@ class ServiceTest extends \BBTestCase
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testActionRenewServiceNotFoundException()
|
||||
{
|
||||
$orderServiceMock = $this->getMockBuilder('\Box\Mod\Order\Service')
|
||||
@@ -680,6 +670,8 @@ class ServiceTest extends \BBTestCase
|
||||
$order->loadBean(new \RedBeanPHP\OODBBean());
|
||||
$order->id = rand(1, 100);
|
||||
$order->client_id = rand(1, 100);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $this->service->action_renew($order);
|
||||
|
||||
$this->assertTrue($result);
|
||||
@@ -742,9 +734,6 @@ class ServiceTest extends \BBTestCase
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testActionCancelServiceNotFoundException()
|
||||
{
|
||||
$orderServiceMock = $this->getMockBuilder('\Box\Mod\Order\Service')
|
||||
@@ -762,6 +751,8 @@ class ServiceTest extends \BBTestCase
|
||||
$order->loadBean(new \RedBeanPHP\OODBBean());
|
||||
$order->id = rand(1, 100);
|
||||
$order->client_id = rand(1, 100);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $this->service->action_cancel($order);
|
||||
|
||||
$this->assertTrue($result);
|
||||
@@ -866,7 +857,7 @@ class ServiceTest extends \BBTestCase
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
public function testUpdateNameserversExceptionProvider()
|
||||
public function updateNameserversExceptionProvider()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
@@ -879,13 +870,14 @@ class ServiceTest extends \BBTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider testUpdateNameserversExceptionProvider
|
||||
* @expectedException \Box_Exception
|
||||
* @dataProvider updateNameserversExceptionProvider
|
||||
*/
|
||||
public function testUpdateNameserversException($data)
|
||||
{
|
||||
$serviceDomainModel = new \Model_ServiceDomain();
|
||||
$serviceDomainModel->loadBean(new \RedBeanPHP\OODBBean());
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->service->updateNameservers($serviceDomainModel, $data);
|
||||
}
|
||||
|
||||
@@ -958,7 +950,7 @@ class ServiceTest extends \BBTestCase
|
||||
$serviceDomainModel->loadBean(new \RedBeanPHP\OODBBean());
|
||||
$result = $serviceMock->getTransferCode($serviceDomainModel);
|
||||
|
||||
$this->assertInternalType('string', $epp);
|
||||
$this->assertIsString($epp);
|
||||
$this->assertEquals($result, $epp);
|
||||
}
|
||||
|
||||
@@ -1115,23 +1107,19 @@ class ServiceTest extends \BBTestCase
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testCanBeTransferedEmptySldException()
|
||||
{
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->service->canBeTransfered(new \Model_Tld(), '');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testCanBeTransferedNotAllowedException()
|
||||
{
|
||||
$tldModel = new \Model_Tld();
|
||||
$tldModel->loadBean(new \RedBeanPHP\OODBBean());
|
||||
$tldModel->allow_transfer = false;
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->service->canBeTransfered($tldModel, 'example');
|
||||
}
|
||||
|
||||
@@ -1176,19 +1164,14 @@ class ServiceTest extends \BBTestCase
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testIsDomainAvailableEmptySldException()
|
||||
{
|
||||
$tldModel = new \Model_Tld();
|
||||
$tldModel->loadBean(new \RedBeanPHP\OODBBean());
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->service->isDomainAvailable($tldModel, '');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testIsDomainAvailableSldNotValidException()
|
||||
{
|
||||
$validatorMock = $this->getMockBuilder('\Box_Validate')->getMock();
|
||||
@@ -1201,12 +1184,10 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$tldModel = new \Model_Tld();
|
||||
$tldModel->loadBean(new \RedBeanPHP\OODBBean());
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->service->isDomainAvailable($tldModel, 'example');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testIsDomainAvailableSldNotAllowedToRegisterException()
|
||||
{
|
||||
$validatorMock = $this->getMockBuilder('\Box_Validate')->getMock();
|
||||
@@ -1221,6 +1202,7 @@ class ServiceTest extends \BBTestCase
|
||||
$model->loadBean(new \RedBeanPHP\OODBBean());
|
||||
$model->allow_register = false;
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->service->isDomainAvailable($model, 'example');
|
||||
}
|
||||
|
||||
@@ -1233,7 +1215,7 @@ class ServiceTest extends \BBTestCase
|
||||
$this->assertNull($result);
|
||||
}
|
||||
|
||||
public function testToApiArrayProvider()
|
||||
public function toApiArrayProvider()
|
||||
{
|
||||
$model = new \Model_Admin();
|
||||
$model->loadBean(new \RedBeanPHP\OODBBean());
|
||||
@@ -1251,7 +1233,7 @@ class ServiceTest extends \BBTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider testToApiArrayProvider
|
||||
* @dataProvider toApiArrayProvider
|
||||
*/
|
||||
public function testToApiArray($identity, $dbLoadCalled)
|
||||
{
|
||||
@@ -1300,7 +1282,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$result = $this->service->toApiArray($model, true, $identity);
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
|
||||
$this->assertArrayHasKey('domain', $result);
|
||||
$this->assertArrayHasKey('sld', $result);
|
||||
@@ -1317,7 +1299,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$this->assertArrayHasKey('contact', $result);
|
||||
$contact = $result['contact'];
|
||||
$this->assertInternalType('array', $contact);
|
||||
$this->assertIsArray($contact);
|
||||
$this->assertArrayHasKey('first_name', $contact);
|
||||
$this->assertArrayHasKey('last_name', $contact);
|
||||
$this->assertArrayHasKey('email', $contact);
|
||||
@@ -1454,7 +1436,7 @@ class ServiceTest extends \BBTestCase
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
public function testTldGetSearchQueryProvider()
|
||||
public function tldGetSearchQueryProvider()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
@@ -1497,7 +1479,7 @@ class ServiceTest extends \BBTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider testTldGetSearchQueryProvider
|
||||
* @dataProvider tldGetSearchQueryProvider
|
||||
*/
|
||||
public function testTldGetSearchQuery($data, $expectedQuery, $expectedBindings)
|
||||
{
|
||||
@@ -1510,7 +1492,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$this->assertEquals($query, $expectedQuery);
|
||||
|
||||
$this->assertInternalType('array', $bindings);
|
||||
$this->assertIsArray($bindings);
|
||||
$this->assertEquals($bindings, $expectedBindings);
|
||||
|
||||
}
|
||||
@@ -1528,7 +1510,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$result = $this->service->tldFindAllActive();
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testTldFindOneActiveById()
|
||||
@@ -1565,7 +1547,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$result = $this->service->tldGetPairs();
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertEquals($result, $returns);
|
||||
}
|
||||
|
||||
@@ -1653,7 +1635,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
|
||||
$result = $this->service->tldToApiArray($model);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
|
||||
$this->assertArrayHasKey('tld', $result);
|
||||
$this->assertArrayHasKey('price_registration', $result);
|
||||
@@ -1666,7 +1648,7 @@ class ServiceTest extends \BBTestCase
|
||||
$this->assertArrayHasKey('registrar', $result);
|
||||
|
||||
$registrar = $result['registrar'];
|
||||
$this->assertInternalType('array', $registrar);
|
||||
$this->assertIsArray($registrar);
|
||||
$this->assertArrayHasKey('id', $registrar);
|
||||
$this->assertArrayHasKey('title', $registrar);
|
||||
|
||||
@@ -1707,7 +1689,7 @@ class ServiceTest extends \BBTestCase
|
||||
list($query, $bindings) = $this->service->registrarGetSearchQuery(array());
|
||||
|
||||
$this->assertEquals('SELECT * FROM tld_registrar ORDER BY name ASC', $query);
|
||||
$this->assertInternalType('array', $bindings);
|
||||
$this->assertIsArray($bindings);
|
||||
$this->assertEquals(array(), $bindings);
|
||||
}
|
||||
|
||||
@@ -1727,7 +1709,7 @@ class ServiceTest extends \BBTestCase
|
||||
$this->service->setDi($di);
|
||||
|
||||
$result = $this->service->registrarGetAvailable();
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testRegistrarGetPairs()
|
||||
@@ -1749,7 +1731,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$result = $this->service->registrarGetPairs();
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertEquals(count($result), 3);
|
||||
|
||||
}
|
||||
@@ -1795,7 +1777,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$result = $this->service->registrarGetConfiguration($model);
|
||||
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertEquals($result, $config);
|
||||
}
|
||||
|
||||
@@ -1806,31 +1788,27 @@ class ServiceTest extends \BBTestCase
|
||||
$model->registrar = 'Custom';
|
||||
|
||||
$result = $this->service->registrarGetRegistrarAdapterConfig($model);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testRegistrarGetRegistrarAdapterConfigClassNotExistsException()
|
||||
{
|
||||
$model = new \Model_TldRegistrar();
|
||||
$model->loadBean(new \RedBeanPHP\OODBBean());
|
||||
$model->registrar = 'Non-Existing';
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $this->service->registrarGetRegistrarAdapterConfig($model);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testRegistrarGetRegistrarAdapterConfigRegistrarNotExistException()
|
||||
{
|
||||
$model = new \Model_TldRegistrar();
|
||||
$model->loadBean(new \RedBeanPHP\OODBBean());
|
||||
$model->registrar = 'Non-Existing';
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->service->registrarGetRegistrarAdapterConfig($model);
|
||||
}
|
||||
|
||||
@@ -1850,9 +1828,6 @@ class ServiceTest extends \BBTestCase
|
||||
$this->assertInstanceOf('Registrar_Adapter_' . $model->registrar, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testRegistrarGetRegistrarAdapterNotFoundException()
|
||||
{
|
||||
$serviceMock = $this->getMockBuilder('\Box\Mod\Servicedomain\Service')
|
||||
@@ -1864,8 +1839,8 @@ class ServiceTest extends \BBTestCase
|
||||
$model->loadBean(new \RedBeanPHP\OODBBean());
|
||||
$model->registrar = 'Non-Existing';
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$result = $serviceMock->registrarGetRegistrarAdapter($model);
|
||||
|
||||
$this->assertInstanceOf('Registrar_Adapter_' . $model->registrar, $result);
|
||||
}
|
||||
|
||||
@@ -1894,9 +1869,6 @@ class ServiceTest extends \BBTestCase
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Box_Exception
|
||||
*/
|
||||
public function testRegistrarRmHasDomainsException()
|
||||
{
|
||||
$serviceDomainModel = new \Model_ServiceDomain();
|
||||
@@ -1917,6 +1889,7 @@ class ServiceTest extends \BBTestCase
|
||||
$model->loadBean(new \RedBeanPHP\OODBBean());
|
||||
$model->id = rand(1, 100);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->service->registrarRm($model);
|
||||
|
||||
}
|
||||
@@ -1979,7 +1952,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$result = $this->service->tldCreate($data);
|
||||
|
||||
$this->assertInternalType('integer', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($result, $randId);
|
||||
|
||||
}
|
||||
@@ -2075,7 +2048,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$result = $this->service->registrarCopy($model);
|
||||
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($newId, $result);
|
||||
}
|
||||
|
||||
@@ -2146,4 +2119,4 @@ class ServiceTest extends \BBTestCase
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ class AdminTest extends \BBTestCase
|
||||
*/
|
||||
protected $api = null;
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->api = new \Box\Mod\Servicedownloadable\Api\Admin();
|
||||
}
|
||||
@@ -44,7 +44,8 @@ class AdminTest extends \BBTestCase
|
||||
$di['validator'] = $validatorMock;
|
||||
|
||||
$this->api->setDi($di);
|
||||
$this->setExpectedException('\Box_Exception', 'File was not uploaded');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('File was not uploaded');
|
||||
$this->api->upload($data);
|
||||
}
|
||||
|
||||
@@ -76,7 +77,7 @@ class AdminTest extends \BBTestCase
|
||||
$this->api->setDi($di);
|
||||
$this->api->setService($serviceMock);
|
||||
$result = $this->api->upload($data);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -104,7 +105,8 @@ class AdminTest extends \BBTestCase
|
||||
$di['validator'] = $validatorMock;
|
||||
|
||||
$this->api->setDi($di);
|
||||
$this->setExpectedException('\Box_Exception', 'Order is not activated');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Order is not activated');
|
||||
$this->api->update($data);
|
||||
}
|
||||
|
||||
@@ -142,7 +144,7 @@ class AdminTest extends \BBTestCase
|
||||
$this->api->setDi($di);
|
||||
$this->api->setService($serviceMock);
|
||||
$result = $this->api->update($data);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ class ClientTest extends \BBTestCase {
|
||||
*/
|
||||
protected $api = null;
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->api= new \Box\Mod\Servicedownloadable\Api\Client();
|
||||
}
|
||||
@@ -27,7 +27,8 @@ class ClientTest extends \BBTestCase {
|
||||
{
|
||||
$data = array();
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Order id is required');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Order id is required');
|
||||
$this->api->send_file($data);
|
||||
}
|
||||
|
||||
@@ -50,7 +51,8 @@ class ClientTest extends \BBTestCase {
|
||||
$this->api->setIdentity($modelClient);
|
||||
$this->api->setDi($di);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Order not found');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Order not found');
|
||||
$this->api->send_file($data);
|
||||
}
|
||||
|
||||
@@ -79,7 +81,8 @@ class ClientTest extends \BBTestCase {
|
||||
$this->api->setDi($di);
|
||||
$this->api->setIdentity($modelClient);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Order is not activated');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Order is not activated');
|
||||
$this->api->send_file($data);
|
||||
}
|
||||
|
||||
@@ -116,7 +119,7 @@ class ClientTest extends \BBTestCase {
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->send_file($data);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ class ServiceTest extends \BBTestCase
|
||||
*/
|
||||
protected $service = null;
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->service = new \Box\Mod\Servicedownloadable\Service();
|
||||
}
|
||||
@@ -43,7 +43,7 @@ class ServiceTest extends \BBTestCase
|
||||
$di['validator'] = $validatorMock;
|
||||
$this->service->setDi($di);
|
||||
$result = $this->service->attachOrderConfig($productModel, $data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$this->service->setDi($di);
|
||||
$result = $this->service->toApiArray($model, null, new \Model_Admin());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
@@ -159,7 +159,8 @@ class ServiceTest extends \BBTestCase
|
||||
$di['request'] = $requestMock;
|
||||
$this->service->setDi($di);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Error uploading file');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Error uploading file');
|
||||
$this->service->uploadProductFile($productModel);
|
||||
|
||||
}
|
||||
@@ -202,7 +203,7 @@ class ServiceTest extends \BBTestCase
|
||||
$this->service->setDi($di);
|
||||
|
||||
$result = $this->service->uploadProductFile($productModel);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -246,7 +247,7 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$this->service->setDi($di);
|
||||
$result = $this->service->updateProductFile($serviceDownloadableModel, $orderModel);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -267,7 +268,8 @@ class ServiceTest extends \BBTestCase
|
||||
$di['request'] = $requestMock;
|
||||
$this->service->setDi($di);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Error uploading file');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Error uploading file');
|
||||
$this->service->updateProductFile($serviceDownloadableModel, $orderModel);
|
||||
}
|
||||
|
||||
@@ -303,7 +305,7 @@ class ServiceTest extends \BBTestCase
|
||||
$this->service->setDi($di);
|
||||
|
||||
$result = $this->service->sendFile($serviceDownloadableModel);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -332,7 +334,9 @@ class ServiceTest extends \BBTestCase
|
||||
|
||||
$this->service->setDi($di);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'File can not be downloaded at the moment. Please contact support', 404);
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionCode(404);
|
||||
$this->expectExceptionMessage('File can not be downloaded at the moment. Please contact support');
|
||||
$this->service->sendFile($serviceDownloadableModel);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ class AdminTest extends \BBTestCase
|
||||
*/
|
||||
protected $api = null;
|
||||
|
||||
public function setup()
|
||||
public function setup(): void
|
||||
{
|
||||
$this->api = new \Box\Mod\Servicehosting\Api\Admin();
|
||||
}
|
||||
@@ -57,7 +57,7 @@ class AdminTest extends \BBTestCase
|
||||
$apiMock->setService($serviceMock);
|
||||
|
||||
$result = $apiMock->change_plan($data);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -65,7 +65,8 @@ class AdminTest extends \BBTestCase
|
||||
{
|
||||
$data = array();
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'plan_id is missing');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('plan_id is missing');
|
||||
$this->api->change_plan($data);
|
||||
}
|
||||
|
||||
@@ -88,7 +89,7 @@ class AdminTest extends \BBTestCase
|
||||
$apiMock->setService($serviceMock);
|
||||
|
||||
$result = $apiMock->change_username(array());
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -111,7 +112,7 @@ class AdminTest extends \BBTestCase
|
||||
$apiMock->setService($serviceMock);
|
||||
|
||||
$result = $apiMock->change_ip(array());
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -134,7 +135,7 @@ class AdminTest extends \BBTestCase
|
||||
$apiMock->setService($serviceMock);
|
||||
|
||||
$result = $apiMock->change_domain(array());
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -157,7 +158,7 @@ class AdminTest extends \BBTestCase
|
||||
$apiMock->setService($serviceMock);
|
||||
|
||||
$result = $apiMock->change_password(array());
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -180,7 +181,7 @@ class AdminTest extends \BBTestCase
|
||||
$apiMock->setService($serviceMock);
|
||||
|
||||
$result = $apiMock->sync(array());
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -203,7 +204,7 @@ class AdminTest extends \BBTestCase
|
||||
$apiMock->setService($serviceMock);
|
||||
|
||||
$result = $apiMock->update(array());
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -217,7 +218,7 @@ class AdminTest extends \BBTestCase
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->manager_get_pairs(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testserver_get_pairs()
|
||||
@@ -230,7 +231,7 @@ class AdminTest extends \BBTestCase
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->server_get_pairs(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testserver_get_list()
|
||||
@@ -261,7 +262,7 @@ class AdminTest extends \BBTestCase
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->server_get_list(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testserver_create()
|
||||
@@ -291,7 +292,7 @@ class AdminTest extends \BBTestCase
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->server_create($data);
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($newServerId, $result);
|
||||
}
|
||||
|
||||
@@ -322,7 +323,7 @@ class AdminTest extends \BBTestCase
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->server_get($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testserver_delete()
|
||||
@@ -353,7 +354,7 @@ class AdminTest extends \BBTestCase
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->server_delete($data);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -383,7 +384,7 @@ class AdminTest extends \BBTestCase
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->server_update($data);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -413,7 +414,7 @@ class AdminTest extends \BBTestCase
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->server_test_connection($data);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -426,7 +427,7 @@ class AdminTest extends \BBTestCase
|
||||
|
||||
$this->api->setService($serviceMock);
|
||||
$result = $this->api->hp_get_pairs(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testhp_get_list()
|
||||
@@ -452,7 +453,7 @@ class AdminTest extends \BBTestCase
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->hp_get_list(array());
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testhp_delete()
|
||||
@@ -485,7 +486,7 @@ class AdminTest extends \BBTestCase
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->hp_delete($data);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -520,7 +521,7 @@ class AdminTest extends \BBTestCase
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->hp_get($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
}
|
||||
|
||||
public function testhp_update()
|
||||
@@ -554,7 +555,7 @@ class AdminTest extends \BBTestCase
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->hp_update($data);
|
||||
$this->assertInternalType('bool', $result);
|
||||
$this->assertIsBool($result);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
@@ -584,7 +585,7 @@ class AdminTest extends \BBTestCase
|
||||
$this->api->setService($serviceMock);
|
||||
|
||||
$result = $this->api->hp_create($data);
|
||||
$this->assertInternalType('int', $result);
|
||||
$this->assertIsInt($result);
|
||||
$this->assertEquals($newHpId, $result);
|
||||
}
|
||||
|
||||
@@ -619,7 +620,7 @@ class AdminTest extends \BBTestCase
|
||||
$this->api->setDi($di);
|
||||
|
||||
$result = $this->api->_getService($data);
|
||||
$this->assertInternalType('array', $result);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertInstanceOf('\Model_ClientOrder', $result[0]);
|
||||
$this->assertInstanceOf('\Model_ServiceHosting', $result[1]);
|
||||
}
|
||||
@@ -655,7 +656,8 @@ class AdminTest extends \BBTestCase
|
||||
|
||||
$this->api->setDi($di);
|
||||
|
||||
$this->setExpectedException('\Box_Exception', 'Order is not activated');
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Order is not activated');
|
||||
$this->api->_getService($data);
|
||||
}
|
||||
|
||||
|
||||
Loaded 100 of 211 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user