From 8a1718c6065a418754bf46cf5fb5cf70ac75bc0d Mon Sep 17 00:00:00 2001 From: samapraku Date: Tue, 18 Aug 2020 21:12:03 +0200 Subject: [PATCH] Upgrade tests to PHPUnit 9 --- phpunit.xml.dist | 66 +- src/bb-modules/Email/Service.php | 14 +- src/composer.json | 3 +- src/composer.lock | 1329 +++++++++++------ .../{ConfigTest.php => Box_ConfigTest.php} | 2 +- .../Box/{CryptTest.php => Box_CryptTest.php} | 2 +- ...nagerTest.php => Box_EventManagerTest.php} | 6 +- ...xceptionTest.php => Box_ExceptionTest.php} | 4 +- tests/bb-library/Box/Box_LicenseTest.php | 20 + .../Box/{LogTest.php => Box_LogTest.php} | 4 +- .../Box/{MailTest.php => Box_MailTest.php} | 18 +- .../Box/{ModTest.php => Box_ModTest.php} | 14 +- tests/bb-library/Box/Box_PasswordTest.php | 12 +- .../{PeriodTest.php => Box_PeriodTest.php} | 16 +- .../{RequestTest.php => Box_RequestTest.php} | 186 +-- .../{SessionTest.php => Box_SessionTest.php} | 2 +- ...ranslateTest.php => Box_TranslateTest.php} | 2 +- ...gLoaderTest.php => Box_TwigLoaderTest.php} | 18 +- ...{ValidateTest.php => Box_ValidateTest.php} | 73 +- tests/bb-library/Box/LicenseTest.php | 19 - .../Payment_Adapter_ClientBalanceTest.php | 29 +- .../Payment_Adapter_InterkassaTest.php | 24 +- .../Adapter/Payment_Adapter_PayPalTest.php | 9 +- .../Adapter/Payment_Adapter_StripeTest.php | 18 +- ...=> Registrar_Adapter_ResellerclubTest.php} | 26 +- tests/bb-library/bootstrap.php | 4 +- .../Activity/Controller/AdminTest.php | 2 +- tests/bb-modules/Activity/ServiceTest.php | 8 +- tests/bb-modules/Api/ServiceTest.php | 6 +- tests/bb-modules/Branding/ServiceTest.php | 6 +- tests/bb-modules/Cart/Api/AdminTest.php | 6 +- tests/bb-modules/Cart/Api/ClientTest.php | 4 +- tests/bb-modules/Cart/Api/GuestTest.php | 35 +- tests/bb-modules/Cart/ServiceTest.php | 59 +- tests/bb-modules/Client/Api/AdminTest.php | 36 +- tests/bb-modules/Client/Api/ClientTest.php | 9 +- tests/bb-modules/Client/Api/GuestTest.php | 23 +- .../bb-modules/Client/ServiceBalanceTest.php | 6 +- tests/bb-modules/Client/ServiceTest.php | 105 +- tests/bb-modules/Cron/Api/AdminTest.php | 4 +- tests/bb-modules/Cron/Api/GuestTest.php | 6 +- tests/bb-modules/Cron/ServiceTest.php | 6 +- .../bb-modules/Currency/Api/Api_AdminTest.php | 34 +- .../bb-modules/Currency/Api/Api_GuestTest.php | 23 +- tests/bb-modules/Currency/ServiceTest.php | 80 +- tests/bb-modules/Email/Api/Api_AdminTest.php | 45 +- tests/bb-modules/Email/Api/Api_ClientTest.php | 32 +- tests/bb-modules/Email/ServiceTest.php | 108 +- tests/bb-modules/Example/Api/AdminTest.php | 4 +- tests/bb-modules/Example/Api/ClientTest.php | 4 +- tests/bb-modules/Example/Api/GuestTest.php | 6 +- .../Example/Controller/AdminTest.php | 4 +- tests/bb-modules/Example/ServiceTest.php | 4 +- tests/bb-modules/Extension/Api/AdminTest.php | 28 +- tests/bb-modules/Extension/Api/GuestTest.php | 11 +- tests/bb-modules/Extension/ServiceTest.php | 77 +- .../Filemanager/Api/Api_AdminTest.php | 6 +- .../Filemanager/Controller/AdminTest.php | 12 +- tests/bb-modules/Filemanager/ServiceTest.php | 25 +- .../bb-modules/Formbuilder/Api/AdminTest.php | 46 +- .../bb-modules/Formbuilder/Api/GuestTest.php | 4 +- tests/bb-modules/Formbuilder/ServiceTest.php | 39 +- tests/bb-modules/Hook/Api/AdminTest.php | 6 +- tests/bb-modules/Hook/ServiceTest.php | 6 +- tests/bb-modules/Invoice/Api/AdminTest.php | 104 +- tests/bb-modules/Invoice/Api/ClientTest.php | 29 +- tests/bb-modules/Invoice/Api/GuestTest.php | 27 +- .../Invoice/ServiceInvoiceItemTest.php | 19 +- .../Invoice/ServicePayGatewayTest.php | 54 +- .../Invoice/ServiceSubscriptionTest.php | 22 +- tests/bb-modules/Invoice/ServiceTaxTest.php | 26 +- tests/bb-modules/Invoice/ServiceTest.php | 87 +- .../Invoice/ServiceTransactionTest.php | 40 +- tests/bb-modules/Kb/Api/Api_AdminTest.php | 74 +- tests/bb-modules/Kb/Api/Api_GuestTest.php | 59 +- tests/bb-modules/Kb/ServiceTest.php | 44 +- tests/bb-modules/Order/Api/Api_AdminTest.php | 43 +- tests/bb-modules/Order/Api/Api_ClientTest.php | 30 +- tests/bb-modules/Order/ServiceTest.php | 46 +- tests/bb-modules/Page/Api/AdminTest.php | 4 +- tests/bb-modules/Page/ServiceTest.php | 2 +- tests/bb-modules/Paidsupport/ServiceTest.php | 9 +- tests/bb-modules/Product/Api/AdminTest.php | 64 +- tests/bb-modules/Product/Api/GuestTest.php | 30 +- tests/bb-modules/Product/ServiceTest.php | 78 +- tests/bb-modules/Profile/Api/AdminTest.php | 22 +- tests/bb-modules/Profile/Api/ClientTest.php | 9 +- tests/bb-modules/Profile/ServiceTest.php | 15 +- .../Serviceboxbillinglicense/ServiceTest.php | 6 +- .../Servicecustom/Api/Api_AdminTest.php | 19 +- .../Servicecustom/Api/Api_ClientTest.php | 14 +- .../bb-modules/Servicecustom/ServiceTest.php | 34 +- .../Servicedomain/Api/Api_AdminTest.php | 74 +- .../Servicedomain/Api/Api_ClientTest.php | 17 +- .../Servicedomain/Api/Api_GuestTest.php | 36 +- .../bb-modules/Servicedomain/ServiceTest.php | 147 +- .../Servicedownloadable/Api/AdminTest.php | 12 +- .../Servicedownloadable/Api/ClientTest.php | 13 +- .../Servicedownloadable/ServiceTest.php | 22 +- .../Servicehosting/Api/AdminTest.php | 52 +- .../Servicehosting/Api/ClientTest.php | 21 +- .../Servicehosting/Api/GuestTest.php | 7 +- .../bb-modules/Servicehosting/ServiceTest.php | 83 +- .../Servicelicense/Api/AdminTest.php | 11 +- .../Servicelicense/Api/ClientTest.php | 7 +- .../Servicelicense/Api/GuestTest.php | 4 +- .../bb-modules/Servicelicense/ServiceTest.php | 46 +- .../bb-modules/Servicesolusvm/SolusVMTest.php | 2 +- .../bb-modules/Spamchecker/Api/GuestTest.php | 2 +- tests/bb-modules/Spamchecker/ServiceTest.php | 11 +- tests/bb-modules/Staff/Api/AdminTest.php | 37 +- tests/bb-modules/Staff/Api/GuestTest.php | 14 +- tests/bb-modules/Staff/ServiceTest.php | 57 +- tests/bb-modules/Stats/Api/AdminTest.php | 30 +- tests/bb-modules/Stats/ServiceTest.php | 24 +- .../bb-modules/Support/Api/Api_AdminTest.php | 44 +- .../bb-modules/Support/Api/Api_ClientTest.php | 22 +- .../bb-modules/Support/Api/Api_GuestTest.php | 19 +- tests/bb-modules/Support/ServiceTest.php | 208 ++- tests/bb-modules/System/Api/AdminTest.php | 22 +- tests/bb-modules/System/Api/GuestTest.php | 32 +- tests/bb-modules/System/ServiceTest.php | 79 +- tests/bb-modules/Theme/Api/AdminTest.php | 10 +- tests/bb-modules/Theme/Model/ThemeTest.php | 29 +- tests/bb-modules/Theme/ServiceTest.php | 31 +- tests/bootstrap.php | 12 +- tests/includes/ApiTestCase.php | 4 +- tests/includes/BBDatabaseTestCase.php | 4 +- tests/includes/BBDbApiTestCase.php | 4 +- tests/includes/BBModTestCase.php | 2 +- tests/includes/BBTestCase.php | 4 +- tests/includes/FakeTemplateWrapper.php | 40 + .../bb-library/Api/HandlerTest.php | 20 +- .../bb-library/Box/DatabaseTest.php | 47 +- tests/integration/bb-library/Box/DiTest.php | 6 +- tests/integration/bb-library/Box/LogTest.php | 8 +- tests/integration/bb-library/Box/ModTest.php | 2 +- .../bb-library/Payment/Adapter/CustomTest.php | 1 + .../Payment/Adapter/PayPalEmailTest.php | 6 +- .../bb-modules/mod_activity/Api_AdminTest.php | 11 +- .../bb-modules/mod_api/ServiceTest.php | 6 +- .../bb-modules/mod_branding/ServiceTest.php | 13 +- .../bb-modules/mod_cart/Api_AdminTest.php | 8 +- .../bb-modules/mod_cart/Api_ClientTest.php | 4 +- .../bb-modules/mod_cart/Api_GuestTest.php | 22 +- .../bb-modules/mod_client/Api_AdminTest.php | 38 +- .../bb-modules/mod_client/Api_ClientTest.php | 14 +- .../bb-modules/mod_client/Api_GuestTest.php | 8 +- .../bb-modules/mod_client/ServiceTest.php | 4 +- .../bb-modules/mod_cron/Api_AdminTest.php | 4 +- .../bb-modules/mod_currency/Api_AdminTest.php | 12 +- .../bb-modules/mod_currency/Api_GuestTest.php | 8 +- .../bb-modules/mod_email/Api_AdminTest.php | 18 +- .../bb-modules/mod_email/Api_ClientTest.php | 8 +- .../bb-modules/mod_example/Api_ClientTest.php | 4 +- .../bb-modules/mod_example/ServiceTest.php | 6 +- .../mod_extension/Api_AdminTest.php | 22 +- .../mod_extension/Api_GuestTest.php | 6 +- .../mod_filemanager/Api_AdminTest.php | 2 +- .../mod_formbuilder/Api_AdminTest.php | 28 +- .../mod_formbuilder/Api_GuestTest.php | 4 +- .../bb-modules/mod_forum/Api_AdminTest.php | 40 +- .../bb-modules/mod_forum/Api_ClientTest.php | 32 +- .../bb-modules/mod_forum/Api_GuestTest.php | 30 +- .../bb-modules/mod_hook/Api_AdminTest.php | 6 +- .../bb-modules/mod_invoice/Api_AdminTest.php | 78 +- .../mod_invoice/Api_Client2Test.php | 28 +- .../bb-modules/mod_invoice/Api_ClientTest.php | 2 +- .../bb-modules/mod_invoice/Api_GuestTest.php | 10 +- .../bb-modules/mod_invoice/ServiceTest.php | 4 +- .../bb-modules/mod_kb/Api_AdminTest.php | 22 +- .../bb-modules/mod_kb/Api_GuestTest.php | 24 +- .../mod_massmailer/Api_AdminTest.php | 20 +- .../bb-modules/mod_news/Api_AdminTest.php | 12 +- .../bb-modules/mod_news/Api_GuestTest.php | 12 +- .../mod_notification/Api_AdminTest.php | 8 +- .../bb-modules/mod_order/Api_AdminTest.php | 22 +- .../bb-modules/mod_order/Api_ClientTest.php | 12 +- .../bb-modules/mod_page/Api_AdminTest.php | 2 +- .../mod_paidsupport/ServiceTest.php | 5 +- .../bb-modules/mod_product/Api_AdminTest.php | 46 +- .../bb-modules/mod_product/Api_GuestTest.php | 26 +- .../bb-modules/mod_product/PromoTest.php | 2 +- .../bb-modules/mod_profile/Api_AdminTest.php | 2 +- .../bb-modules/mod_profile/Api_ClientTest.php | 8 +- .../bb-modules/mod_queue/Api_AdminTest.php | 22 +- .../bb-modules/mod_redirect/Api_AdminTest.php | 4 +- .../Api_ClientTest.php | 12 +- .../ServiceTest.php | 21 +- .../mod_servicedomain/Api_GuestTest.php | 4 +- .../mod_servicedomain/ServiceDomainTest.php | 28 +- .../ServiceDownloadableTest.php | 2 + .../Api_ClientTest.php | 3 +- .../mod_servicehosting/Api_AdminTest.php | 32 +- .../mod_servicehosting/Api_ClientTest.php | 2 +- .../mod_servicelicense/Api_AdminTest.php | 2 +- .../mod_servicelicense/ServerTest.php | 6 +- .../mod_servicesolusvm/Api_AdminTest.php | 2 + .../mod_servicesolusvm/Api_ClientTest.php | 2 +- .../mod_servicesolusvm/Api_GuestTest.php | 2 +- .../bb-modules/mod_staff/Api_AdminTest.php | 35 +- .../bb-modules/mod_staff/Api_GuestTest.php | 4 +- .../bb-modules/mod_stats/Api_AdminTest.php | 28 +- .../bb-modules/mod_support/Api_AdminTest.php | 48 +- .../bb-modules/mod_support/Api_ClientTest.php | 14 +- .../bb-modules/mod_support/Api_GuestTest.php | 6 +- .../bb-modules/mod_system/Api_AdminTest.php | 8 +- .../bb-modules/mod_system/Api_GuestTest.php | 22 +- .../bb-modules/mod_theme/ApiAdminTest.php | 6 +- .../bb-modules/mod_theme/Model_ThemeTest.php | 4 +- .../bb-modules/mod_theme/ServiceTest.php | 8 +- 211 files changed, 3349 insertions(+), 2921 deletions(-) rename tests/bb-library/Box/{ConfigTest.php => Box_ConfigTest.php} (88%) rename tests/bb-library/Box/{CryptTest.php => Box_CryptTest.php} (85%) rename tests/bb-library/Box/{EventManagerTest.php => Box_EventManagerTest.php} (86%) rename tests/bb-library/Box/{ExceptionTest.php => Box_ExceptionTest.php} (73%) create mode 100644 tests/bb-library/Box/Box_LicenseTest.php rename tests/bb-library/Box/{LogTest.php => Box_LogTest.php} (85%) rename tests/bb-library/Box/{MailTest.php => Box_MailTest.php} (77%) rename tests/bb-library/Box/{ModTest.php => Box_ModTest.php} (83%) rename tests/bb-library/Box/{PeriodTest.php => Box_PeriodTest.php} (65%) rename tests/bb-library/Box/{RequestTest.php => Box_RequestTest.php} (68%) rename tests/bb-library/Box/{SessionTest.php => Box_SessionTest.php} (94%) rename tests/bb-library/Box/{TranslateTest.php => Box_TranslateTest.php} (94%) rename tests/bb-library/Box/{TwigLoaderTest.php => Box_TwigLoaderTest.php} (51%) rename tests/bb-library/Box/{ValidateTest.php => Box_ValidateTest.php} (73%) delete mode 100644 tests/bb-library/Box/LicenseTest.php rename tests/bb-library/Registrar/Adapter/{ResellerclubTest.php => Registrar_Adapter_ResellerclubTest.php} (91%) create mode 100644 tests/includes/FakeTemplateWrapper.php diff --git a/phpunit.xml.dist b/phpunit.xml.dist index ec61a3b8f..3c9d515fb 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,34 +1,34 @@ - - - - - src - - src/rb.php - src/bb-modules/Spamchecker/recaptchalib.php - src/bb-modules/Spamchecker/akismet.curl.class.php - src/bb-library/Box/Zip.php - src/bb-vendor - src/bb-data - src/bb-library/Registrar/includes - src/bb-modules/Filemanager/src - src/bb-modules/Servicecentovacast/ccapiclient - src/bb-library/php-gettext - src/bb-themes - src/install - - - - \ No newline at end of file + + + + src + + + src/rb.php + src/bb-modules/Spamchecker/recaptchalib.php + src/bb-modules/Spamchecker/akismet.curl.class.php + src/bb-library/Box/Zip.php + src/bb-vendor + src/bb-data + src/bb-library/Registrar/includes + src/bb-modules/Filemanager/src + src/bb-modules/Servicecentovacast/ccapiclient + src/bb-library/php-gettext + src/bb-themes + src/install + + + + + tests/bb-library + + + tests/integration + + + + + + + diff --git a/src/bb-modules/Email/Service.php b/src/bb-modules/Email/Service.php index d65067a04..571199534 100644 --- a/src/bb-modules/Email/Service.php +++ b/src/bb-modules/Email/Service.php @@ -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"; diff --git a/src/composer.json b/src/composer.json index 5dda4ddb2..438c34c34 100644 --- a/src/composer.json +++ b/src/composer.json @@ -40,8 +40,7 @@ }, "require-dev": { - "phpunit/phpunit": "^7.0", - "phpunit/dbunit": "4.0.0", + "phpunit/phpunit": "^9.0", "squizlabs/php_codesniffer": "1.*" }, diff --git a/src/composer.lock b/src/composer.lock index 63f850d98..87c2b8ce7 100644 --- a/src/composer.lock +++ b/src/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "ade25a1467695ce9656137751b91bd27", + "content-hash": "61556a0e814aa34603e8a0f8ce034fbc", "packages": [ { "name": "geoip2/geoip2", @@ -198,29 +198,29 @@ }, { "name": "maxmind-db/reader", - "version": "v1.6.0", + "version": "v1.7.0", "source": { "type": "git", "url": "https://github.com/maxmind/MaxMind-DB-Reader-php.git", - "reference": "febd4920bf17c1da84cef58e56a8227dfb37fbe4" + "reference": "942553da239f12051275f9c666538b5dd09e2908" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/maxmind/MaxMind-DB-Reader-php/zipball/febd4920bf17c1da84cef58e56a8227dfb37fbe4", - "reference": "febd4920bf17c1da84cef58e56a8227dfb37fbe4", + "url": "https://api.github.com/repos/maxmind/MaxMind-DB-Reader-php/zipball/942553da239f12051275f9c666538b5dd09e2908", + "reference": "942553da239f12051275f9c666538b5dd09e2908", "shasum": "" }, "require": { - "php": ">=5.6" + "php": ">=7.2" }, "conflict": { - "ext-maxminddb": "<1.6.0,>=2.0.0" + "ext-maxminddb": "<1.7.0,>=2.0.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "2.*", "php-coveralls/php-coveralls": "^2.1", - "phpunit/phpcov": "^3.0", - "phpunit/phpunit": "5.*", + "phpunit/phpcov": ">=6.0.0", + "phpunit/phpunit": ">=8.0.0,<10.0.0", "squizlabs/php_codesniffer": "3.*" }, "suggest": { @@ -254,7 +254,7 @@ "geolocation", "maxmind" ], - "time": "2019-12-19T22:59:03+00:00" + "time": "2020-08-07T22:10:05+00:00" }, { "name": "michelf/php-markdown", @@ -424,30 +424,34 @@ }, { "name": "pimple/pimple", - "version": "v2.0.0", + "version": "v3.3.0", "source": { "type": "git", "url": "https://github.com/silexphp/Pimple.git", - "reference": "f99b3df12991c22463927aa6a18fd9b2212917f2" + "reference": "e55d12f9d6a0e7f9c85992b73df1267f46279930" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/silexphp/Pimple/zipball/f99b3df12991c22463927aa6a18fd9b2212917f2", - "reference": "f99b3df12991c22463927aa6a18fd9b2212917f2", + "url": "https://api.github.com/repos/silexphp/Pimple/zipball/e55d12f9d6a0e7f9c85992b73df1267f46279930", + "reference": "e55d12f9d6a0e7f9c85992b73df1267f46279930", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": "^7.2.5", + "psr/container": "^1.0" + }, + "require-dev": { + "symfony/phpunit-bridge": "^3.4|^4.4|^5.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.3.x-dev" } }, "autoload": { "psr-0": { - "Pimple": "lib/" + "Pimple": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -460,13 +464,62 @@ "email": "fabien@symfony.com" } ], - "description": "Pimple is a simple Dependency Injection Container for PHP 5.3", - "homepage": "http://pimple.sensiolabs.org", + "description": "Pimple, a simple Dependency Injection Container", + "homepage": "https://pimple.symfony.com", "keywords": [ "container", "dependency injection" ], - "time": "2014-02-10T08:05:32+00:00" + "time": "2020-03-03T09:12:48+00:00" + }, + { + "name": "psr/container", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "time": "2017-02-14T16:28:37+00:00" }, { "name": "rev42/tfpdf", @@ -623,7 +676,7 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.18.0", + "version": "v1.18.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", @@ -699,7 +752,7 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.18.0", + "version": "v1.18.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", @@ -831,32 +884,31 @@ }, { "name": "twig/twig", - "version": "v2.9.0", + "version": "v2.13.0", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "82a1c055c8ed4c4705023bfd0405f3c74db6e3ae" + "reference": "46a612ba1bbf6ee1c58acabacd868212ff8a2911" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/82a1c055c8ed4c4705023bfd0405f3c74db6e3ae", - "reference": "82a1c055c8ed4c4705023bfd0405f3c74db6e3ae", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/46a612ba1bbf6ee1c58acabacd868212ff8a2911", + "reference": "46a612ba1bbf6ee1c58acabacd868212ff8a2911", "shasum": "" }, "require": { - "php": "^7.0", + "php": ">=7.1.3", "symfony/polyfill-ctype": "^1.8", "symfony/polyfill-mbstring": "^1.3" }, "require-dev": { "psr/container": "^1.0", - "symfony/debug": "^2.7", - "symfony/phpunit-bridge": "^3.4.19|^4.1.8" + "symfony/phpunit-bridge": "^4.4.9|^5.0.9" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.9-dev" + "dev-master": "2.13-dev" } }, "autoload": { @@ -878,15 +930,14 @@ "homepage": "http://fabien.potencier.org", "role": "Lead Developer" }, + { + "name": "Twig Team", + "role": "Contributors" + }, { "name": "Armin Ronacher", "email": "armin.ronacher@active-4.com", "role": "Project Founder" - }, - { - "name": "Twig Team", - "homepage": "https://twig.symfony.com/contributors", - "role": "Contributors" } ], "description": "Twig, the flexible, fast, and secure template language for PHP", @@ -894,7 +945,29 @@ "keywords": [ "templating" ], - "time": "2019-04-28T06:57:38+00:00" + "funding": [ + { + "url": "https://certification.symfony.com/", + "type": "custom" + }, + { + "url": "https://live.symfony.com/", + "type": "custom" + }, + { + "url": "https://symfony.com/cloud/", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/twig/twig", + "type": "tidelift" + } + ], + "time": "2020-07-05T13:08:05+00:00" } ], "packages-dev": [ @@ -1023,29 +1096,82 @@ "time": "2020-06-29T13:22:24+00:00" }, { - "name": "phar-io/manifest", - "version": "1.0.3", + "name": "nikic/php-parser", + "version": "v4.8.0", "source": { "type": "git", - "url": "https://github.com/phar-io/manifest.git", - "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "8c58eb4cd4f3883f82611abeac2efbc3dbed787e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", - "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/8c58eb4cd4f3883f82611abeac2efbc3dbed787e", + "reference": "8c58eb4cd4f3883f82611abeac2efbc3dbed787e", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=7.0" + }, + "require-dev": { + "ircmaxell/php-yacc": "^0.0.6", + "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.8-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "time": "2020-08-09T10:23:20+00:00" + }, + { + "name": "phar-io/manifest", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/85265efd3af7ba3ca4b2a2c34dbfc5788dd29133", + "reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133", "shasum": "" }, "require": { "ext-dom": "*", "ext-phar": "*", - "phar-io/version": "^2.0", - "php": "^5.6 || ^7.0" + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -1075,24 +1201,24 @@ } ], "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", - "time": "2018-07-08T19:23:20+00:00" + "time": "2020-06-27T14:33:11+00:00" }, { "name": "phar-io/version", - "version": "2.0.1", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/phar-io/version.git", - "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" + "reference": "c6bb6825def89e0a32220f88337f8ceaf1975fa0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", - "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "url": "https://api.github.com/repos/phar-io/version/zipball/c6bb6825def89e0a32220f88337f8ceaf1975fa0", + "reference": "c6bb6825def89e0a32220f88337f8ceaf1975fa0", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": "^7.2 || ^8.0" }, "type": "library", "autoload": { @@ -1122,7 +1248,7 @@ } ], "description": "Library for handling version information and constraints", - "time": "2018-07-08T19:19:57+00:00" + "time": "2020-06-27T14:39:04+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -1175,28 +1301,27 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.1.0", + "version": "5.2.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e" + "reference": "3170448f5769fe19f456173d833734e0ff1b84df" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", - "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/3170448f5769fe19f456173d833734e0ff1b84df", + "reference": "3170448f5769fe19f456173d833734e0ff1b84df", "shasum": "" }, "require": { - "ext-filter": "^7.1", - "php": "^7.2", - "phpdocumentor/reflection-common": "^2.0", - "phpdocumentor/type-resolver": "^1.0", - "webmozart/assert": "^1" + "ext-filter": "*", + "php": "^7.2 || ^8.0", + "phpdocumentor/reflection-common": "^2.2", + "phpdocumentor/type-resolver": "^1.3", + "webmozart/assert": "^1.9.1" }, "require-dev": { - "doctrine/instantiator": "^1", - "mockery/mockery": "^1" + "mockery/mockery": "~1.3.2" }, "type": "library", "extra": { @@ -1224,7 +1349,7 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2020-02-22T12:28:44+00:00" + "time": "2020-07-20T20:05:34+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -1334,95 +1459,46 @@ ], "time": "2020-07-08T12:44:21+00:00" }, - { - "name": "phpunit/dbunit", - "version": "4.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/dbunit.git", - "reference": "e77b469c3962b5a563f09a2a989f1c9bd38b8615" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/dbunit/zipball/e77b469c3962b5a563f09a2a989f1c9bd38b8615", - "reference": "e77b469c3962b5a563f09a2a989f1c9bd38b8615", - "shasum": "" - }, - "require": { - "ext-pdo": "*", - "ext-simplexml": "*", - "php": "^7.1", - "phpunit/phpunit": "^7.0", - "symfony/yaml": "^3.0 || ^4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "PHPUnit extension for database interaction testing", - "homepage": "https://github.com/sebastianbergmann/dbunit/", - "keywords": [ - "database", - "testing", - "xunit" - ], - "abandoned": true, - "time": "2018-02-07T06:47:59+00:00" - }, { "name": "phpunit/php-code-coverage", - "version": "6.1.4", + "version": "9.1.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" + "reference": "4abbce3b0ad05f2e7143ea5f775d5513cb5261e4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/4abbce3b0ad05f2e7143ea5f775d5513cb5261e4", + "reference": "4abbce3b0ad05f2e7143ea5f775d5513cb5261e4", "shasum": "" }, "require": { "ext-dom": "*", + "ext-libxml": "*", "ext-xmlwriter": "*", - "php": "^7.1", - "phpunit/php-file-iterator": "^2.0", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^3.0", - "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^3.1 || ^4.0", - "sebastian/version": "^2.0.1", - "theseer/tokenizer": "^1.1" + "nikic/php-parser": "^4.8", + "php": "^7.3 || ^8.0", + "phpunit/php-file-iterator": "^3.0.3", + "phpunit/php-text-template": "^2.0.2", + "sebastian/code-unit-reverse-lookup": "^2.0.2", + "sebastian/complexity": "^2.0", + "sebastian/environment": "^5.1.2", + "sebastian/lines-of-code": "^1.0", + "sebastian/version": "^3.0.1", + "theseer/tokenizer": "^1.2.0" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^9.3" }, "suggest": { - "ext-xdebug": "^2.6.0" + "ext-pcov": "*", + "ext-xdebug": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "6.1-dev" + "dev-master": "9.1-dev" } }, "autoload": { @@ -1448,32 +1524,38 @@ "testing", "xunit" ], - "time": "2018-10-31T16:06:48+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-08-10T17:45:51+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "2.0.2", + "version": "3.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "050bedf145a257b1ff02746c31894800e5122946" + "reference": "25fefc5b19835ca653877fe081644a3f8c1d915e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", - "reference": "050bedf145a257b1ff02746c31894800e5122946", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/25fefc5b19835ca653877fe081644a3f8c1d915e", + "reference": "25fefc5b19835ca653877fe081644a3f8c1d915e", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^7.3 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^7.1" + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -1498,26 +1580,99 @@ "filesystem", "iterator" ], - "time": "2018-09-13T20:33:42+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-07-11T05:18:21+00:00" }, { - "name": "phpunit/php-text-template", - "version": "1.2.1", + "name": "phpunit/php-invoker", + "version": "3.1.0", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + "url": "https://github.com/sebastianbergmann/php-invoker.git", + "reference": "7a85b66acc48cacffdf87dadd3694e7123674298" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/7a85b66acc48cacffdf87dadd3694e7123674298", + "reference": "7a85b66acc48cacffdf87dadd3694e7123674298", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "ext-pcntl": "*", + "phpunit/phpunit": "^9.0" + }, + "suggest": { + "ext-pcntl": "*" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Invoke callables with a timeout", + "homepage": "https://github.com/sebastianbergmann/php-invoker/", + "keywords": [ + "process" + ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-08-06T07:04:15+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "6ff9c8ea4d3212b88fcf74e25e516e2c51c99324" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/6ff9c8ea4d3212b88fcf74e25e516e2c51c99324", + "reference": "6ff9c8ea4d3212b88fcf74e25e516e2c51c99324", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -1539,32 +1694,38 @@ "keywords": [ "template" ], - "time": "2015-06-21T13:50:34+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T11:55:37+00:00" }, { "name": "phpunit/php-timer", - "version": "2.1.2", + "version": "5.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "1038454804406b0b5f5f520358e78c1c2f71501e" + "reference": "cc49734779cbb302bf51a44297dab8c4bbf941e7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/1038454804406b0b5f5f520358e78c1c2f71501e", - "reference": "1038454804406b0b5f5f520358e78c1c2f71501e", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/cc49734779cbb302bf51a44297dab8c4bbf941e7", + "reference": "cc49734779cbb302bf51a44297dab8c4bbf941e7", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^7.3 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^9.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -1588,106 +1749,64 @@ "keywords": [ "timer" ], - "time": "2019-06-07T04:22:29+00:00" - }, - { - "name": "phpunit/php-token-stream", - "version": "3.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/995192df77f63a59e47f025390d2d1fdf8f425ff", - "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": "^7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ + "funding": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "url": "https://github.com/sebastianbergmann", + "type": "github" } ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", - "keywords": [ - "tokenizer" - ], - "time": "2019-09-17T06:23:10+00:00" + "time": "2020-06-26T11:58:13+00:00" }, { "name": "phpunit/phpunit", - "version": "7.5.20", + "version": "9.3.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "9467db479d1b0487c99733bb1e7944d32deded2c" + "reference": "c638a0cac77347980352485912de48c99b42ad00" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9467db479d1b0487c99733bb1e7944d32deded2c", - "reference": "9467db479d1b0487c99733bb1e7944d32deded2c", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c638a0cac77347980352485912de48c99b42ad00", + "reference": "c638a0cac77347980352485912de48c99b42ad00", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.1", + "doctrine/instantiator": "^1.3.1", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", - "myclabs/deep-copy": "^1.7", - "phar-io/manifest": "^1.0.2", - "phar-io/version": "^2.0", - "php": "^7.1", - "phpspec/prophecy": "^1.7", - "phpunit/php-code-coverage": "^6.0.7", - "phpunit/php-file-iterator": "^2.0.1", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^2.1", - "sebastian/comparator": "^3.0", - "sebastian/diff": "^3.0", - "sebastian/environment": "^4.0", - "sebastian/exporter": "^3.1", - "sebastian/global-state": "^2.0", - "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^2.0", - "sebastian/version": "^2.0.1" - }, - "conflict": { - "phpunit/phpunit-mock-objects": "*" + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.10.1", + "phar-io/manifest": "^2.0.1", + "phar-io/version": "^3.0.2", + "php": "^7.3 || ^8.0", + "phpspec/prophecy": "^1.11.1", + "phpunit/php-code-coverage": "^9.1.1", + "phpunit/php-file-iterator": "^3.0.4", + "phpunit/php-invoker": "^3.1", + "phpunit/php-text-template": "^2.0.2", + "phpunit/php-timer": "^5.0.1", + "sebastian/code-unit": "^1.0.5", + "sebastian/comparator": "^4.0.3", + "sebastian/diff": "^4.0.2", + "sebastian/environment": "^5.1.2", + "sebastian/exporter": "^4.0.2", + "sebastian/global-state": "^5.0", + "sebastian/object-enumerator": "^4.0.2", + "sebastian/resource-operations": "^3.0.2", + "sebastian/type": "^2.2.1", + "sebastian/version": "^3.0.1" }, "require-dev": { - "ext-pdo": "*" + "ext-pdo": "*", + "phpspec/prophecy-phpunit": "^2.0.1" }, "suggest": { "ext-soap": "*", - "ext-xdebug": "*", - "phpunit/php-invoker": "^2.0" + "ext-xdebug": "*" }, "bin": [ "phpunit" @@ -1695,12 +1814,15 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "7.5-dev" + "dev-master": "9.3-dev" } }, "autoload": { "classmap": [ "src/" + ], + "files": [ + "src/Framework/Assert/Functions.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -1721,32 +1843,94 @@ "testing", "xunit" ], - "time": "2020-01-08T08:45:45+00:00" + "funding": [ + { + "url": "https://phpunit.de/donate.html", + "type": "custom" + }, + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-08-11T15:36:12+00:00" }, { - "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.1", + "name": "sebastian/code-unit", + "version": "1.0.5", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" + "url": "https://github.com/sebastianbergmann/code-unit.git", + "reference": "c1e2df332c905079980b119c4db103117e5e5c90" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/c1e2df332c905079980b119c4db103117e5e5c90", + "reference": "c1e2df332c905079980b119c4db103117e5e5c90", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": "^7.3 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^5.7 || ^6.0" + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the PHP code units", + "homepage": "https://github.com/sebastianbergmann/code-unit", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:50:45+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "ee51f9bb0c6d8a43337055db3120829fa14da819" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ee51f9bb0c6d8a43337055db3120829fa14da819", + "reference": "ee51f9bb0c6d8a43337055db3120829fa14da819", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" } }, "autoload": { @@ -1766,34 +1950,40 @@ ], "description": "Looks up which function or method a line of code belongs to", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2017-03-04T06:30:41+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:04:00+00:00" }, { "name": "sebastian/comparator", - "version": "3.0.2", + "version": "4.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da" + "reference": "dcc580eadfaa4e7f9d2cf9ae1922134ea962e14f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da", - "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/dcc580eadfaa4e7f9d2cf9ae1922134ea962e14f", + "reference": "dcc580eadfaa4e7f9d2cf9ae1922134ea962e14f", "shasum": "" }, "require": { - "php": "^7.1", - "sebastian/diff": "^3.0", - "sebastian/exporter": "^3.1" + "php": "^7.3 || ^8.0", + "sebastian/diff": "^4.0", + "sebastian/exporter": "^4.0" }, "require-dev": { - "phpunit/phpunit": "^7.1" + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -1806,6 +1996,10 @@ "BSD-3-Clause" ], "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" @@ -1817,10 +2011,6 @@ { "name": "Bernhard Schussek", "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" } ], "description": "Provides the functionality to compare PHP values for equality", @@ -1830,33 +2020,39 @@ "compare", "equality" ], - "time": "2018-07-12T15:12:46+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:05:46+00:00" }, { - "name": "sebastian/diff", - "version": "3.0.2", + "name": "sebastian/complexity", + "version": "2.0.0", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29" + "url": "https://github.com/sebastianbergmann/complexity.git", + "reference": "33fcd6a26656c6546f70871244ecba4b4dced097" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29", - "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/33fcd6a26656c6546f70871244ecba4b4dced097", + "reference": "33fcd6a26656c6546f70871244ecba4b4dced097", "shasum": "" }, "require": { - "php": "^7.1" + "nikic/php-parser": "^4.7", + "php": "^7.3 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^7.5 || ^8.0", - "symfony/process": "^2 || ^3.3 || ^4" + "phpunit/phpunit": "^9.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -1870,12 +2066,65 @@ ], "authors": [ { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for calculating the complexity of PHP code units", + "homepage": "https://github.com/sebastianbergmann/complexity", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-07-25T14:01:34+00:00" + }, + { + "name": "sebastian/diff", + "version": "4.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "1e90b4cf905a7d06c420b1d2e9d11a4dc8a13113" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/1e90b4cf905a7d06c420b1d2e9d11a4dc8a13113", + "reference": "1e90b4cf905a7d06c420b1d2e9d11a4dc8a13113", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0", + "symfony/process": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" } ], "description": "Diff implementation", @@ -1886,27 +2135,33 @@ "unidiff", "unified diff" ], - "time": "2019-02-04T06:01:07+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-30T04:46:02+00:00" }, { "name": "sebastian/environment", - "version": "4.2.3", + "version": "5.1.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368" + "reference": "0a757cab9d5b7ef49a619f1143e6c9c1bc0fe9d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/464c90d7bdf5ad4e8a6aea15c091fec0603d4368", - "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/0a757cab9d5b7ef49a619f1143e6c9c1bc0fe9d2", + "reference": "0a757cab9d5b7ef49a619f1143e6c9c1bc0fe9d2", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^7.3 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^7.5" + "phpunit/phpunit": "^9.0" }, "suggest": { "ext-posix": "*" @@ -1914,7 +2169,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.2-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -1939,34 +2194,40 @@ "environment", "hhvm" ], - "time": "2019-11-20T08:46:58+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:07:24+00:00" }, { "name": "sebastian/exporter", - "version": "3.1.2", + "version": "4.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e" + "reference": "571d721db4aec847a0e59690b954af33ebf9f023" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/68609e1261d215ea5b21b7987539cbfbe156ec3e", - "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/571d721db4aec847a0e59690b954af33ebf9f023", + "reference": "571d721db4aec847a0e59690b954af33ebf9f023", "shasum": "" }, "require": { - "php": "^7.0", - "sebastian/recursion-context": "^3.0" + "php": "^7.3 || ^8.0", + "sebastian/recursion-context": "^4.0" }, "require-dev": { "ext-mbstring": "*", - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^9.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1.x-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -2006,27 +2267,36 @@ "export", "exporter" ], - "time": "2019-09-14T09:02:43+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:08:55+00:00" }, { "name": "sebastian/global-state", - "version": "2.0.0", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" + "reference": "22ae663c951bdc39da96603edc3239ed3a299097" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/22ae663c951bdc39da96603edc3239ed3a299097", + "reference": "22ae663c951bdc39da96603edc3239ed3a299097", "shasum": "" }, "require": { - "php": "^7.0" + "php": "^7.3 || ^8.0", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "ext-dom": "*", + "phpunit/phpunit": "^9.3" }, "suggest": { "ext-uopz": "*" @@ -2034,7 +2304,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -2057,34 +2327,93 @@ "keywords": [ "global state" ], - "time": "2017-04-27T15:39:26+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-08-07T04:09:03+00:00" }, { - "name": "sebastian/object-enumerator", - "version": "3.0.3", + "name": "sebastian/lines-of-code", + "version": "1.0.0", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" + "url": "https://github.com/sebastianbergmann/lines-of-code.git", + "reference": "e02bf626f404b5daec382a7b8a6a4456e49017e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/e02bf626f404b5daec382a7b8a6a4456e49017e5", + "reference": "e02bf626f404b5daec382a7b8a6a4456e49017e5", "shasum": "" }, "require": { - "php": "^7.0", - "sebastian/object-reflector": "^1.1.1", - "sebastian/recursion-context": "^3.0" + "nikic/php-parser": "^4.6", + "php": "^7.3 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^9.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0.x-dev" + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for counting the lines of code in PHP source code", + "homepage": "https://github.com/sebastianbergmann/lines-of-code", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-07-22T18:33:42+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "4.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "074fed2d0a6d08e1677dd8ce9d32aecb384917b8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/074fed2d0a6d08e1677dd8ce9d32aecb384917b8", + "reference": "074fed2d0a6d08e1677dd8ce9d32aecb384917b8", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" } }, "autoload": { @@ -2104,122 +2433,33 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2017-08-03T12:35:26+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:11:32+00:00" }, { "name": "sebastian/object-reflector", - "version": "1.1.1", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "773f97c67f28de00d397be301821b06708fca0be" + "reference": "127a46f6b057441b201253526f81d5406d6c7840" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", - "reference": "773f97c67f28de00d397be301821b06708fca0be", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/127a46f6b057441b201253526f81d5406d6c7840", + "reference": "127a46f6b057441b201253526f81d5406d6c7840", "shasum": "" }, "require": { - "php": "^7.0" + "php": "^7.3 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Allows reflection of object attributes, including inherited and non-public ones", - "homepage": "https://github.com/sebastianbergmann/object-reflector/", - "time": "2017-03-29T09:07:27+00:00" - }, - { - "name": "sebastian/recursion-context", - "version": "3.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2017-03-03T06:23:57+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", - "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", - "shasum": "" - }, - "require": { - "php": "^7.1" + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { @@ -2242,31 +2482,199 @@ "email": "sebastian@phpunit.de" } ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2018-10-04T04:07:39+00:00" + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:12:55+00:00" }, { - "name": "sebastian/version", - "version": "2.0.1", + "name": "sebastian/recursion-context", + "version": "4.0.2", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "062231bf61d2b9448c4fa5a7643b5e1829c11d63" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/062231bf61d2b9448c4fa5a7643b5e1829c11d63", + "reference": "062231bf61d2b9448c4fa5a7643b5e1829c11d63", "shasum": "" }, "require": { - "php": ">=5.6" + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:14:17+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "0653718a5a629b065e91f774595267f8dc32e213" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0653718a5a629b065e91f774595267f8dc32e213", + "reference": "0653718a5a629b065e91f774595267f8dc32e213", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:16:22+00:00" + }, + { + "name": "sebastian/type", + "version": "2.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "86991e2b33446cd96e648c18bcdb1e95afb2c05a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/86991e2b33446cd96e648c18bcdb1e95afb2c05a", + "reference": "86991e2b33446cd96e648c18bcdb1e95afb2c05a", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-07-05T08:31:53+00:00" + }, + { + "name": "sebastian/version", + "version": "3.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "626586115d0ed31cb71483be55beb759b5af5a3c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/626586115d0ed31cb71483be55beb759b5af5a3c", + "reference": "626586115d0ed31cb71483be55beb759b5af5a3c", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" } }, "autoload": { @@ -2287,7 +2695,13 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-10-03T07:35:21+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:18:43+00:00" }, { "name": "squizlabs/php_codesniffer", @@ -2364,79 +2778,6 @@ ], "time": "2014-12-04T22:32:15+00:00" }, - { - "name": "symfony/yaml", - "version": "v4.4.10", - "source": { - "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "c2d2cc66e892322cfcc03f8f12f8340dbd7a3f8a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/c2d2cc66e892322cfcc03f8f12f8340dbd7a3f8a", - "reference": "c2d2cc66e892322cfcc03f8f12f8340dbd7a3f8a", - "shasum": "" - }, - "require": { - "php": ">=7.1.3", - "symfony/polyfill-ctype": "~1.8" - }, - "conflict": { - "symfony/console": "<3.4" - }, - "require-dev": { - "symfony/console": "^3.4|^4.0|^5.0" - }, - "suggest": { - "symfony/console": "For validating YAML files using the lint command" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com", - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2020-05-20T08:37:50+00:00" - }, { "name": "theseer/tokenizer", "version": "1.2.0", diff --git a/tests/bb-library/Box/ConfigTest.php b/tests/bb-library/Box/Box_ConfigTest.php similarity index 88% rename from tests/bb-library/Box/ConfigTest.php rename to tests/bb-library/Box/Box_ConfigTest.php index 8c7a43b4e..e3c27970d 100644 --- a/tests/bb-library/Box/ConfigTest.php +++ b/tests/bb-library/Box/Box_ConfigTest.php @@ -1,5 +1,5 @@ assertInstanceOf('Box_ExceptionAuth', $e); + $this->assertInstanceOf(Box_ExceptionAuth::class, $e); } } \ No newline at end of file diff --git a/tests/bb-library/Box/Box_LicenseTest.php b/tests/bb-library/Box/Box_LicenseTest.php new file mode 100644 index 000000000..13f43a559 --- /dev/null +++ b/tests/bb-library/Box/Box_LicenseTest.php @@ -0,0 +1,20 @@ +di = $di; + } + + public function testLicense() + { + self::expectNotToPerformAssertions(); + $license = $this->di['license']; + $license->getDetails(); + $license->getDetails(true); + } +} \ No newline at end of file diff --git a/tests/bb-library/Box/LogTest.php b/tests/bb-library/Box/Box_LogTest.php similarity index 85% rename from tests/bb-library/Box/LogTest.php rename to tests/bb-library/Box/Box_LogTest.php index c68ba5870..21d0ec203 100644 --- a/tests/bb-library/Box/LogTest.php +++ b/tests/bb-library/Box/Box_LogTest.php @@ -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)); diff --git a/tests/bb-library/Box/MailTest.php b/tests/bb-library/Box/Box_MailTest.php similarity index 77% rename from tests/bb-library/Box/MailTest.php rename to tests/bb-library/Box/Box_MailTest.php index 75176e94d..e3077b2ea 100644 --- a/tests/bb-library/Box/MailTest.php +++ b/tests/bb-library/Box/Box_MailTest.php @@ -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); } } \ No newline at end of file diff --git a/tests/bb-library/Box/ModTest.php b/tests/bb-library/Box/Box_ModTest.php similarity index 83% rename from tests/bb-library/Box/ModTest.php rename to tests/bb-library/Box/Box_ModTest.php index 478cd9512..3a76807c7 100644 --- a/tests/bb-library/Box/ModTest.php +++ b/tests/bb-library/Box/Box_ModTest.php @@ -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); } diff --git a/tests/bb-library/Box/Box_PasswordTest.php b/tests/bb-library/Box/Box_PasswordTest.php index 09d788e6a..471060690 100644 --- a/tests/bb-library/Box/Box_PasswordTest.php +++ b/tests/bb-library/Box/Box_PasswordTest.php @@ -1,7 +1,7 @@ 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); } } diff --git a/tests/bb-library/Box/PeriodTest.php b/tests/bb-library/Box/Box_PeriodTest.php similarity index 65% rename from tests/bb-library/Box/PeriodTest.php rename to tests/bb-library/Box/Box_PeriodTest.php index 6cd7a4245..ccbc5d742 100644 --- a/tests/bb-library/Box/PeriodTest.php +++ b/tests/bb-library/Box/Box_PeriodTest.php @@ -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'); } diff --git a/tests/bb-library/Box/RequestTest.php b/tests/bb-library/Box/Box_RequestTest.php similarity index 68% rename from tests/bb-library/Box/RequestTest.php rename to tests/bb-library/Box/Box_RequestTest.php index 7b4529fa2..fc3044b3b 100644 --- a/tests/bb-library/Box/RequestTest.php +++ b/tests/bb-library/Box/Box_RequestTest.php @@ -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 => diff --git a/tests/bb-library/Box/SessionTest.php b/tests/bb-library/Box/Box_SessionTest.php similarity index 94% rename from tests/bb-library/Box/SessionTest.php rename to tests/bb-library/Box/Box_SessionTest.php index 3d9748074..0a2581e1f 100644 --- a/tests/bb-library/Box/SessionTest.php +++ b/tests/bb-library/Box/Box_SessionTest.php @@ -2,7 +2,7 @@ /** * @group Core */ -class Box_SessionTestCase extends PHPUnit_Framework_TestCase +class Box_SessionTest extends PHPUnit\Framework\TestCase { public function testSession() { diff --git a/tests/bb-library/Box/TranslateTest.php b/tests/bb-library/Box/Box_TranslateTest.php similarity index 94% rename from tests/bb-library/Box/TranslateTest.php rename to tests/bb-library/Box/Box_TranslateTest.php index 3560fadba..0b7e1ec9a 100644 --- a/tests/bb-library/Box/TranslateTest.php +++ b/tests/bb-library/Box/Box_TranslateTest.php @@ -2,7 +2,7 @@ /** * @group Core */ -class Box_TranslateTest extends PHPUnit_Framework_TestCase +class Box_TranslateTest extends PHPUnit\Framework\TestCase { public function testsetLocale() { diff --git a/tests/bb-library/Box/TwigLoaderTest.php b/tests/bb-library/Box/Box_TwigLoaderTest.php similarity index 51% rename from tests/bb-library/Box/TwigLoaderTest.php rename to tests/bb-library/Box/Box_TwigLoaderTest.php index 6b5f72439..9bb3301de 100644 --- a/tests/bb-library/Box/TwigLoaderTest.php +++ b/tests/bb-library/Box/Box_TwigLoaderTest.php @@ -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"); } } \ No newline at end of file diff --git a/tests/bb-library/Box/ValidateTest.php b/tests/bb-library/Box/Box_ValidateTest.php similarity index 73% rename from tests/bb-library/Box/ValidateTest.php rename to tests/bb-library/Box/Box_ValidateTest.php index 37dc23025..3ba2970ed 100644 --- a/tests/bb-library/Box/ValidateTest.php +++ b/tests/bb-library/Box/Box_ValidateTest.php @@ -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); } diff --git a/tests/bb-library/Box/LicenseTest.php b/tests/bb-library/Box/LicenseTest.php deleted file mode 100644 index 5bf7925b0..000000000 --- a/tests/bb-library/Box/LicenseTest.php +++ /dev/null @@ -1,19 +0,0 @@ -di = $di; - } - - public function testLicense() - { - $license = $this->di['license']; -// $license->getDetails(); -// $license->getDetails(true); - } -} diff --git a/tests/bb-library/Payment/Adapter/Payment_Adapter_ClientBalanceTest.php b/tests/bb-library/Payment/Adapter/Payment_Adapter_ClientBalanceTest.php index de3ee5a39..08ecbf6f2 100644 --- a/tests/bb-library/Payment/Adapter/Payment_Adapter_ClientBalanceTest.php +++ b/tests/bb-library/Payment/Adapter/Payment_Adapter_ClientBalanceTest.php @@ -1,7 +1,7 @@ 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, '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); } -} +} \ No newline at end of file diff --git a/tests/bb-library/Payment/Adapter/Payment_Adapter_InterkassaTest.php b/tests/bb-library/Payment/Adapter/Payment_Adapter_InterkassaTest.php index bb6fadb10..0e5d43c0e 100644 --- a/tests/bb-library/Payment/Adapter/Payment_Adapter_InterkassaTest.php +++ b/tests/bb-library/Payment/Adapter/Payment_Adapter_InterkassaTest.php @@ -1,11 +1,11 @@ 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); } diff --git a/tests/bb-library/Payment/Adapter/Payment_Adapter_PayPalTest.php b/tests/bb-library/Payment/Adapter/Payment_Adapter_PayPalTest.php index aa77a1d0d..0a69bf8c6 100644 --- a/tests/bb-library/Payment/Adapter/Payment_Adapter_PayPalTest.php +++ b/tests/bb-library/Payment/Adapter/Payment_Adapter_PayPalTest.php @@ -1,11 +1,11 @@ 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); } diff --git a/tests/bb-library/Payment/Adapter/Payment_Adapter_StripeTest.php b/tests/bb-library/Payment/Adapter/Payment_Adapter_StripeTest.php index a77ec965e..e1e493e53 100644 --- a/tests/bb-library/Payment/Adapter/Payment_Adapter_StripeTest.php +++ b/tests/bb-library/Payment/Adapter/Payment_Adapter_StripeTest.php @@ -1,11 +1,11 @@ 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(); } -} +} \ No newline at end of file diff --git a/tests/bb-library/Registrar/Adapter/ResellerclubTest.php b/tests/bb-library/Registrar/Adapter/Registrar_Adapter_ResellerclubTest.php similarity index 91% rename from tests/bb-library/Registrar/Adapter/ResellerclubTest.php rename to tests/bb-library/Registrar/Adapter/Registrar_Adapter_ResellerclubTest.php index 46ca5b2c2..e13cdb21d 100644 --- a/tests/bb-library/Registrar/Adapter/ResellerclubTest.php +++ b/tests/bb-library/Registrar/Adapter/Registrar_Adapter_ResellerclubTest.php @@ -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); } diff --git a/tests/bb-library/bootstrap.php b/tests/bb-library/bootstrap.php index fcda6e317..1e47675c8 100644 --- a/tests/bb-library/bootstrap.php +++ b/tests/bb-library/bootstrap.php @@ -1,4 +1,4 @@ setDi($di); $result = $controllerAdmin->fetchNavigation(); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testregister() diff --git a/tests/bb-modules/Activity/ServiceTest.php b/tests/bb-modules/Activity/ServiceTest.php index f35a9d441..ccf6cff16 100644 --- a/tests/bb-modules/Activity/ServiceTest.php +++ b/tests/bb-modules/Activity/ServiceTest.php @@ -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']); diff --git a/tests/bb-modules/Api/ServiceTest.php b/tests/bb-modules/Api/ServiceTest.php index bc5e4b0f3..e5949a5cf 100644 --- a/tests/bb-modules/Api/ServiceTest.php +++ b/tests/bb-modules/Api/ServiceTest.php @@ -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); } diff --git a/tests/bb-modules/Branding/ServiceTest.php b/tests/bb-modules/Branding/ServiceTest.php index 26189032a..42c38b5f6 100644 --- a/tests/bb-modules/Branding/ServiceTest.php +++ b/tests/bb-modules/Branding/ServiceTest.php @@ -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(); } diff --git a/tests/bb-modules/Cart/Api/AdminTest.php b/tests/bb-modules/Cart/Api/AdminTest.php index d13f2f60b..e6ff52032 100644 --- a/tests/bb-modules/Cart/Api/AdminTest.php +++ b/tests/bb-modules/Cart/Api/AdminTest.php @@ -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); } diff --git a/tests/bb-modules/Cart/Api/ClientTest.php b/tests/bb-modules/Cart/Api/ClientTest.php index 4b695b022..3478fe836 100644 --- a/tests/bb-modules/Cart/Api/ClientTest.php +++ b/tests/bb-modules/Cart/Api/ClientTest.php @@ -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); } } \ No newline at end of file diff --git a/tests/bb-modules/Cart/Api/GuestTest.php b/tests/bb-modules/Cart/Api/GuestTest.php index 948cd7617..21566fc6f 100644 --- a/tests/bb-modules/Cart/Api/GuestTest.php +++ b/tests/bb-modules/Cart/Api/GuestTest.php @@ -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); diff --git a/tests/bb-modules/Cart/ServiceTest.php b/tests/bb-modules/Cart/ServiceTest.php index d8ccb74f1..043eda02c 100644 --- a/tests/bb-modules/Cart/ServiceTest.php +++ b/tests/bb-modules/Cart/ServiceTest.php @@ -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) { diff --git a/tests/bb-modules/Client/Api/AdminTest.php b/tests/bb-modules/Client/Api/AdminTest.php index 8e37f8d9c..0a715365e 100644 --- a/tests/bb-modules/Client/Api/AdminTest.php +++ b/tests/bb-modules/Client/Api/AdminTest.php @@ -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 } -} +} \ No newline at end of file diff --git a/tests/bb-modules/Client/Api/ClientTest.php b/tests/bb-modules/Client/Api/ClientTest.php index deb96e6a5..852d0c481 100644 --- a/tests/bb-modules/Client/Api/ClientTest.php +++ b/tests/bb-modules/Client/Api/ClientTest.php @@ -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); } diff --git a/tests/bb-modules/Client/Api/GuestTest.php b/tests/bb-modules/Client/Api/GuestTest.php index 966af1e78..5989258ff 100644 --- a/tests/bb-modules/Client/Api/GuestTest.php +++ b/tests/bb-modules/Client/Api/GuestTest.php @@ -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); } } \ No newline at end of file diff --git a/tests/bb-modules/Client/ServiceBalanceTest.php b/tests/bb-modules/Client/ServiceBalanceTest.php index 47c7dc1c9..52e4acf82 100644 --- a/tests/bb-modules/Client/ServiceBalanceTest.php +++ b/tests/bb-modules/Client/ServiceBalanceTest.php @@ -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); } } diff --git a/tests/bb-modules/Client/ServiceTest.php b/tests/bb-modules/Client/ServiceTest.php index 4d99c70b2..f9a4a04d9 100644 --- a/tests/bb-modules/Client/ServiceTest.php +++ b/tests/bb-modules/Client/ServiceTest.php @@ -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); } diff --git a/tests/bb-modules/Cron/Api/AdminTest.php b/tests/bb-modules/Cron/Api/AdminTest.php index 8a9082f8f..a84621d28 100644 --- a/tests/bb-modules/Cron/Api/AdminTest.php +++ b/tests/bb-modules/Cron/Api/AdminTest.php @@ -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); } diff --git a/tests/bb-modules/Cron/Api/GuestTest.php b/tests/bb-modules/Cron/Api/GuestTest.php index 4c960ae66..c37a13953 100644 --- a/tests/bb-modules/Cron/Api/GuestTest.php +++ b/tests/bb-modules/Cron/Api/GuestTest.php @@ -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); } diff --git a/tests/bb-modules/Cron/ServiceTest.php b/tests/bb-modules/Cron/ServiceTest.php index 804e06923..9accedb9b 100644 --- a/tests/bb-modules/Cron/ServiceTest.php +++ b/tests/bb-modules/Cron/ServiceTest.php @@ -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); } } diff --git a/tests/bb-modules/Currency/Api/Api_AdminTest.php b/tests/bb-modules/Currency/Api/Api_AdminTest.php index d72ad1929..2ab89cba7 100644 --- a/tests/bb-modules/Currency/Api/Api_AdminTest.php +++ b/tests/bb-modules/Currency/Api/Api_AdminTest.php @@ -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); } } diff --git a/tests/bb-modules/Currency/Api/Api_GuestTest.php b/tests/bb-modules/Currency/Api/Api_GuestTest.php index 65ab084de..e198e9845 100644 --- a/tests/bb-modules/Currency/Api/Api_GuestTest.php +++ b/tests/bb-modules/Currency/Api/Api_GuestTest.php @@ -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) { diff --git a/tests/bb-modules/Currency/ServiceTest.php b/tests/bb-modules/Currency/ServiceTest.php index 3a754d083..1cb46ef18 100644 --- a/tests/bb-modules/Currency/ServiceTest.php +++ b/tests/bb-modules/Currency/ServiceTest.php @@ -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('$$$'); } diff --git a/tests/bb-modules/Email/Api/Api_AdminTest.php b/tests/bb-modules/Email/Api/Api_AdminTest.php index ed1663af7..0655e34e8 100644 --- a/tests/bb-modules/Email/Api/Api_AdminTest.php +++ b/tests/bb-modules/Email/Api/Api_AdminTest.php @@ -1,7 +1,7 @@ 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); } -} +} \ No newline at end of file diff --git a/tests/bb-modules/Email/Api/Api_ClientTest.php b/tests/bb-modules/Email/Api/Api_ClientTest.php index 6c410df60..6dadb643a 100644 --- a/tests/bb-modules/Email/Api/Api_ClientTest.php +++ b/tests/bb-modules/Email/Api/Api_ClientTest.php @@ -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); } -} +} \ No newline at end of file diff --git a/tests/bb-modules/Email/ServiceTest.php b/tests/bb-modules/Email/ServiceTest.php index f2ef01a87..e5f0a4653 100644 --- a/tests/bb-modules/Email/ServiceTest.php +++ b/tests/bb-modules/Email/ServiceTest.php @@ -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'); } diff --git a/tests/bb-modules/Example/Api/AdminTest.php b/tests/bb-modules/Example/Api/AdminTest.php index 37c7e6ca9..506606b59 100644 --- a/tests/bb-modules/Example/Api/AdminTest.php +++ b/tests/bb-modules/Example/Api/AdminTest.php @@ -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); } } diff --git a/tests/bb-modules/Example/Api/ClientTest.php b/tests/bb-modules/Example/Api/ClientTest.php index 398e178ac..abae6e658 100644 --- a/tests/bb-modules/Example/Api/ClientTest.php +++ b/tests/bb-modules/Example/Api/ClientTest.php @@ -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); diff --git a/tests/bb-modules/Example/Api/GuestTest.php b/tests/bb-modules/Example/Api/GuestTest.php index f9831ad73..d500dad0d 100644 --- a/tests/bb-modules/Example/Api/GuestTest.php +++ b/tests/bb-modules/Example/Api/GuestTest.php @@ -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); } } diff --git a/tests/bb-modules/Example/Controller/AdminTest.php b/tests/bb-modules/Example/Controller/AdminTest.php index 7cd2818a0..226c46d7b 100644 --- a/tests/bb-modules/Example/Controller/AdminTest.php +++ b/tests/bb-modules/Example/Controller/AdminTest.php @@ -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() diff --git a/tests/bb-modules/Example/ServiceTest.php b/tests/bb-modules/Example/ServiceTest.php index 967fff471..948b93a0c 100644 --- a/tests/bb-modules/Example/ServiceTest.php +++ b/tests/bb-modules/Example/ServiceTest.php @@ -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() diff --git a/tests/bb-modules/Extension/Api/AdminTest.php b/tests/bb-modules/Extension/Api/AdminTest.php index 3b396cb74..808c8994a 100644 --- a/tests/bb-modules/Extension/Api/AdminTest.php +++ b/tests/bb-modules/Extension/Api/AdminTest.php @@ -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() diff --git a/tests/bb-modules/Extension/Api/GuestTest.php b/tests/bb-modules/Extension/Api/GuestTest.php index fa8f80733..5a7d0bbec 100644 --- a/tests/bb-modules/Extension/Api/GuestTest.php +++ b/tests/bb-modules/Extension/Api/GuestTest.php @@ -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); } } \ No newline at end of file diff --git a/tests/bb-modules/Extension/ServiceTest.php b/tests/bb-modules/Extension/ServiceTest.php index aa838adbd..77f8b36f9 100644 --- a/tests/bb-modules/Extension/ServiceTest.php +++ b/tests/bb-modules/Extension/ServiceTest.php @@ -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() diff --git a/tests/bb-modules/Filemanager/Api/Api_AdminTest.php b/tests/bb-modules/Filemanager/Api/Api_AdminTest.php index 438f903a8..4decb8e04 100644 --- a/tests/bb-modules/Filemanager/Api/Api_AdminTest.php +++ b/tests/bb-modules/Filemanager/Api/Api_AdminTest.php @@ -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); } diff --git a/tests/bb-modules/Filemanager/Controller/AdminTest.php b/tests/bb-modules/Filemanager/Controller/AdminTest.php index 0535bb638..0379022d7 100644 --- a/tests/bb-modules/Filemanager/Controller/AdminTest.php +++ b/tests/bb-modules/Filemanager/Controller/AdminTest.php @@ -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); } } \ No newline at end of file diff --git a/tests/bb-modules/Filemanager/ServiceTest.php b/tests/bb-modules/Filemanager/ServiceTest.php index 79c36566d..2f5db6053 100644 --- a/tests/bb-modules/Filemanager/ServiceTest.php +++ b/tests/bb-modules/Filemanager/ServiceTest.php @@ -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']); diff --git a/tests/bb-modules/Formbuilder/Api/AdminTest.php b/tests/bb-modules/Formbuilder/Api/AdminTest.php index 7d168ae23..e8d718584 100644 --- a/tests/bb-modules/Formbuilder/Api/AdminTest.php +++ b/tests/bb-modules/Formbuilder/Api/AdminTest.php @@ -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); } diff --git a/tests/bb-modules/Formbuilder/Api/GuestTest.php b/tests/bb-modules/Formbuilder/Api/GuestTest.php index 0799846f5..5bde8a984 100644 --- a/tests/bb-modules/Formbuilder/Api/GuestTest.php +++ b/tests/bb-modules/Formbuilder/Api/GuestTest.php @@ -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); } } diff --git a/tests/bb-modules/Formbuilder/ServiceTest.php b/tests/bb-modules/Formbuilder/ServiceTest.php index 005285a18..c79c1a44f 100644 --- a/tests/bb-modules/Formbuilder/ServiceTest.php +++ b/tests/bb-modules/Formbuilder/ServiceTest.php @@ -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); } diff --git a/tests/bb-modules/Hook/Api/AdminTest.php b/tests/bb-modules/Hook/Api/AdminTest.php index 431c955fa..260f9f07b 100644 --- a/tests/bb-modules/Hook/Api/AdminTest.php +++ b/tests/bb-modules/Hook/Api/AdminTest.php @@ -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); } diff --git a/tests/bb-modules/Hook/ServiceTest.php b/tests/bb-modules/Hook/ServiceTest.php index 0c92c22af..4e5f295d4 100644 --- a/tests/bb-modules/Hook/ServiceTest.php +++ b/tests/bb-modules/Hook/ServiceTest.php @@ -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()); diff --git a/tests/bb-modules/Invoice/Api/AdminTest.php b/tests/bb-modules/Invoice/Api/AdminTest.php index 511c0528f..31d849da7 100644 --- a/tests/bb-modules/Invoice/Api/AdminTest.php +++ b/tests/bb-modules/Invoice/Api/AdminTest.php @@ -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); } diff --git a/tests/bb-modules/Invoice/Api/ClientTest.php b/tests/bb-modules/Invoice/Api/ClientTest.php index 5a08e0349..b10fa5aec 100644 --- a/tests/bb-modules/Invoice/Api/ClientTest.php +++ b/tests/bb-modules/Invoice/Api/ClientTest.php @@ -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() diff --git a/tests/bb-modules/Invoice/Api/GuestTest.php b/tests/bb-modules/Invoice/Api/GuestTest.php index 06d84a04c..9f16d5b0a 100644 --- a/tests/bb-modules/Invoice/Api/GuestTest.php +++ b/tests/bb-modules/Invoice/Api/GuestTest.php @@ -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); } diff --git a/tests/bb-modules/Invoice/ServiceInvoiceItemTest.php b/tests/bb-modules/Invoice/ServiceInvoiceItemTest.php index c8cc34107..abc916adc 100644 --- a/tests/bb-modules/Invoice/ServiceInvoiceItemTest.php +++ b/tests/bb-modules/Invoice/ServiceInvoiceItemTest.php @@ -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); } } \ No newline at end of file diff --git a/tests/bb-modules/Invoice/ServicePayGatewayTest.php b/tests/bb-modules/Invoice/ServicePayGatewayTest.php index 17cd69d6e..11faf2262 100644 --- a/tests/bb-modules/Invoice/ServicePayGatewayTest.php +++ b/tests/bb-modules/Invoice/ServicePayGatewayTest.php @@ -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); } } \ No newline at end of file diff --git a/tests/bb-modules/Invoice/ServiceSubscriptionTest.php b/tests/bb-modules/Invoice/ServiceSubscriptionTest.php index 535a752e4..5f7c218b6 100644 --- a/tests/bb-modules/Invoice/ServiceSubscriptionTest.php +++ b/tests/bb-modules/Invoice/ServiceSubscriptionTest.php @@ -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); } diff --git a/tests/bb-modules/Invoice/ServiceTaxTest.php b/tests/bb-modules/Invoice/ServiceTaxTest.php index 499a02148..8def0a734 100644 --- a/tests/bb-modules/Invoice/ServiceTaxTest.php +++ b/tests/bb-modules/Invoice/ServiceTaxTest.php @@ -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); } } diff --git a/tests/bb-modules/Invoice/ServiceTest.php b/tests/bb-modules/Invoice/ServiceTest.php index 110242bf3..289a4bd54 100644 --- a/tests/bb-modules/Invoice/ServiceTest.php +++ b/tests/bb-modules/Invoice/ServiceTest.php @@ -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); } -} +} \ No newline at end of file diff --git a/tests/bb-modules/Invoice/ServiceTransactionTest.php b/tests/bb-modules/Invoice/ServiceTransactionTest.php index 357eb71e4..80d0668c2 100644 --- a/tests/bb-modules/Invoice/ServiceTransactionTest.php +++ b/tests/bb-modules/Invoice/ServiceTransactionTest.php @@ -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() diff --git a/tests/bb-modules/Kb/Api/Api_AdminTest.php b/tests/bb-modules/Kb/Api/Api_AdminTest.php index 34e6cbae0..6d98d5c02 100644 --- a/tests/bb-modules/Kb/Api/Api_AdminTest.php +++ b/tests/bb-modules/Kb/Api/Api_AdminTest.php @@ -1,7 +1,7 @@ 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); } -} +} \ No newline at end of file diff --git a/tests/bb-modules/Kb/Api/Api_GuestTest.php b/tests/bb-modules/Kb/Api/Api_GuestTest.php index a96b2fbe8..58c9ead14 100644 --- a/tests/bb-modules/Kb/Api/Api_GuestTest.php +++ b/tests/bb-modules/Kb/Api/Api_GuestTest.php @@ -1,7 +1,7 @@ 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); } -} +} \ No newline at end of file diff --git a/tests/bb-modules/Kb/ServiceTest.php b/tests/bb-modules/Kb/ServiceTest.php index e58940634..c749facc6 100644 --- a/tests/bb-modules/Kb/ServiceTest.php +++ b/tests/bb-modules/Kb/ServiceTest.php @@ -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); } diff --git a/tests/bb-modules/Order/Api/Api_AdminTest.php b/tests/bb-modules/Order/Api/Api_AdminTest.php index c3f3c9685..4a1d5c64e 100644 --- a/tests/bb-modules/Order/Api/Api_AdminTest.php +++ b/tests/bb-modules/Order/Api/Api_AdminTest.php @@ -1,6 +1,6 @@ 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() diff --git a/tests/bb-modules/Order/Api/Api_ClientTest.php b/tests/bb-modules/Order/Api/Api_ClientTest.php index 862ffa04a..cb1a0bc72 100644 --- a/tests/bb-modules/Order/Api/Api_ClientTest.php +++ b/tests/bb-modules/Order/Api/Api_ClientTest.php @@ -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); } } diff --git a/tests/bb-modules/Order/ServiceTest.php b/tests/bb-modules/Order/ServiceTest.php index 40ab9e6de..1944e1573 100644 --- a/tests/bb-modules/Order/ServiceTest.php +++ b/tests/bb-modules/Order/ServiceTest.php @@ -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); } diff --git a/tests/bb-modules/Page/Api/AdminTest.php b/tests/bb-modules/Page/Api/AdminTest.php index 6c09eecd9..b7e3561e4 100644 --- a/tests/bb-modules/Page/Api/AdminTest.php +++ b/tests/bb-modules/Page/Api/AdminTest.php @@ -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); } } diff --git a/tests/bb-modules/Page/ServiceTest.php b/tests/bb-modules/Page/ServiceTest.php index 4b2b9a604..5b478eafc 100644 --- a/tests/bb-modules/Page/ServiceTest.php +++ b/tests/bb-modules/Page/ServiceTest.php @@ -19,7 +19,7 @@ class ServiceTest extends \BBTestCase { $service->setDi($di); $result = $service->getPairs(); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } } \ No newline at end of file diff --git a/tests/bb-modules/Paidsupport/ServiceTest.php b/tests/bb-modules/Paidsupport/ServiceTest.php index 8a797ef66..8e7eaf591 100644 --- a/tests/bb-modules/Paidsupport/ServiceTest.php +++ b/tests/bb-modules/Paidsupport/ServiceTest.php @@ -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); } diff --git a/tests/bb-modules/Product/Api/AdminTest.php b/tests/bb-modules/Product/Api/AdminTest.php index 7fc7bb155..04ac6d9ab 100644 --- a/tests/bb-modules/Product/Api/AdminTest.php +++ b/tests/bb-modules/Product/Api/AdminTest.php @@ -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); } diff --git a/tests/bb-modules/Product/Api/GuestTest.php b/tests/bb-modules/Product/Api/GuestTest.php index d58be765c..bbd7a2925 100644 --- a/tests/bb-modules/Product/Api/GuestTest.php +++ b/tests/bb-modules/Product/Api/GuestTest.php @@ -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)); } } \ No newline at end of file diff --git a/tests/bb-modules/Product/ServiceTest.php b/tests/bb-modules/Product/ServiceTest.php index 1dbb5793e..cccce637c 100644 --- a/tests/bb-modules/Product/ServiceTest.php +++ b/tests/bb-modules/Product/ServiceTest.php @@ -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); } diff --git a/tests/bb-modules/Profile/Api/AdminTest.php b/tests/bb-modules/Profile/Api/AdminTest.php index b8b77087f..eeb66f098 100644 --- a/tests/bb-modules/Profile/Api/AdminTest.php +++ b/tests/bb-modules/Profile/Api/AdminTest.php @@ -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() diff --git a/tests/bb-modules/Profile/Api/ClientTest.php b/tests/bb-modules/Profile/Api/ClientTest.php index 7fc96bdc9..1e77ba28c 100644 --- a/tests/bb-modules/Profile/Api/ClientTest.php +++ b/tests/bb-modules/Profile/Api/ClientTest.php @@ -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); } diff --git a/tests/bb-modules/Profile/ServiceTest.php b/tests/bb-modules/Profile/ServiceTest.php index 93330d48c..8d63c0ce3 100644 --- a/tests/bb-modules/Profile/ServiceTest.php +++ b/tests/bb-modules/Profile/ServiceTest.php @@ -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); } -} +} \ No newline at end of file diff --git a/tests/bb-modules/Serviceboxbillinglicense/ServiceTest.php b/tests/bb-modules/Serviceboxbillinglicense/ServiceTest.php index 45a1c3b75..c370b4740 100644 --- a/tests/bb-modules/Serviceboxbillinglicense/ServiceTest.php +++ b/tests/bb-modules/Serviceboxbillinglicense/ServiceTest.php @@ -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); } } diff --git a/tests/bb-modules/Servicecustom/Api/Api_AdminTest.php b/tests/bb-modules/Servicecustom/Api/Api_AdminTest.php index bfdaaf0a5..b084f8da5 100644 --- a/tests/bb-modules/Servicecustom/Api/Api_AdminTest.php +++ b/tests/bb-modules/Servicecustom/Api/Api_AdminTest.php @@ -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); } } diff --git a/tests/bb-modules/Servicecustom/Api/Api_ClientTest.php b/tests/bb-modules/Servicecustom/Api/Api_ClientTest.php index 1d63f8002..89cc8bd00 100644 --- a/tests/bb-modules/Servicecustom/Api/Api_ClientTest.php +++ b/tests/bb-modules/Servicecustom/Api/Api_ClientTest.php @@ -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); } } diff --git a/tests/bb-modules/Servicecustom/ServiceTest.php b/tests/bb-modules/Servicecustom/ServiceTest.php index daa62dea3..824c4482e 100644 --- a/tests/bb-modules/Servicecustom/ServiceTest.php +++ b/tests/bb-modules/Servicecustom/ServiceTest.php @@ -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); } } diff --git a/tests/bb-modules/Servicedomain/Api/Api_AdminTest.php b/tests/bb-modules/Servicedomain/Api/Api_AdminTest.php index 6c72e6d9b..c4113e155 100644 --- a/tests/bb-modules/Servicedomain/Api/Api_AdminTest.php +++ b/tests/bb-modules/Servicedomain/Api/Api_AdminTest.php @@ -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); diff --git a/tests/bb-modules/Servicedomain/Api/Api_ClientTest.php b/tests/bb-modules/Servicedomain/Api/Api_ClientTest.php index 489f05500..66fb60acc 100644 --- a/tests/bb-modules/Servicedomain/Api/Api_ClientTest.php +++ b/tests/bb-modules/Servicedomain/Api/Api_ClientTest.php @@ -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); diff --git a/tests/bb-modules/Servicedomain/Api/Api_GuestTest.php b/tests/bb-modules/Servicedomain/Api/Api_GuestTest.php index ccff6719c..11078e18e 100644 --- a/tests/bb-modules/Servicedomain/Api/Api_GuestTest.php +++ b/tests/bb-modules/Servicedomain/Api/Api_GuestTest.php @@ -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); } diff --git a/tests/bb-modules/Servicedomain/ServiceTest.php b/tests/bb-modules/Servicedomain/ServiceTest.php index aa0cb1750..fd3a5484a 100644 --- a/tests/bb-modules/Servicedomain/ServiceTest.php +++ b/tests/bb-modules/Servicedomain/ServiceTest.php @@ -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); } -} +} \ No newline at end of file diff --git a/tests/bb-modules/Servicedownloadable/Api/AdminTest.php b/tests/bb-modules/Servicedownloadable/Api/AdminTest.php index 214e8f024..e9baa3852 100644 --- a/tests/bb-modules/Servicedownloadable/Api/AdminTest.php +++ b/tests/bb-modules/Servicedownloadable/Api/AdminTest.php @@ -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); } } diff --git a/tests/bb-modules/Servicedownloadable/Api/ClientTest.php b/tests/bb-modules/Servicedownloadable/Api/ClientTest.php index f9d0b46fc..c64e352c0 100644 --- a/tests/bb-modules/Servicedownloadable/Api/ClientTest.php +++ b/tests/bb-modules/Servicedownloadable/Api/ClientTest.php @@ -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); } diff --git a/tests/bb-modules/Servicedownloadable/ServiceTest.php b/tests/bb-modules/Servicedownloadable/ServiceTest.php index 3b3ddde06..5d0788371 100644 --- a/tests/bb-modules/Servicedownloadable/ServiceTest.php +++ b/tests/bb-modules/Servicedownloadable/ServiceTest.php @@ -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); } diff --git a/tests/bb-modules/Servicehosting/Api/AdminTest.php b/tests/bb-modules/Servicehosting/Api/AdminTest.php index 736dd2f43..26e40dcc2 100644 --- a/tests/bb-modules/Servicehosting/Api/AdminTest.php +++ b/tests/bb-modules/Servicehosting/Api/AdminTest.php @@ -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); } diff --git a/tests/bb-modules/Servicehosting/Api/ClientTest.php b/tests/bb-modules/Servicehosting/Api/ClientTest.php index 36521987d..b8d9ace4b 100644 --- a/tests/bb-modules/Servicehosting/Api/ClientTest.php +++ b/tests/bb-modules/Servicehosting/Api/ClientTest.php @@ -10,7 +10,7 @@ class ClientTest extends \BBTestCase { */ protected $api = null; - public function setup() + public function setup(): void { $this->api= new \Box\Mod\Servicehosting\Api\Client(); } @@ -42,7 +42,7 @@ class ClientTest extends \BBTestCase { $apiMock->setService($serviceMock); $result = $apiMock->change_username(array()); - $this->assertInternalType('bool', $result); + $this->assertIsBool($result); $this->assertTrue($result); } @@ -65,7 +65,7 @@ class ClientTest extends \BBTestCase { $apiMock->setService($serviceMock); $result = $apiMock->change_domain(array()); - $this->assertInternalType('bool', $result); + $this->assertIsBool($result); $this->assertTrue($result); } @@ -88,7 +88,7 @@ class ClientTest extends \BBTestCase { $apiMock->setService($serviceMock); $result = $apiMock->change_password(array()); - $this->assertInternalType('bool', $result); + $this->assertIsBool($result); $this->assertTrue($result); } @@ -101,7 +101,7 @@ class ClientTest extends \BBTestCase { $this->api->setService($serviceMock); $result = $this->api->hp_get_pairs(array()); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function test_getService() @@ -134,7 +134,7 @@ class ClientTest extends \BBTestCase { $clientModel->id = 1; $this->api->setIdentity($clientModel); $result = $this->api->_getService($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertInstanceOf('\Model_ClientOrder', $result[0]); $this->assertInstanceOf('\Model_ServiceHosting', $result[1]); } @@ -169,7 +169,8 @@ class ClientTest extends \BBTestCase { $clientModel->id = 1; $this->api->setIdentity($clientModel); - $this->setExpectedException('\Box_Exception', 'Order is not activated'); + $this->expectException(\Box_Exception::class); + $this->expectExceptionMessage('Order is not activated'); $this->api->_getService($data); } @@ -195,7 +196,8 @@ class ClientTest extends \BBTestCase { $clientModel->id = 1; $this->api->setIdentity($clientModel); - $this->setExpectedException('\Box_Exception', 'Order not found'); + $this->expectException(\Box_Exception::class); + $this->expectExceptionMessage('Order not found'); $this->api->_getService($data); } @@ -204,7 +206,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->_getService($data); } } diff --git a/tests/bb-modules/Servicehosting/Api/GuestTest.php b/tests/bb-modules/Servicehosting/Api/GuestTest.php index 96a780c06..3a951d59c 100644 --- a/tests/bb-modules/Servicehosting/Api/GuestTest.php +++ b/tests/bb-modules/Servicehosting/Api/GuestTest.php @@ -8,7 +8,7 @@ class GuestTest extends \BBTestCase */ protected $api = null; - public function setup() + public function setup(): void { $this->api = new \Box\Mod\Servicehosting\Api\Guest(); } @@ -46,7 +46,7 @@ class GuestTest extends \BBTestCase $this->api->setDi($di); $result = $this->api->free_tlds(array('product_id' => 1)); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testfree_tlds_ProductTypeIsNotHosting() @@ -77,7 +77,8 @@ class GuestTest extends \BBTestCase $this->api->setService($serviceMock); $this->api->setDi($di); - $this->setExpectedException('\Box_Exception', 'Product type is invalid'); + $this->expectException(\Box_Exception::class); + $this->expectExceptionMessage('Product type is invalid'); $this->api->free_tlds(array('product_id' => 1)); } } \ No newline at end of file diff --git a/tests/bb-modules/Servicehosting/ServiceTest.php b/tests/bb-modules/Servicehosting/ServiceTest.php index 518491c07..40d262671 100644 --- a/tests/bb-modules/Servicehosting/ServiceTest.php +++ b/tests/bb-modules/Servicehosting/ServiceTest.php @@ -10,7 +10,7 @@ class ServiceTest extends \BBTestCase { */ protected $service = null; - public function setup() + public function setup(): void { $this->service= new \Box\Mod\Servicehosting\Service(); } @@ -48,7 +48,8 @@ class ServiceTest extends \BBTestCase { unset ($data [ $field ]); - $this->setExpectedException('\Box_Exception', $exceptionMessage, $excCode); + $this->expectException(\Box_Exception::class); + $this->expectExceptionMessage($exceptionMessage, $excCode); $this->service->validateOrderData($data); } @@ -97,7 +98,7 @@ class ServiceTest extends \BBTestCase { $this->service->setDi($di); $this->service->action_create($orderModel); } - + public function testaction_activate() { $orderModel = new \Model_ClientOrder(); @@ -109,6 +110,7 @@ class ServiceTest extends \BBTestCase { 'sld' => 'great', 'tld' => 'com' ); + $orderServiceMock = $this->getMockBuilder('\Box\Mod\Order\Service')->getMock(); $orderServiceMock->expects($this->atLeastOnce()) ->method('getConfig') @@ -149,9 +151,9 @@ class ServiceTest extends \BBTestCase { $di['mod_service'] = $di->protect(function() use ($orderServiceMock) {return $orderServiceMock;}); $serviceMock->setDi($di); - + $orderModel->config = $confArr; $result = $serviceMock->action_activate($orderModel); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertNotEmpty($result['username']); $this->assertNotEmpty($result['password']); } @@ -197,7 +199,8 @@ class ServiceTest extends \BBTestCase { $di['mod_service'] = $di->protect(function() use ($orderServiceMock) {return $orderServiceMock;}); $this->service->setDi($di); - $this->setExpectedException('\Box_Exception', sprintf('Order %d has no active service', $orderModel->id)); + $this->expectException(\Box_Exception::class); + $this->expectExceptionMessage(sprintf('Order %d has no active service', $orderModel->id)); $this->service->action_renew($orderModel); } @@ -254,7 +257,8 @@ class ServiceTest extends \BBTestCase { $di['mod_service'] = $di->protect(function() use ($orderServiceMock) {return $orderServiceMock;}); $this->service->setDi($di); - $this->setExpectedException('\Box_Exception', sprintf('Order %d has no active service', $orderModel->id)); + $this->expectException(\Box_Exception::class); + $this->expectExceptionMessage(sprintf('Order %d has no active service', $orderModel->id)); $this->service->action_suspend($orderModel); } @@ -311,7 +315,8 @@ class ServiceTest extends \BBTestCase { $di['mod_service'] = $di->protect(function() use ($orderServiceMock) {return $orderServiceMock;}); $this->service->setDi($di); - $this->setExpectedException('\Box_Exception', sprintf('Order %d has no active service', $orderModel->id)); + $this->expectException(\Box_Exception::class); + $this->expectExceptionMessage(sprintf('Order %d has no active service', $orderModel->id)); $this->service->action_unsuspend($orderModel); } @@ -367,7 +372,8 @@ class ServiceTest extends \BBTestCase { $di['mod_service'] = $di->protect(function() use ($orderServiceMock) {return $orderServiceMock;}); $this->service->setDi($di); - $this->setExpectedException('\Box_Exception', sprintf('Order %d has no active service', $orderModel->id)); + $this->expectException(\Box_Exception::class); + $this->expectExceptionMessage(sprintf('Order %d has no active service', $orderModel->id)); $this->service->action_cancel($orderModel); } @@ -555,7 +561,8 @@ class ServiceTest extends \BBTestCase { $model->loadBean(new \RedBeanPHP\OODBBean()); $data = array(); - $this->setExpectedException('\Box_Exception', 'Account password is missing or is not valid'); + $this->expectException(\Box_Exception::class); + $this->expectExceptionMessage('Account password is missing or is not valid'); $this->service->changeAccountUsername($orderModel, $model, $data); } @@ -607,7 +614,8 @@ class ServiceTest extends \BBTestCase { $model = new \Model_ServiceHosting(); $model->loadBean(new \RedBeanPHP\OODBBean()); - $this->setExpectedException('\Box_Exception', 'Account ip is missing or is not valid'); + $this->expectException(\Box_Exception::class); + $this->expectExceptionMessage('Account ip is missing or is not valid'); $this->service->changeAccountIp($orderModel, $model, $data); } @@ -660,7 +668,8 @@ class ServiceTest extends \BBTestCase { $model = new \Model_ServiceHosting(); $model->loadBean(new \RedBeanPHP\OODBBean()); - $this->setExpectedException('\Box_Exception', 'Domain sld or tld is missing'); + $this->expectException(\Box_Exception::class); + $this->expectExceptionMessage('Domain sld or tld is missing'); $this->service->changeAccountDomain($orderModel, $model, $data); } @@ -713,7 +722,8 @@ class ServiceTest extends \BBTestCase { $model = new \Model_ServiceHosting(); $model->loadBean(new \RedBeanPHP\OODBBean()); - $this->setExpectedException('\Box_Exception', 'Account password is missing or is not valid'); + $this->expectException(\Box_Exception::class); + $this->expectExceptionMessage('Account password is missing or is not valid'); $this->service->changeAccountPassword($orderModel, $model, $data); } @@ -799,7 +809,7 @@ class ServiceTest extends \BBTestCase { $this->service->setDi($di); $result = $this->service->toApiArray($model, false, new \Model_Admin()); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testupdate() @@ -827,7 +837,7 @@ class ServiceTest extends \BBTestCase { public function testgetServerManagers() { $result = $this->service->getServerManagers(); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testgetServerManagerConfig() @@ -839,7 +849,7 @@ class ServiceTest extends \BBTestCase { ); $result = $this->service->getServerManagerConfig($manager); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertEquals($expected, $result); } @@ -870,15 +880,15 @@ class ServiceTest extends \BBTestCase { $this->service->setDi($di); $result = $this->service->getServerPairs(); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertEquals($expected, $result); } public function testgetServerSearchQuery() { $result = $this->service->getServersSearchQuery(array()); - $this->assertInternalType('string', $result[0]); - $this->assertInternalType('array', $result[1]); + $this->assertIsString($result[0]); + $this->assertIsArray($result[1]); $this->assertEquals(array(), $result[1]); } @@ -911,7 +921,7 @@ class ServiceTest extends \BBTestCase { $manager = 'Custom'; $data = array(); $result = $this->service->createServer($name, $ip, $manager, $data); - $this->assertInternalType('int', $result); + $this->assertIsInt($result); $this->assertEquals($newId, $result); } @@ -996,7 +1006,9 @@ class ServiceTest extends \BBTestCase { $hostingServerModel = new \Model_ServiceHostingServer(); $hostingServerModel->loadBean(new \RedBeanPHP\OODBBean()); - $this->setExpectedException('\Box_Exception', 'Invalid server manager. Server was not configured properly', 654); + $this->expectException(\Box_Exception::class); + $this->expectExceptionCode(654); + $this->expectExceptionMessage('Invalid server manager. Server was not configured properly'); $this->service->getServerManager($hostingServerModel); } @@ -1012,7 +1024,8 @@ class ServiceTest extends \BBTestCase { }); $this->service->setDi($di); - $this->setExpectedException('\Box_Exception', sprintf('Server manager %s is not valid', $hostingServerModel->manager)); + $this->expectException(\Box_Exception::class); + $this->expectExceptionMessage(sprintf('Server manager %s is not valid', $hostingServerModel->manager)); $this->service->getServerManager($hostingServerModel); } @@ -1033,7 +1046,7 @@ class ServiceTest extends \BBTestCase { $hostingServerModel = new \Model_ServiceHostingServer(); $result = $serviceMock->testConnection($hostingServerModel ); - $this->assertInternalType('bool', $result); + $this->assertIsBool($result); $this->assertTrue($result); } @@ -1064,15 +1077,15 @@ class ServiceTest extends \BBTestCase { $this->service->setDi($di); $result = $this->service->getHpPairs(); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertEquals($expected, $result); } public function testgetHpSearchQuery() { $result = $this->service->getServersSearchQuery(array()); - $this->assertInternalType('string', $result[0]); - $this->assertInternalType('array', $result[1]); + $this->assertIsString($result[0]); + $this->assertIsArray($result[1]); $this->assertEquals(array(), $result[1]); } @@ -1100,7 +1113,7 @@ class ServiceTest extends \BBTestCase { $model->loadBean(new \RedBeanPHP\OODBBean()); $result = $this->service->toHostingHpApiArray($model); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testUpdateHp() @@ -1158,7 +1171,7 @@ class ServiceTest extends \BBTestCase { $this->service->setDi($di); $result = $this->service->createHp('Free Plan', array()); - $this->assertInternalType('int', $result); + $this->assertIsInt($result); $this->assertEquals($newId, $result); } @@ -1230,9 +1243,9 @@ class ServiceTest extends \BBTestCase { ->will($this->returnValue($serverManagerMock)); $result = $serviceMock->getMangerUrls($hostingServerModel); - $this->assertInternalType('array', $result); - $this->assertInternalType('string', $result[0]); - $this->assertInternalType('string', $result[1]); + $this->assertIsArray($result); + $this->assertIsString($result[0]); + $this->assertIsString($result[1]); } public function testgetMangerUrlsException() @@ -1249,7 +1262,7 @@ class ServiceTest extends \BBTestCase { ->will($this->throwException(new \Exception('Controlled unit test exception'))); $result = $serviceMock->getMangerUrls($hostingServerModel); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertFalse($result[0]); $this->assertFalse($result[1]); } @@ -1288,7 +1301,7 @@ class ServiceTest extends \BBTestCase { $model = new \Model_Product(); $model->loadBean(new \RedBeanPHP\OODBBean()); $result = $this->service->getFreeTlds($model); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } @@ -1312,10 +1325,10 @@ class ServiceTest extends \BBTestCase { $model = new \Model_Product(); $model->loadBean(new \RedBeanPHP\OODBBean()); $result = $this->service->getFreeTlds($model); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertNotEmpty($result); } -} +} \ No newline at end of file diff --git a/tests/bb-modules/Servicelicense/Api/AdminTest.php b/tests/bb-modules/Servicelicense/Api/AdminTest.php index bfbe951e5..047ef6e74 100644 --- a/tests/bb-modules/Servicelicense/Api/AdminTest.php +++ b/tests/bb-modules/Servicelicense/Api/AdminTest.php @@ -10,7 +10,7 @@ class AdminTest extends \BBTestCase { */ protected $api = null; - public function setup() + public function setup(): void { $this->api= new \Box\Mod\Servicelicense\Api\Admin(); } @@ -43,7 +43,7 @@ class AdminTest extends \BBTestCase { $this->api->setService($serviceMock); $result = $this->api->plugin_get_pairs(array()); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertEquals($expected, $result); } @@ -68,7 +68,7 @@ class AdminTest extends \BBTestCase { $apiMock->setService($serviceMock); $result = $apiMock->update($data); - $this->assertInternalType('bool', $result); + $this->assertIsBool($result); $this->assertTrue($result); } @@ -93,7 +93,7 @@ class AdminTest extends \BBTestCase { $apiMock->setService($serviceMock); $result = $apiMock->reset($data); - $this->assertInternalType('bool', $result); + $this->assertIsBool($result); $this->assertTrue($result); } @@ -151,7 +151,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); } diff --git a/tests/bb-modules/Servicelicense/Api/ClientTest.php b/tests/bb-modules/Servicelicense/Api/ClientTest.php index a086cc948..0fac392e4 100644 --- a/tests/bb-modules/Servicelicense/Api/ClientTest.php +++ b/tests/bb-modules/Servicelicense/Api/ClientTest.php @@ -10,7 +10,7 @@ class ClientTest extends \BBTestCase { */ protected $api = null; - public function setup() + public function setup(): void { $this->api= new \Box\Mod\Servicelicense\Api\Client(); } @@ -44,7 +44,7 @@ class ClientTest extends \BBTestCase { $apiMock->setService($serviceMock); $result = $apiMock->reset($data); - $this->assertInternalType('bool', $result); + $this->assertIsBool($result); $this->assertTrue($result); } @@ -112,7 +112,8 @@ class ClientTest extends \BBTestCase { $clientModel->loadBean(new \RedBeanPHP\OODBBean()); $this->api->setIdentity($clientModel); - $this->setExpectedException('\Box_Exception', 'Order is not activated'); + $this->expectException(\Box_Exception::class); + $this->expectExceptionMessage('Order is not activated'); $this->api->_getService($data); } } diff --git a/tests/bb-modules/Servicelicense/Api/GuestTest.php b/tests/bb-modules/Servicelicense/Api/GuestTest.php index 82d1e7cd1..4c162bd91 100644 --- a/tests/bb-modules/Servicelicense/Api/GuestTest.php +++ b/tests/bb-modules/Servicelicense/Api/GuestTest.php @@ -10,7 +10,7 @@ class GuestTest extends \BBTestCase { */ protected $api = null; - public function setup() + public function setup(): void { $this->api= new \Box\Mod\Servicelicense\Api\Guest(); } @@ -45,7 +45,7 @@ class GuestTest extends \BBTestCase { $this->api->setService($serviceMock); $result = $this->api->check($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } } \ No newline at end of file diff --git a/tests/bb-modules/Servicelicense/ServiceTest.php b/tests/bb-modules/Servicelicense/ServiceTest.php index 2e42a0b4f..ffa662010 100644 --- a/tests/bb-modules/Servicelicense/ServiceTest.php +++ b/tests/bb-modules/Servicelicense/ServiceTest.php @@ -11,7 +11,7 @@ class ServiceTest extends \BBTestCase */ protected $service = null; - public function setup() + public function setup(): void { $this->service = new \Box\Mod\Servicelicense\Service(); } @@ -32,7 +32,7 @@ class ServiceTest extends \BBTestCase $data = array(); $result = $this->service->attachOrderConfig($productModel, $data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertEquals(array(), $result); } @@ -45,14 +45,14 @@ class ServiceTest extends \BBTestCase $expected = array_merge(json_decode($productModel->config, 1), $data); $result = $this->service->attachOrderConfig($productModel, $data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertEquals($expected, $result); } public function testgetLicensePlugins() { $result = $this->service->getLicensePlugins(); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testaction_create() @@ -139,15 +139,9 @@ class ServiceTest extends \BBTestCase $dbMock = $this->getMockBuilder('\Box_Database')->getMock(); $dbMock->expects($this->atLeastOnce()) ->method('store'); - $dbMock->expects($this->at(0)) + $dbMock->expects($this->exactly(3)) ->method('findOne') - ->will($this->returnValue($serviceLicenseModel)); - $dbMock->expects($this->at(1)) - ->method('findOne') - ->will($this->returnValue($serviceLicenseModel)); - $dbMock->expects($this->at(2)) - ->method('findOne') - ->will($this->returnValue(null)); + ->will($this->onConsecutiveCalls($serviceLicenseModel, $serviceLicenseModel, null)); $di = new \Box_Di(); $di['db'] = $dbMock; @@ -161,9 +155,6 @@ class ServiceTest extends \BBTestCase $this->assertTrue($result); } - /** - * @expectedException \Box_Exception - */ public function testaction_activateLicenseCollisionMaxIterationsException() { $clientOrderModel = new \Model_ClientOrder(); @@ -196,6 +187,7 @@ class ServiceTest extends \BBTestCase }); $this->service->setDi($di); + $this->expectException(\Box_Exception::class); $result = $this->service->action_activate($clientOrderModel); $this->assertTrue($result); } @@ -224,7 +216,8 @@ class ServiceTest extends \BBTestCase }); $this->service->setDi($di); - $this->setExpectedException('\Box_Exception', sprintf('License plugin %s was not found', $serviceLicenseModel->plugin)); + $this->expectException(\Box_Exception::class); + $this->expectExceptionMessage(sprintf('License plugin %s was not found', $serviceLicenseModel->plugin)); $this->service->action_activate($clientOrderModel); } @@ -248,7 +241,8 @@ class ServiceTest extends \BBTestCase }); $this->service->setDi($di); - $this->setExpectedException('\Box_Exception', 'Could not activate order. Service was not created'); + $this->expectException(\Box_Exception::class); + $this->expectExceptionMessage('Could not activate order. Service was not created'); $this->service->action_activate($clientOrderModel); } @@ -556,7 +550,7 @@ class ServiceTest extends \BBTestCase $serviceLicenseModel->plugin = 'Simple'; $result = $this->service->getAdditionalParams($serviceLicenseModel); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testgetOwnerName() @@ -582,7 +576,7 @@ class ServiceTest extends \BBTestCase $this->service->setDi($di); $result = $this->service->getOwnerName($serviceLicenseModel); - $this->assertInternalType('string', $result); + $this->assertIsString($result); $this->assertEquals($expected, $result); } @@ -607,7 +601,7 @@ class ServiceTest extends \BBTestCase $this->service->setDi($di); $result = $this->service->getExpirationDate($serviceLicenseModel); - $this->assertInternalType('string', $result); + $this->assertIsString($result); $this->assertEquals($expected, $result); } @@ -631,7 +625,7 @@ class ServiceTest extends \BBTestCase ); $result = $this->service->toApiArray($serviceLicenseModel, false, new \Model_Admin()); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertTrue(count(array_diff(array_keys($expected), array_keys($result))) == 0, 'Missing array key values.'); } @@ -662,7 +656,7 @@ class ServiceTest extends \BBTestCase $this->service->setDi($di); $result = $this->service->update($serviceLicenseModel, $data); - $this->assertInternalType('bool', $result); + $this->assertIsBool($result); $this->assertTrue($result); } @@ -692,12 +686,12 @@ class ServiceTest extends \BBTestCase $result = $this->service->checkLicenseDetails($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertArrayHasKey('error', $result); $this->assertArrayHasKey('error_code', $result); } - public function testcheckLicenseDetails() + public function testCheckLicenseDetails() { $loggerMock = $this->getMockBuilder('\Box_Log') ->getMock(); @@ -721,7 +715,7 @@ class ServiceTest extends \BBTestCase $result = $this->service->checkLicenseDetails($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } } - + \ No newline at end of file diff --git a/tests/bb-modules/Servicesolusvm/SolusVMTest.php b/tests/bb-modules/Servicesolusvm/SolusVMTest.php index 9d22babd4..c842edaad 100644 --- a/tests/bb-modules/Servicesolusvm/SolusVMTest.php +++ b/tests/bb-modules/Servicesolusvm/SolusVMTest.php @@ -25,7 +25,7 @@ class SolusVMTest extends \BBTestCase { $solusVm = new SolusVM(); $result = $solusVm->buildUrl($config); - $this->assertInternalType('string', $result); + $this->assertIsString($result); $this->assertNotEmpty($result); $expected = $config['protocol'] ."://". $config['ipaddress'] . ":" . $config['port'] . "/api/" . $config['usertype'] . "/command.php"; diff --git a/tests/bb-modules/Spamchecker/Api/GuestTest.php b/tests/bb-modules/Spamchecker/Api/GuestTest.php index 78fb65fec..36d9cb3cc 100644 --- a/tests/bb-modules/Spamchecker/Api/GuestTest.php +++ b/tests/bb-modules/Spamchecker/Api/GuestTest.php @@ -10,7 +10,7 @@ class GuestTest extends \BBTestCase */ protected $api = null; - public function setup() + public function setup(): void { $this->api = new \Box\Mod\Spamchecker\Api\Guest(); } diff --git a/tests/bb-modules/Spamchecker/ServiceTest.php b/tests/bb-modules/Spamchecker/ServiceTest.php index a91c5ef92..8bbd87170 100644 --- a/tests/bb-modules/Spamchecker/ServiceTest.php +++ b/tests/bb-modules/Spamchecker/ServiceTest.php @@ -11,7 +11,7 @@ class ServiceTest extends \BBTestCase { */ protected $service = null; - public function setup() + public function setup(): void { $this->service= new \Box\Mod\Spamchecker\Service(); } @@ -80,6 +80,9 @@ class ServiceTest extends \BBTestCase { ->willReturn($di); $this->service->onBeforeClientCreateForumTopic($boxEventMock); + + //TODO maybe we can write better test here? + $this->assertTrue(true); } public function testonBeforeClientRepliedInForum() @@ -171,7 +174,8 @@ class ServiceTest extends \BBTestCase { ->method('getDi') ->willReturn($di); - $this->setExpectedException('\Box_Exception', sprintf("IP %s is blocked", $clientIp), 403); + $this->expectException(\Box_Exception::class); + $this->expectExceptionMessage(sprintf("IP %s is blocked", $clientIp), 403); $this->service->isBlockedIp($boxEventMock); } @@ -275,7 +279,8 @@ class ServiceTest extends \BBTestCase { $data = array(); $this->service->setDi($di); - $this->setExpectedException('Box_Exception', $exceptionMessage); + $this->expectException(\Box_Exception::class); + $this->expectExceptionMessage($exceptionMessage); $this->service->isInStopForumSpamDatabase($data); } diff --git a/tests/bb-modules/Staff/Api/AdminTest.php b/tests/bb-modules/Staff/Api/AdminTest.php index 101458b26..68675a8a3 100644 --- a/tests/bb-modules/Staff/Api/AdminTest.php +++ b/tests/bb-modules/Staff/Api/AdminTest.php @@ -10,7 +10,7 @@ class AdminTest extends \BBTestCase { */ protected $api = null; - public function setup() + public function setup(): void { $this->api= new \Box\Mod\Staff\Api\Admin(); } @@ -61,7 +61,7 @@ class AdminTest extends \BBTestCase { $this->api->setService($serviceMock); $result = $this->api->get_list($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testget() @@ -89,7 +89,7 @@ class AdminTest extends \BBTestCase { $this->api->setDi($di); $result = $this->api->get($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testupdate() @@ -117,7 +117,7 @@ class AdminTest extends \BBTestCase { $this->api->setService($serviceMock); $result = $this->api->update($data); - $this->assertInternalType('bool', $result); + $this->assertIsBool($result); $this->assertTrue($result); } @@ -146,7 +146,7 @@ class AdminTest extends \BBTestCase { $this->api->setService($serviceMock); $result = $this->api->delete($data); - $this->assertInternalType('bool', $result); + $this->assertIsBool($result); $this->assertTrue($result); } @@ -202,7 +202,8 @@ class AdminTest extends \BBTestCase { $di['validator'] = $validatorMock; $this->api->setDi($di); - $this->setExpectedException('\Box_Exception', 'Passwords do not match'); + $this->expectException(\Box_Exception::class); + $this->expectExceptionMessage('Passwords do not match'); $this->api->change_password($data); } @@ -233,7 +234,7 @@ class AdminTest extends \BBTestCase { $this->api->setService($serviceMock); $result = $this->api->create($data); - $this->assertInternalType('int', $result); + $this->assertIsInt($result); $this->assertEquals($newStaffId, $result); } @@ -265,7 +266,7 @@ class AdminTest extends \BBTestCase { $this->api->setService($serviceMock); $result = $this->api->permissions_get($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testpermissions_update() @@ -301,7 +302,7 @@ class AdminTest extends \BBTestCase { $this->api->setService($serviceMock); $result = $this->api->permissions_update($data); - $this->assertInternalType('bool', $result); + $this->assertIsBool($result); $this->assertTrue($result); } @@ -314,7 +315,7 @@ class AdminTest extends \BBTestCase { $this->api->setService($serviceMock); $result = $this->api->group_get_pairs(array()); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testgroup_get_list() @@ -341,7 +342,7 @@ class AdminTest extends \BBTestCase { $this->api->setService($serviceMock); $result = $this->api->group_get_list($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testgroup_create() @@ -365,7 +366,7 @@ class AdminTest extends \BBTestCase { $this->api->setService($serviceMock); $result = $this->api->group_create($data); - $this->assertInternalType('int', $result); + $this->assertIsInt($result); $this->assertEquals($newGroupId, $result); } @@ -396,7 +397,7 @@ class AdminTest extends \BBTestCase { $this->api->setService($serviceMock); $result = $this->api->group_get($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testgroup_delete() @@ -425,7 +426,7 @@ class AdminTest extends \BBTestCase { $this->api->setService($serviceMock); $result = $this->api->group_delete($data); - $this->assertInternalType('bool', $result); + $this->assertIsBool($result); $this->assertTrue($result); } @@ -455,7 +456,7 @@ class AdminTest extends \BBTestCase { $this->api->setService($serviceMock); $result = $this->api->group_update($data); - $this->assertInternalType('bool', $result); + $this->assertIsBool($result); $this->assertTrue($result); } @@ -497,7 +498,7 @@ class AdminTest extends \BBTestCase { $this->api->setService($serviceMock); $result = $this->api->login_history_get_list($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testlogin_history_get() @@ -526,7 +527,7 @@ class AdminTest extends \BBTestCase { $this->api->setService($serviceMock); $result = $this->api->login_history_get($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testlogin_history_delete() @@ -555,7 +556,7 @@ class AdminTest extends \BBTestCase { $this->api->setService($serviceMock); $result = $this->api->login_history_delete($data); - $this->assertInternalType('bool', $result); + $this->assertIsBool($result); $this->assertTrue($result); } diff --git a/tests/bb-modules/Staff/Api/GuestTest.php b/tests/bb-modules/Staff/Api/GuestTest.php index f8eb2f429..dd5e17bd4 100644 --- a/tests/bb-modules/Staff/Api/GuestTest.php +++ b/tests/bb-modules/Staff/Api/GuestTest.php @@ -9,7 +9,7 @@ class GuestTest extends \BBTestCase */ protected $api = null; - public function setup() + public function setup(): void { $this->api= new \Box\Mod\Staff\Api\Guest(); } @@ -78,7 +78,9 @@ class GuestTest extends \BBTestCase 'password' => 'EasyToGuess', ); - $this->setExpectedException('\Box_Exception', 'Administrator account already exists', 55); + $this->expectException(\Box_Exception::class); + $this->expectExceptionCode(55); + $this->expectExceptionMessage('Administrator account already exists'); $this->api->create($data); } @@ -93,6 +95,7 @@ class GuestTest extends \BBTestCase $di['validator'] = new \Box_Validate(); $guestApi->setDi($di); + $this->expectException(\Box_Exception::class); $guestApi->login(array()); } @@ -107,6 +110,7 @@ class GuestTest extends \BBTestCase $di['validator'] = new \Box_Validate(); $guestApi->setDi($di); + $this->expectException(\Box_Exception::class); $guestApi->login(array('email'=>'email@domain.com')); } @@ -137,7 +141,7 @@ class GuestTest extends \BBTestCase $guestApi->setService($serviceMock); $guestApi->setDi($di); $result = $guestApi->login(array('email'=>'email@domain.com', 'password'=>'pass')); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testLoginCheckIpException() @@ -166,7 +170,9 @@ class GuestTest extends \BBTestCase $ip = '192.168.0.1'; $guestApi->setIp($ip); - $this->setExpectedException('\Box_Exception', sprintf('You are not allowed to login to admin area from %s address', $ip), 403); + $this->expectException(\Box_Exception::class); + $this->expectExceptionCode(403); + $this->expectExceptionMessage(sprintf('You are not allowed to login to admin area from %s address', $ip)); $data = array( 'email' => 'email@domain.com', diff --git a/tests/bb-modules/Staff/ServiceTest.php b/tests/bb-modules/Staff/ServiceTest.php index cc24010dc..0c5a0f3c7 100644 --- a/tests/bb-modules/Staff/ServiceTest.php +++ b/tests/bb-modules/Staff/ServiceTest.php @@ -101,7 +101,9 @@ class ServiceTest extends \BBTestCase $service = new \Box\Mod\Staff\Service(); $service->setDi($di); - $this->setExpectedException('\Box_Exception', 'Check your login details', 403); + $this->expectException(\Box_Exception::class); + $this->expectExceptionCode(403); + $this->expectExceptionMessage('Check your login details'); $service->login($email, $password, $ip); } @@ -122,7 +124,7 @@ class ServiceTest extends \BBTestCase $service->setDi($di); $result = $service->getAdminsCount(); - $this->assertInternalType('int', $result); + $this->assertIsInt($result); $this->assertEquals($countResult, $result); } @@ -795,7 +797,7 @@ class ServiceTest extends \BBTestCase $service->setDi($di); $result = $service->getList(array()); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function searchFilters() @@ -832,8 +834,8 @@ class ServiceTest extends \BBTestCase $service = new \Box\Mod\Staff\Service(); $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->assertTrue(strpos($result[0], $expectedStr) !== false, $result[0]); $this->assertTrue(array_diff_key($result[1], $expectedParams) == array()); @@ -930,7 +932,7 @@ class ServiceTest extends \BBTestCase $result = $service->toModel_AdminApiiArray($adminModel); $this->assertNotEmpty($result); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertTrue(count(array_diff(array_keys($expected), array_keys($result))) == 0, 'Missing array key values.'); } @@ -1007,7 +1009,8 @@ class ServiceTest extends \BBTestCase $service = new \Box\Mod\Staff\Service(); - $this->setExpectedException('\Box_Exception', 'This administrator account is protected and can not be removed'); + $this->expectException(\Box_Exception::class); + $this->expectExceptionMessage('This administrator account is protected and can not be removed'); $service->delete($adminModel); } @@ -1097,7 +1100,7 @@ class ServiceTest extends \BBTestCase $service->setDi($di); $result = $service->create($data); - $this->assertInternalType('int', $result); + $this->assertIsInt($result); $this->assertEquals($newId, $result); } @@ -1152,7 +1155,9 @@ class ServiceTest extends \BBTestCase $service = new \Box\Mod\Staff\Service(); $service->setDi($di); - $this->setExpectedException('\Box_Exception', sprintf('Staff member with email %s is already registered', $data['email']), 788954); + $this->expectException(\Box_Exception::class); + $this->expectExceptionCode(788954); + $this->expectExceptionMessage(sprintf('Staff member with email %s is already registered', $data['email'])); $service->create($data); } @@ -1221,7 +1226,7 @@ class ServiceTest extends \BBTestCase $service->setDi($di); $result = $service->createAdmin($data); - $this->assertInternalType('int', $result); + $this->assertIsInt($result); $this->assertEquals($newId, $result); } @@ -1257,7 +1262,7 @@ class ServiceTest extends \BBTestCase $result = $service->getAdminGroupPair(); $this->assertEquals($expected, $result); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testgetAdminGroupSearchQuery() @@ -1266,8 +1271,8 @@ class ServiceTest extends \BBTestCase $result = $service->getAdminGroupSearchQuery(array()); - $this->assertInternalType('string', $result[0]); - $this->assertInternalType('array', $result[1]); + $this->assertIsString($result[0]); + $this->assertIsArray($result[1]); } public function testcreateGroup() @@ -1297,7 +1302,7 @@ class ServiceTest extends \BBTestCase $service->setDi($di); $result = $service->createGroup('new_group_name'); - $this->assertInternalType('int', $result); + $this->assertIsInt($result); $this->assertEquals($newGroupId, $result); } @@ -1318,7 +1323,7 @@ class ServiceTest extends \BBTestCase $result = $service->toAdminGroupApiArray($adminGroupModel); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertTrue(count(array_diff(array_keys($expected), array_keys($result))) == 0, 'Missing array key values.'); } @@ -1342,7 +1347,7 @@ class ServiceTest extends \BBTestCase $service->setDi($di); $result = $service->deleteGroup($adminGroupModel); - $this->assertInternalType('bool', $result); + $this->assertIsBool($result); $this->assertTrue($result); } @@ -1354,7 +1359,8 @@ class ServiceTest extends \BBTestCase $service = new \Box\Mod\Staff\Service(); - $this->setExpectedException('\Box_Exception', 'Administrators group can not be removed'); + $this->expectException(\Box_Exception::class); + $this->expectExceptionMessage('Administrators group can not be removed'); $service->deleteGroup($adminGroupModel); } @@ -1374,7 +1380,8 @@ class ServiceTest extends \BBTestCase $service = new \Box\Mod\Staff\Service(); $service->setDi($di); - $this->setExpectedException('\Box_Exception', 'Can not remove group which has staff members'); + $this->expectException(\Box_Exception::class); + $this->expectExceptionMessage('Can not remove group which has staff members'); $service->deleteGroup($adminGroupModel); } @@ -1396,7 +1403,7 @@ class ServiceTest extends \BBTestCase $data = array('name' => 'OhExampleName'); $result = $service->updateGroup($adminGroupModel, $data); - $this->assertInternalType('bool', $result); + $this->assertIsBool($result); $this->assertTrue($result); } @@ -1431,8 +1438,8 @@ class ServiceTest extends \BBTestCase $service = new \Box\Mod\Staff\Service(); $service->setDi($di); $result = $service->getActivityAdminHistorySearchQuery($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()); @@ -1473,7 +1480,7 @@ class ServiceTest extends \BBTestCase $result = $service->toActivityAdminHistoryApiArray($adminHistoryModel); $this->assertNotEmpty($result); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertTrue(count(array_diff(array_keys($expected), array_keys($result))) == 0, 'Missing array key values.'); } @@ -1542,7 +1549,7 @@ class ServiceTest extends \BBTestCase $member_id = 1; $result = $service->getPermissions($member_id); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertEquals(array(), $result); } @@ -1571,7 +1578,7 @@ class ServiceTest extends \BBTestCase $member_id = 1; $expected = json_decode($queryResult, 1); $result = $service->getPermissions($member_id); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertEquals($expected, $result); } @@ -1628,4 +1635,4 @@ class ServiceTest extends \BBTestCase $this->assertInstanceOf('\Model_Admin', $result); } } - + \ No newline at end of file diff --git a/tests/bb-modules/Stats/Api/AdminTest.php b/tests/bb-modules/Stats/Api/AdminTest.php index 6893d6908..cd8359d69 100644 --- a/tests/bb-modules/Stats/Api/AdminTest.php +++ b/tests/bb-modules/Stats/Api/AdminTest.php @@ -10,7 +10,7 @@ class AdminTest extends \BBTestCase { */ protected $api = null; - public function setup() + public function setup(): void { $this->api= new \Box\Mod\Stats\Api\Admin(); } @@ -33,7 +33,7 @@ class AdminTest extends \BBTestCase { $this->api->setService($serviceMock); $result = $this->api->get_summary(); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testget_summary_income() @@ -46,7 +46,7 @@ class AdminTest extends \BBTestCase { $this->api->setService($serviceMock); $result = $this->api->get_summary_income(); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testget_orders_statuses() @@ -60,7 +60,7 @@ class AdminTest extends \BBTestCase { $data = array(); $result = $this->api->get_orders_statuses($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testget_product_summary() @@ -74,7 +74,7 @@ class AdminTest extends \BBTestCase { $data = array(); $result = $this->api->get_product_summary($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testget_product_sales() @@ -88,7 +88,7 @@ class AdminTest extends \BBTestCase { $data = array(); $result = $this->api->get_product_sales($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testget_income_vs_refunds() @@ -102,7 +102,7 @@ class AdminTest extends \BBTestCase { $data = array(); $result = $this->api->get_income_vs_refunds($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testget_refunds() @@ -116,7 +116,7 @@ class AdminTest extends \BBTestCase { $data = array(); $result = $this->api->get_refunds($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testget_income() @@ -130,7 +130,7 @@ class AdminTest extends \BBTestCase { $data = array(); $result = $this->api->get_income($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testget_orders() @@ -144,7 +144,7 @@ class AdminTest extends \BBTestCase { $data = array(); $result = $this->api->get_orders($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testget_clients() @@ -158,7 +158,7 @@ class AdminTest extends \BBTestCase { $data = array(); $result = $this->api->get_clients($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testclient_countries() @@ -172,7 +172,7 @@ class AdminTest extends \BBTestCase { $data = array(); $result = $this->api->client_countries($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testsales_countries() @@ -186,7 +186,7 @@ class AdminTest extends \BBTestCase { $data = array(); $result = $this->api->sales_countries($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testget_invoices() @@ -200,7 +200,7 @@ class AdminTest extends \BBTestCase { $data = array(); $result = $this->api->get_invoices($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testget_tickets() @@ -214,7 +214,7 @@ class AdminTest extends \BBTestCase { $data = array(); $result = $this->api->get_tickets($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } } \ No newline at end of file diff --git a/tests/bb-modules/Stats/ServiceTest.php b/tests/bb-modules/Stats/ServiceTest.php index f2e6ca646..7f38e56d8 100644 --- a/tests/bb-modules/Stats/ServiceTest.php +++ b/tests/bb-modules/Stats/ServiceTest.php @@ -18,7 +18,7 @@ class ServiceTest extends \BBTestCase { */ protected $service = null; - public function setup() + public function setup(): void { $this->service= new \Box\Mod\Stats\Service(); } @@ -45,7 +45,7 @@ class ServiceTest extends \BBTestCase { $this->service->setDi($di); $result = $this->service->getOrdersStatuses(array()); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testgetProductSummary() @@ -62,7 +62,7 @@ class ServiceTest extends \BBTestCase { $this->service->setDi($di); $result = $this->service->getProductSummary($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testgetSummary() @@ -110,7 +110,7 @@ class ServiceTest extends \BBTestCase { $this->service->setDi($di); $result = $this->service->getSummary(); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertEquals($expected, $result); } @@ -141,7 +141,7 @@ class ServiceTest extends \BBTestCase { ); $result = $this->service->getSummaryIncome(); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertEquals($expected, $result); } @@ -173,7 +173,7 @@ class ServiceTest extends \BBTestCase { 'date_to' => 'now', ); $result = $this->service->getProductSales($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testincomeAndRefundStats() @@ -203,7 +203,7 @@ class ServiceTest extends \BBTestCase { $this->service->setDi($di); $result = $this->service->incomeAndRefundStats(array()); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertEquals($res[0], $result); } @@ -235,7 +235,7 @@ class ServiceTest extends \BBTestCase { 'date_to' => 'now', ); $result = $this->service->getRefunds($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testgetIncome() @@ -266,7 +266,7 @@ class ServiceTest extends \BBTestCase { 'date_to' => 'now', ); $result = $this->service->getIncome($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testgetClientCountries() @@ -293,7 +293,7 @@ class ServiceTest extends \BBTestCase { $this->service->setDi($di); $result = $this->service->getClientCountries(array()); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testgetSalesByCountry() @@ -320,7 +320,7 @@ class ServiceTest extends \BBTestCase { $this->service->setDi($di); $result = $this->service->getSalesByCountry(array()); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testgetTableStats() @@ -351,7 +351,7 @@ class ServiceTest extends \BBTestCase { 'date_to' => 'now', ); $result = $this->service->getTableStats('TableName', $data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } } \ No newline at end of file diff --git a/tests/bb-modules/Support/Api/Api_AdminTest.php b/tests/bb-modules/Support/Api/Api_AdminTest.php index 52e99e7ea..dde2104a3 100644 --- a/tests/bb-modules/Support/Api/Api_AdminTest.php +++ b/tests/bb-modules/Support/Api/Api_AdminTest.php @@ -8,7 +8,7 @@ class Api_AdminTest extends \BBTestCase */ protected $adminApi = null; - public function setup() + public function setup(): void { $this->adminApi = new \Box\Mod\Support\Api\Admin(); } @@ -53,7 +53,7 @@ class Api_AdminTest extends \BBTestCase $data = array(); $result = $this->adminApi->ticket_get_list($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testTicket_get() @@ -85,7 +85,7 @@ class Api_AdminTest extends \BBTestCase ); $result = $this->adminApi->ticket_get($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testTicket_update() @@ -328,7 +328,7 @@ class Api_AdminTest extends \BBTestCase ); $result = $this->adminApi->ticket_create($data); - $this->assertInternalType('integer', $result); + $this->assertIsInt($result); $this->assertEquals($randID, $result); } @@ -513,7 +513,7 @@ class Api_AdminTest extends \BBTestCase $data = array(); $result = $this->adminApi->public_ticket_get_list($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testPublic_ticket_create() @@ -544,7 +544,7 @@ class Api_AdminTest extends \BBTestCase ); $result = $this->adminApi->public_ticket_create($data); - $this->assertInternalType('integer', $result); + $this->assertIsInt($result); $this->assertEquals($randID, $result); } @@ -578,7 +578,7 @@ class Api_AdminTest extends \BBTestCase ); $result = $this->adminApi->public_ticket_get($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testPublic_ticket_delete() @@ -782,7 +782,7 @@ class Api_AdminTest extends \BBTestCase $data = array(); $result = $this->adminApi->helpdesk_get_list($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testHelpdeks_get_pairs() @@ -797,7 +797,7 @@ class Api_AdminTest extends \BBTestCase $data = array(); $result = $this->adminApi->helpdesk_get_pairs($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testHelpdesk_get() @@ -965,7 +965,7 @@ class Api_AdminTest extends \BBTestCase $data = array(); $result = $this->adminApi->canned_get_list($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testCannedPairs() @@ -982,7 +982,7 @@ class Api_AdminTest extends \BBTestCase $data = array(); $result = $this->adminApi->canned_pairs($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testCanned_get() @@ -1015,7 +1015,7 @@ class Api_AdminTest extends \BBTestCase ); $result = $this->adminApi->canned_get($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testCanned_delete() @@ -1048,7 +1048,7 @@ class Api_AdminTest extends \BBTestCase ); $result = $this->adminApi->canned_delete($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testCanned_create() @@ -1080,7 +1080,7 @@ class Api_AdminTest extends \BBTestCase ); $result = $this->adminApi->canned_create($data); - $this->assertInternalType('integer', $result); + $this->assertIsInt($result); } public function testCanned_update() @@ -1113,7 +1113,7 @@ class Api_AdminTest extends \BBTestCase ); $result = $this->adminApi->canned_update($data); - $this->assertInternalType('integer', $result); + $this->assertIsInt($result); } @@ -1135,7 +1135,7 @@ class Api_AdminTest extends \BBTestCase ); $result = $this->adminApi->canned_category_pairs($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testCanned_category_get() @@ -1168,7 +1168,7 @@ class Api_AdminTest extends \BBTestCase ); $result = $this->adminApi->canned_category_get($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testCanned_category_update() @@ -1207,7 +1207,7 @@ class Api_AdminTest extends \BBTestCase ); $result = $this->adminApi->canned_category_update($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testCanned_category_delete() @@ -1243,7 +1243,7 @@ class Api_AdminTest extends \BBTestCase ); $result = $this->adminApi->canned_category_delete($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testCanned_category_create() @@ -1269,7 +1269,7 @@ class Api_AdminTest extends \BBTestCase ); $result = $this->adminApi->canned_category_create($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testCanned_note_create() @@ -1303,7 +1303,7 @@ class Api_AdminTest extends \BBTestCase ); $result = $this->adminApi->note_create($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testCanned_note_delete() @@ -1336,7 +1336,7 @@ class Api_AdminTest extends \BBTestCase ); $result = $this->adminApi->note_delete($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testTask_complete() diff --git a/tests/bb-modules/Support/Api/Api_ClientTest.php b/tests/bb-modules/Support/Api/Api_ClientTest.php index 35e517fe1..e3359758f 100644 --- a/tests/bb-modules/Support/Api/Api_ClientTest.php +++ b/tests/bb-modules/Support/Api/Api_ClientTest.php @@ -2,14 +2,14 @@ namespace Box\Tests\Mod\Support\Api; -class ClientTest extends \BBTestCase +class Api_ClientTest extends \BBTestCase { /** * @var \Box\Mod\Support\Api\Client */ protected $clientApi = null; - public function setup() + public function setup(): void { $this->clientApi = new \Box\Mod\Support\Api\Client(); } @@ -59,7 +59,7 @@ class ClientTest extends \BBTestCase $data = array(); $result = $this->clientApi->ticket_get_list($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testTicket_get() @@ -92,7 +92,7 @@ class ClientTest extends \BBTestCase ); $result = $this->clientApi->ticket_get($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testHelpdesk_get_pairs() @@ -106,7 +106,7 @@ class ClientTest extends \BBTestCase $result = $this->clientApi->helpdesk_get_pairs(); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testTicket_create() @@ -145,7 +145,7 @@ class ClientTest extends \BBTestCase ); $result = $this->clientApi->ticket_create($data); - $this->assertInternalType('integer', $result); + $this->assertIsInt($result); } public function testTicket_reply() @@ -185,13 +185,10 @@ class ClientTest extends \BBTestCase ); $result = $this->clientApi->ticket_reply($data); - $this->assertInternalType('bool', $result); + $this->assertIsBool($result); $this->assertTrue($result); } - /** - * @expectedException \Box_Exception - */ public function testTicket_replyCanNotBeReopenedException() { $serviceMock = $this->getMockBuilder('\Box\Mod\Support\Service') @@ -227,9 +224,10 @@ class ClientTest extends \BBTestCase 'content' => 'Content', 'id' => rand(1, 100), ); + $this->expectException(\Box_Exception::class); $result = $this->clientApi->ticket_reply($data); - $this->assertInternalType('integer', $result); + $this->assertIsInt($result); } @@ -264,7 +262,7 @@ class ClientTest extends \BBTestCase ); $result = $this->clientApi->ticket_close($data); - $this->assertInternalType('integer', $result); + $this->assertIsInt($result); } diff --git a/tests/bb-modules/Support/Api/Api_GuestTest.php b/tests/bb-modules/Support/Api/Api_GuestTest.php index 093c24f0c..014238efa 100644 --- a/tests/bb-modules/Support/Api/Api_GuestTest.php +++ b/tests/bb-modules/Support/Api/Api_GuestTest.php @@ -3,14 +3,14 @@ namespace Box\Tests\Mod\Support\Api; -class GuestTest extends \BBTestCase +class Api_GuestTest extends \BBTestCase { /** * @var \Box\Mod\Support\Api\Guest */ protected $guestApi = null; - public function setup() + public function setup(): void { $this->guestApi = new \Box\Mod\Support\Api\Guest(); } @@ -42,13 +42,10 @@ class GuestTest extends \BBTestCase ); $result = $this->guestApi->ticket_create($data); - $this->assertInternalType('string', $result); + $this->assertIsString($result); $this->assertEquals(strlen($result), 40); } - /** - * @expectedException \Box_Exception - */ public function testTicket_createMessageTooShortException() { $serviceMock = $this->getMockBuilder('\Box\Mod\Support\Service') @@ -74,9 +71,11 @@ class GuestTest extends \BBTestCase 'subject' => 'Subject', 'message' => '', ); + + $this->expectException(\Box_Exception::class); $result = $this->guestApi->ticket_create($data); - $this->assertInternalType('string', $result); + $this->assertIsString($result); $this->assertEquals(strlen($result), 40); } @@ -106,7 +105,7 @@ class GuestTest extends \BBTestCase ); $result = $this->guestApi->ticket_get($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testTicket_close() @@ -135,7 +134,7 @@ class GuestTest extends \BBTestCase ); $result = $this->guestApi->ticket_close($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testTicket_reply() @@ -165,7 +164,7 @@ class GuestTest extends \BBTestCase ); $result = $this->guestApi->ticket_reply($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } } \ No newline at end of file diff --git a/tests/bb-modules/Support/ServiceTest.php b/tests/bb-modules/Support/ServiceTest.php index 20c742fcc..7473f5fe0 100644 --- a/tests/bb-modules/Support/ServiceTest.php +++ b/tests/bb-modules/Support/ServiceTest.php @@ -10,7 +10,7 @@ class ServiceTest extends \BBTestCase */ protected $service = null; - public function setup() + public function setup(): void { $this->service = new \Box\Mod\Support\Service(); } @@ -398,7 +398,7 @@ class ServiceTest extends \BBTestCase public function testGetStatuses() { $result = $this->service->getStatuses(); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testFindOneByClient() @@ -422,9 +422,6 @@ class ServiceTest extends \BBTestCase $this->assertInstanceOf('Model_SupportTicket', $result); } - /** - * @expectedException \Box_Exception - */ public function testFindOneByClientNotFoundException() { $dbMock = $this->getMockBuilder('\Box_Database')->disableOriginalConstructor()->getMock(); @@ -440,11 +437,12 @@ class ServiceTest extends \BBTestCase $client->loadBean(new \RedBeanPHP\OODBBean()); $client->id = rand(1, 100); + $this->expectException(\Box_Exception::class); $result = $this->service->findOneByClient($client, rand(1, 100)); $this->assertInstanceOf('Model_SupportTicket', $result); } - public function testGetSearchQueryProvider() + public function getSearchQueryProvider() { return array( array( @@ -484,7 +482,7 @@ class ServiceTest extends \BBTestCase } /** - * @dataProvider testGetSearchQueryProvider + * @dataProvider getSearchQueryProvider */ public function testGetSearchQuery($data) { @@ -494,8 +492,8 @@ class ServiceTest extends \BBTestCase }); $this->service->setDi($di); list($query, $bindings) = $this->service->getSearchQuery($data); - $this->assertInternalType('string', $query); - $this->assertInternalType('array', $bindings); + $this->assertIsString($query); + $this->assertIsArray($bindings); } public function testCounter() @@ -518,7 +516,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($arr), $result['total']); } @@ -537,7 +535,7 @@ class ServiceTest extends \BBTestCase $this->service->setDi($di); $result = $this->service->getLatest(); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertInstanceOf('Model_SupportTicket', $result[0]); } @@ -555,8 +553,8 @@ class ServiceTest extends \BBTestCase $this->service->setDi($di); $result = $this->service->getExpired(); - $this->assertInternalType('array', $result); - $this->assertInternalType('array', $result[0]); + $this->assertIsArray($result); + $this->assertIsArray($result[0]); } public function testCountByStatus() @@ -571,7 +569,7 @@ class ServiceTest extends \BBTestCase $this->service->setDi($di); $result = $this->service->countByStatus('open'); - $this->assertInternalType('integer', $result); + $this->assertIsInt($result); } public function testGetActiveTicketsCountForOrder() @@ -589,7 +587,7 @@ class ServiceTest extends \BBTestCase $order->loadBean(new \RedBeanPHP\OODBBean()); $result = $this->service->getActiveTicketsCountForOrder($order); - $this->assertInternalType('integer', $result); + $this->assertIsInt($result); } public function testCheckIfTaskAlreadyExistsTrue() @@ -630,7 +628,7 @@ class ServiceTest extends \BBTestCase $this->assertFalse($result); } - public function testCloseTicketProvider() + public function closeTicketProvider() { return array( array(new \Model_Admin()), @@ -639,7 +637,7 @@ class ServiceTest extends \BBTestCase } /** - * @dataProvider testCloseTicketProvider + * @dataProvider closeTicketProvider */ public function testCloseTicket($identity) { @@ -760,14 +758,13 @@ class ServiceTest extends \BBTestCase public function testRm() { $dbMock = $this->getMockBuilder('\Box_Database')->disableOriginalConstructor()->getMock(); - $dbMock->expects($this->at(0)) + $dbMock->expects($this->exactly(2)) ->method('find') - ->with($this->equalTo('SupportTicketNote')) - ->will($this->returnValue(array(new \Model_SupportTicketNote(), new \Model_SupportTicketNote()))); - $dbMock->expects($this->at(3)) - ->method('find') - ->with($this->equalTo('SupportTicketMessage')) - ->will($this->returnValue(array(new \Model_SupportTicketMessage(), new \Model_SupportTicketMessage()))); + ->withConsecutive(['SupportTicketNote'], ['SupportTicketMessage']) + ->willReturnOnConsecutiveCalls( + [new \Model_SupportTicketNote(), new \Model_SupportTicketNote()], + [new \Model_SupportTicketMessage(), new \Model_SupportTicketMessage()] + ); $dbMock->expects($this->atLeastOnce()) ->method('trash') @@ -796,13 +793,11 @@ class ServiceTest extends \BBTestCase $dbMock->expects($this->atLeastOnce()) ->method('findOne') ->will($this->returnValue($supportTicketMessageModel)); - $dbMock->expects($this->at(1)) + $dbMock->expects($this->atleastOnce()) ->method('load') - ->with($this->equalTo('SupportHelpdesk')) - ->will($this->returnValue($helpdesk)); - $dbMock->expects($this->at(2)) - ->method('load') - ->will($this->returnValue(new \Model_Client())); + ->withConsecutive(['SupportHelpdesk'], ['Client']) + ->willReturnOnConsecutiveCalls($helpdesk, new \Model_Client()); + $dbMock->expects($this->atLeastOnce()) ->method('find') ->will($this->returnValue(array(new \Model_SupportTicketNote()))); @@ -832,7 +827,7 @@ class ServiceTest extends \BBTestCase $ticket->loadBean(new \RedBeanPHP\OODBBean()); $result = $serviceMock->toApiArray($ticket, true, new \Model_Admin()); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertArrayHasKey('replies', $result); $this->assertArrayHasKey('helpdesk', $result); $this->assertArrayHasKey('messages', $result); @@ -846,13 +841,11 @@ class ServiceTest extends \BBTestCase $dbMock->expects($this->atLeastOnce()) ->method('findOne') ->will($this->returnValue(new \Model_SupportTicketMessage())); - $dbMock->expects($this->at(1)) + $dbMock->expects($this->atleastOnce()) ->method('load') - ->with($this->equalTo('SupportHelpdesk')) - ->will($this->returnValue(new \Model_SupportHelpdesk())); - $dbMock->expects($this->at(2)) - ->method('load') - ->will($this->returnValue(new \Model_Client())); + ->withConsecutive(['SupportHelpdesk'], ['Client']) + ->willReturnOnConsecutiveCalls(new \Model_SupportHelpdesk(), new \Model_Client()); + $dbMock->expects($this->atLeastOnce()) ->method('find') ->will($this->returnValue(array(new \Model_SupportTicketNote()))); @@ -884,7 +877,7 @@ class ServiceTest extends \BBTestCase $ticket->rel_type = 'Type'; $result = $serviceMock->toApiArray($ticket, true, new \Model_Admin()); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertArrayHasKey('replies', $result); $this->assertArrayHasKey('helpdesk', $result); $this->assertArrayHasKey('messages', $result); @@ -917,7 +910,7 @@ class ServiceTest extends \BBTestCase $result = $this->service->getClientApiArrayForTicket($ticket); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testGetClientApiArrayForTicketClientNotExists() @@ -945,7 +938,7 @@ class ServiceTest extends \BBTestCase $result = $this->service->getClientApiArrayForTicket($ticket); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testNoteGetAuthorDetails() @@ -1011,7 +1004,7 @@ class ServiceTest extends \BBTestCase $result = $serviceMock->noteToApiArray($note); $this->assertArrayHasKey('author', $result); - $this->assertInternalType('array', $result['author']); + $this->assertIsArray($result['author']); } public function testHelpdeskGetSearchQuery() @@ -1033,8 +1026,8 @@ class ServiceTest extends \BBTestCase ':signature' => '%SearchQuery%', ); - $this->assertInternalType('string', $query); - $this->assertInternalType('array', $bindings); + $this->assertIsString($query); + $this->assertIsArray($bindings); $this->assertEquals($expectedBindings, $bindings); } @@ -1057,7 +1050,7 @@ class ServiceTest extends \BBTestCase $note->loadBean(new \RedBeanPHP\OODBBean()); $result = $this->service->helpdeskGetPairs(); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testHelpdeskRm() @@ -1083,9 +1076,6 @@ class ServiceTest extends \BBTestCase $this->assertTrue($result); } - /** - * @expectedException \Box_Exception - */ public function testHelpdeskRmHAsTicketsException() { $dbMock = $this->getMockBuilder('\Box_Database')->disableOriginalConstructor()->getMock(); @@ -1105,6 +1095,7 @@ class ServiceTest extends \BBTestCase $helpdesk = new \Model_SupportHelpdesk(); $helpdesk->loadBean(new \RedBeanPHP\OODBBean()); $helpdesk->id = rand(1, 100); + $this->expectException(\Box_Exception::class); $result = $this->service->helpdeskRm($helpdesk); $this->assertTrue($result); } @@ -1124,7 +1115,7 @@ class ServiceTest extends \BBTestCase $helpdesk->loadBean(new \RedBeanPHP\OODBBean()); $helpdesk->id = rand(1, 100); $result = $this->service->helpdeskToApiArray($helpdesk); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testMessageGetTicketMessages() @@ -1143,7 +1134,7 @@ class ServiceTest extends \BBTestCase $ticket->id = rand(1, 100); $result = $this->service->messageGetTicketMessages($ticket); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testMessageGetRepliesCount() @@ -1162,7 +1153,7 @@ class ServiceTest extends \BBTestCase $ticket->id = rand(1, 100); $result = $this->service->messageGetRepliesCount($ticket); - $this->assertInternalType('integer', $result); + $this->assertIsInt($result); } public function testMessageGetAuthorDetailsAdmin() @@ -1185,7 +1176,7 @@ class ServiceTest extends \BBTestCase $ticketMsg->admin_id = rand(1, 100); $result = $this->service->messageGetAuthorDetails($ticketMsg); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertArrayHasKey('name', $result); $this->assertArrayHasKey('email', $result); } @@ -1210,7 +1201,7 @@ class ServiceTest extends \BBTestCase $ticketMsg->client_id = rand(1, 100); $result = $this->service->messageGetAuthorDetails($ticketMsg); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertArrayHasKey('name', $result); $this->assertArrayHasKey('email', $result); } @@ -1236,7 +1227,7 @@ class ServiceTest extends \BBTestCase $ticketMsg->id = rand(1, 100); $result = $serviceMock->messageToApiArray($ticketMsg); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertArrayHasKey('author', $result); } @@ -1295,7 +1286,7 @@ class ServiceTest extends \BBTestCase $this->assertTrue($result); } - public function testTicketReplyProvider() + public function ticketReplyProvider() { $admin = new \Model_Admin(); $admin->loadBean(new \RedBeanPHP\OODBBean()); @@ -1312,7 +1303,7 @@ class ServiceTest extends \BBTestCase } /** - * @dataProvider testTicketReplyProvider + * @dataProvider ticketReplyProvider */ public function testTicketReply($identity) { @@ -1344,7 +1335,7 @@ class ServiceTest extends \BBTestCase $result = $this->service->ticketReply($ticket, $identity, 'Content'); - $this->assertInternalType('integer', $result); + $this->assertIsInt($result); $this->assertEquals($result, $randId); } @@ -1393,7 +1384,7 @@ class ServiceTest extends \BBTestCase ); $result = $this->service->ticketCreateForAdmin($client, $helpdesk, $data, $admin); - $this->assertInternalType('integer', $result); + $this->assertIsInt($result); $this->assertEquals($result, $randId); } @@ -1441,7 +1432,7 @@ class ServiceTest extends \BBTestCase ); $result = $this->service->ticketCreateForGuest($data); - $this->assertInternalType('string', $result); + $this->assertIsString($result); $this->assertEquals(strlen($result), 40); } @@ -1526,13 +1517,10 @@ class ServiceTest extends \BBTestCase $client->id = rand(1, 100); $result = $serviceMock->ticketCreateForClient($client, $helpdesk, $data); - $this->assertInternalType('integer', $result); + $this->assertIsInt($result); $this->assertEquals($result, $randId); } - /** - * @expectedException \Box_Exception - */ public function testTicketCreateForClientTaskAlreadyExistsException() { $message = new \Model_SupportTicketMessage(); @@ -1569,10 +1557,11 @@ class ServiceTest extends \BBTestCase }); $serviceMock->setDi($di); + $this->expectException(\Box_Exception::class); $serviceMock->ticketCreateForClient($client, $helpdesk, $data); } - public function testMessageCreateForTicketProvider() + public function messageCreateForTicketProvider() { $admin = new \Model_Admin(); $admin->loadBean(new \RedBeanPHP\OODBBean()); @@ -1593,7 +1582,7 @@ class ServiceTest extends \BBTestCase } /** - * @dataProvider testMessageCreateForTicketProvider + * @dataProvider messageCreateForTicketProvider */ public function testMessageCreateForTicket($identity) { @@ -1618,13 +1607,10 @@ class ServiceTest extends \BBTestCase $ticket->loadBean(new \RedBeanPHP\OODBBean()); $result = $this->service->messageCreateForTicket($ticket, $identity, 'Content'); - $this->assertInternalType('integer', $result); + $this->assertIsInt($result); $this->assertEquals($result, $randId); } - /** - * @expectedException \Box_Exception - */ public function testMessageCreateForTicketIdentityException() { $randId = rand(1, 100); @@ -1647,15 +1633,16 @@ class ServiceTest extends \BBTestCase $ticket = new \Model_SupportTicket(); $ticket->loadBean(new \RedBeanPHP\OODBBean()); + $this->expectException(\Box_Exception::class); $result = $this->service->messageCreateForTicket($ticket, null, 'Content'); - $this->assertInternalType('integer', $result); + $this->assertIsInt($result); $this->assertEquals($result, $randId); } public function testPublicGetStatuses() { $result = $this->service->publicGetStatuses(); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testPublicFindOneByHash() @@ -1677,9 +1664,6 @@ class ServiceTest extends \BBTestCase $this->assertInstanceOf('Model_SupportPTicket', $result); } - /** - * @expectedException \Box_Exception - */ public function testPublicFindOneByHashNotFoundException() { $dbMock = $this->getMockBuilder('\Box_Database')->disableOriginalConstructor()->getMock(); @@ -1695,11 +1679,12 @@ class ServiceTest extends \BBTestCase $client->loadBean(new \RedBeanPHP\OODBBean()); $client->id = rand(1, 100); + $this->expectException(\Box_Exception::class); $result = $this->service->publicFindOneByHash(sha1(uniqid())); $this->assertInstanceOf('Model_SupportPTicket', $result); } - public function testPublicGetSearchQueryProvider() + public function publicGetSearchQueryProvider() { return array( array( @@ -1730,7 +1715,7 @@ class ServiceTest extends \BBTestCase /** - * @dataProvider testPublicGetSearchQueryProvider + * @dataProvider publicGetSearchQueryProvider */ public function testPublicGetSearchQuery($data) { @@ -1741,8 +1726,8 @@ class ServiceTest extends \BBTestCase $this->service->setDi($di); list($query, $bindings) = $this->service->publicgetSearchQuery($data); - $this->assertInternalType('string', $query); - $this->assertInternalType('array', $bindings); + $this->assertIsString($query); + $this->assertIsArray($bindings); } public function testPublicCounter() @@ -1762,7 +1747,7 @@ class ServiceTest extends \BBTestCase $this->service->setDi($di); $result = $this->service->publicCounter(); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertArrayHasKey('total', $result); $this->assertEquals(array_sum($arr), $result['total']); } @@ -1780,7 +1765,7 @@ class ServiceTest extends \BBTestCase $this->service->setDi($di); $result = $this->service->publicGetLatest(); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertInstanceOf('Model_SupportPTicket', $result[0]); } @@ -1796,7 +1781,7 @@ class ServiceTest extends \BBTestCase $this->service->setDi($di); $result = $this->service->publicCountByStatus('open'); - $this->assertInternalType('integer', $result); + $this->assertIsInt($result); } public function testPublicGetExpired() @@ -1812,11 +1797,11 @@ class ServiceTest extends \BBTestCase $this->service->setDi($di); $result = $this->service->publicGetExpired(); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertInstanceOf('Model_SupportPTicket', $result[0]); } - public function testPublicCloseTicketProvider() + public function publicCloseTicketProvider() { return array( array(new \Model_Admin()), @@ -1825,7 +1810,7 @@ class ServiceTest extends \BBTestCase } /** - * @dataProvider testPublicCloseTicketProvider + * @dataProvider publicCloseTicketProvider */ public function testPublicCloseTicket($identity) { @@ -1892,7 +1877,7 @@ class ServiceTest extends \BBTestCase $this->assertTrue($result); } - public function testPublicToApiArrayProvider() + public function publicToApiArrayProvider() { return array( array( @@ -1907,20 +1892,20 @@ class ServiceTest extends \BBTestCase } /** - * @dataProvider testPublicToApiArrayProvider + * @dataProvider publicToApiArrayProvider */ public function testPublicToApiArray($findOne, $publicMessageGetAuthorDetailsCalled) { $ticketMessages = array(new \Model_SupportPTicketMessage(), new \Model_SupportPTicketMessage()); $dbMock = $this->getMockBuilder('\Box_Database')->disableOriginalConstructor()->getMock(); - $dbMock->expects($this->atLeastOnce()) + $dbMock->expects($this->any()) ->method('findOne') ->will($this->returnValue($findOne)); $dbMock->expects($this->atLeastOnce()) ->method('toArray') ->will($this->returnValue(array())); - $dbMock->expects($this->atLeastOnce()) + $dbMock->expects($this->any()) ->method('find') ->will($this->returnValue($ticketMessages)); @@ -1928,7 +1913,7 @@ class ServiceTest extends \BBTestCase ->setMethods(array('publicMessageToApiArray', 'publicMessageGetAuthorDetails'))->getMock(); $serviceMock->expects($this->atLeastOnce())->method('publicMessageToApiArray') ->will($this->returnValue(array())); - $serviceMock->expects($publicMessageGetAuthorDetailsCalled)->method('publicMessageGetAuthorDetails') + $serviceMock->expects($this->atLeastOnce())->method('publicMessageGetAuthorDetails') ->will($this->returnValue(array('name' => 'Name', 'email' => 'email#example.com'))); $di = new \Box_Di(); @@ -1939,8 +1924,8 @@ class ServiceTest extends \BBTestCase $ticket = new \Model_SupportPTicket(); $ticket->loadBean(new \RedBeanPHP\OODBBean()); - $result = $serviceMock->publicToApiArray($ticket, true, new \Model_Admin()); - $this->assertInternalType('array', $result); + $result = $serviceMock->publicToApiArray($ticket, true); + $this->assertIsArray($result); $this->assertArrayHasKey('author', $result); $this->assertArrayHasKey('messages', $result); @@ -1968,7 +1953,7 @@ class ServiceTest extends \BBTestCase $ticketMsg->admin_id = rand(1, 100); $result = $this->service->publicMessageGetAuthorDetails($ticketMsg); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertArrayHasKey('name', $result); $this->assertArrayHasKey('email', $result); } @@ -1994,7 +1979,7 @@ class ServiceTest extends \BBTestCase $ticketMsg->admin_id = null; $result = $this->service->publicMessageGetAuthorDetails($ticketMsg); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertArrayHasKey('name', $result); $this->assertArrayHasKey('email', $result); } @@ -2020,7 +2005,7 @@ class ServiceTest extends \BBTestCase $ticketMsg->id = rand(1, 100); $result = $serviceMock->publicMessageToApiArray($ticketMsg); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertArrayHasKey('author', $result); } @@ -2066,7 +2051,7 @@ class ServiceTest extends \BBTestCase ); $result = $this->service->publicTicketCreate($data, $admin); - $this->assertInternalType('integer', $result); + $this->assertIsInt($result); $this->assertEquals($result, $randId); } @@ -2131,7 +2116,7 @@ class ServiceTest extends \BBTestCase $admin->loadBean(new \RedBeanPHP\OODBBean()); $result = $this->service->publicTicketReply($ticket, $admin, 'Content'); - $this->assertInternalType('integer', $result); + $this->assertIsInt($result); $this->assertEquals($result, $randId); } @@ -2167,7 +2152,7 @@ class ServiceTest extends \BBTestCase $admin->loadBean(new \RedBeanPHP\OODBBean()); $result = $this->service->publicTicketReplyForGuest($ticket, 'Message'); - $this->assertInternalType('string', $result); + $this->assertIsString($result); $this->assertEquals(strlen($result), 40); } @@ -2234,7 +2219,7 @@ class ServiceTest extends \BBTestCase ); $result = $this->service->helpdeskCreate($data); - $this->assertInternalType('integer', $result); + $this->assertIsInt($result); $this->assertEquals($result, $randId); } @@ -2251,8 +2236,8 @@ class ServiceTest extends \BBTestCase ); list($query, $bindings) = $this->service->cannedGetSearchQuery($data); - $this->assertInternalType('string', $query); - $this->assertInternalType('array', $bindings); + $this->assertIsString($query); + $this->assertIsArray($bindings); } public function testCannedGetGroupedPairs() @@ -2284,7 +2269,7 @@ class ServiceTest extends \BBTestCase ); $result = $this->service->cannedGetGroupedPairs(); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertEquals($result, $expected); } @@ -2331,9 +2316,9 @@ class ServiceTest extends \BBTestCase $canned->loadBean(new \RedBeanPHP\OODBBean()); $result = $this->service->cannedToApiArray($canned); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertArrayHasKey('category', $result); - $this->assertInternalType('array', $result['category']); + $this->assertIsArray($result['category']); $this->assertArrayHasKey('id', $result['category']); $this->assertArrayHasKey('title', $result['category']); } @@ -2357,7 +2342,7 @@ class ServiceTest extends \BBTestCase $canned->loadBean(new \RedBeanPHP\OODBBean()); $result = $this->service->cannedToApiArray($canned); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertArrayHasKey('category', $result); $this->assertEquals($result['category'], array()); } @@ -2380,7 +2365,7 @@ class ServiceTest extends \BBTestCase $note->loadBean(new \RedBeanPHP\OODBBean()); $result = $this->service->cannedCategoryGetPairs(); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testCannedCategoryRm() @@ -2418,7 +2403,7 @@ class ServiceTest extends \BBTestCase $canned->loadBean(new \RedBeanPHP\OODBBean()); $result = $this->service->cannedCategoryToApiArray($canned); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testCannedCreate() @@ -2459,7 +2444,7 @@ class ServiceTest extends \BBTestCase ); $result = $this->service->cannedCreate($data, rand(1, 100), 'Content'); - $this->assertInternalType('integer', $result); + $this->assertIsInt($result); $this->assertEquals($result, $randId); } @@ -2519,7 +2504,7 @@ class ServiceTest extends \BBTestCase ); $result = $this->service->cannedCategoryCreate($data, rand(1, 100), 'Content'); - $this->assertInternalType('integer', $result); + $this->assertIsInt($result); $this->assertEquals($result, $randId); } @@ -2577,7 +2562,7 @@ class ServiceTest extends \BBTestCase $ticket->loadBean(new \RedBeanPHP\OODBBean()); $result = $this->service->noteCreate($ticket, $admin, 'Note'); - $this->assertInternalType('integer', $result); + $this->assertIsInt($result); $this->assertEquals($result, $randId); } @@ -2601,7 +2586,7 @@ class ServiceTest extends \BBTestCase $this->assertTrue($result); } - public function testCanClientSubmitNewTicketProvider() + public function canClientSubmitNewTicketProvider() { $ticket = new \Model_SupportTicket(); @@ -2622,12 +2607,12 @@ class ServiceTest extends \BBTestCase } /** - * @dataProvider testCanClientSubmitNewTicketProvider + * @dataProvider canClientSubmitNewTicketProvider */ public function testCanClientSubmitNewTicket($ticket, $hours, $expected) { if (!$expected) { - $this->setExpectedException('\Box_Exception'); + $this->expectException(\Box_Exception::class); } $dbMock = $this->getMockBuilder('\Box_Database')->disableOriginalConstructor()->getMock(); $dbMock->expects($this->atLeastOnce()) @@ -2637,7 +2622,6 @@ class ServiceTest extends \BBTestCase $di = new \Box_Di(); $di['db'] = $dbMock; $this->service->setDi($di); - $client = new \Model_Client(); $client->loadBean(new \RedBeanPHP\OODBBean()); $client->id = 5; diff --git a/tests/bb-modules/System/Api/AdminTest.php b/tests/bb-modules/System/Api/AdminTest.php index 975c07c35..6b94afeb2 100644 --- a/tests/bb-modules/System/Api/AdminTest.php +++ b/tests/bb-modules/System/Api/AdminTest.php @@ -10,7 +10,7 @@ class AdminTest extends \BBTestCase { */ protected $api = null; - public function setup() + public function setup(): void { $this->api= new \Box\Mod\System\Api\Admin(); } @@ -36,7 +36,7 @@ class AdminTest extends \BBTestCase { $this->api->setService($serviceMock); $result = $this->api->license_info($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testparam() @@ -60,7 +60,7 @@ class AdminTest extends \BBTestCase { $this->api->setService($serviceMock); $result = $this->api->param($data); - $this->assertInternalType('string', $result); + $this->assertIsString($result); } public function testget_params() @@ -76,7 +76,7 @@ class AdminTest extends \BBTestCase { $this->api->setService($serviceMock); $result = $this->api->get_params($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testupdate_params() @@ -92,7 +92,7 @@ class AdminTest extends \BBTestCase { $this->api->setService($serviceMock); $result = $this->api->update_params($data); - $this->assertInternalType('bool', $result); + $this->assertIsBool($result); $this->assertTrue($result); } @@ -115,7 +115,7 @@ class AdminTest extends \BBTestCase { $this->api->setService($serviceMock); $result = $this->api->messages($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testtemplate_exists() @@ -132,7 +132,7 @@ class AdminTest extends \BBTestCase { $this->api->setService($serviceMock); $result = $this->api->template_exists($data); - $this->assertInternalType('bool', $result); + $this->assertIsBool($result); $this->assertTrue($result); } @@ -154,7 +154,7 @@ class AdminTest extends \BBTestCase { $this->api->setService($serviceMock); $result = $this->api->string_render($data); - $this->assertInternalType('string', $result); + $this->assertIsString($result); } public function testenv() @@ -174,7 +174,7 @@ class AdminTest extends \BBTestCase { $this->api->setService($serviceMock); $result = $this->api->env($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testis_allowed() @@ -209,7 +209,7 @@ class AdminTest extends \BBTestCase { $this->api->setDi($di); $result = $this->api->is_allowed($data); - $this->assertInternalType('bool', $result); + $this->assertIsBool($result); $this->assertTrue($result); } @@ -225,7 +225,7 @@ class AdminTest extends \BBTestCase { $this->api->setService($serviceMock); $result = $this->api->clear_cache($data); - $this->assertInternalType('bool', $result); + $this->assertIsBool($result); $this->assertTrue($result); } diff --git a/tests/bb-modules/System/Api/GuestTest.php b/tests/bb-modules/System/Api/GuestTest.php index d303635ae..b94a0c03d 100644 --- a/tests/bb-modules/System/Api/GuestTest.php +++ b/tests/bb-modules/System/Api/GuestTest.php @@ -10,7 +10,7 @@ class GuestTest extends \BBTestCase { */ protected $api = null; - public function setup() + public function setup(): void { $this->api= new \Box\Mod\System\Api\Guest(); } @@ -32,7 +32,7 @@ class GuestTest extends \BBTestCase { $this->api->setService($servuceMock); $result = $this->api->version(); - $this->assertInternalType('string', $result); + $this->assertIsString($result); $this->assertNotEmpty($result); } @@ -49,7 +49,7 @@ class GuestTest extends \BBTestCase { $this->api->setService($servuceMock); $result = $this->api->company($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testphone_codes() @@ -65,7 +65,7 @@ class GuestTest extends \BBTestCase { $this->api->setService($servuceMock); $result = $this->api->phone_codes($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function teststates() @@ -78,7 +78,7 @@ class GuestTest extends \BBTestCase { $this->api->setService($servuceMock); $result = $this->api->states(); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testcountries_eunion() @@ -91,7 +91,7 @@ class GuestTest extends \BBTestCase { $this->api->setService($servuceMock); $result = $this->api->countries_eunion(); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testcountries() @@ -104,7 +104,7 @@ class GuestTest extends \BBTestCase { $this->api->setService($servuceMock); $result = $this->api->countries(); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testparam() @@ -128,13 +128,13 @@ class GuestTest extends \BBTestCase { $this->api->setService($servuceMock); $result = $this->api->param($data); - $this->assertInternalType('string', $result); + $this->assertIsString($result); } public function testPeriods() { $result = $this->api->periods(); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testperiod_title() @@ -153,7 +153,7 @@ class GuestTest extends \BBTestCase { $this->api->setService($servuceMock); $result = $this->api->period_title($data); - $this->assertInternalType('string', $result); + $this->assertIsString($result); } public function testperiod_titleMissingCode() @@ -166,7 +166,7 @@ class GuestTest extends \BBTestCase { }); $this->api->setDi($di); $result = $this->api->period_title($data); - $this->assertInternalType('string', $result); + $this->assertIsString($result); $this->assertEquals($expected, $result); } @@ -182,7 +182,7 @@ class GuestTest extends \BBTestCase { $this->api->setDi($di); $result = $this->api->current_url(); - $this->assertInternalType('string', $result); + $this->assertIsString($result); } public function testtemplate_exists() @@ -199,7 +199,7 @@ class GuestTest extends \BBTestCase { $this->api->setService($servuceMock); $result = $this->api->template_exists($data); - $this->assertInternalType('bool', $result); + $this->assertIsBool($result); $this->assertTrue($result); } @@ -209,7 +209,7 @@ class GuestTest extends \BBTestCase { ); $result = $this->api->template_exists($data); - $this->assertInternalType('bool', $result); + $this->assertIsBool($result); $this->assertFalse($result); } @@ -234,7 +234,7 @@ class GuestTest extends \BBTestCase { $this->api->setDi($di); $result = $this->api->locale(); - $this->assertInternalType('string', $result); + $this->assertIsString($result); $this->assertNotEmpty($result); $this->assertEquals($setLang, $result); } @@ -252,7 +252,7 @@ class GuestTest extends \BBTestCase { $this->api->setService($serviceMock); $result = $this->api->get_pending_messages(); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertEquals($messageArr, $result); } diff --git a/tests/bb-modules/System/ServiceTest.php b/tests/bb-modules/System/ServiceTest.php index 1a98950b0..2537af68a 100644 --- a/tests/bb-modules/System/ServiceTest.php +++ b/tests/bb-modules/System/ServiceTest.php @@ -7,7 +7,7 @@ class ServiceTest extends \BBTestCase { */ protected $service = null; - public function setup() + public function setup(): void { $this->service= new \Box\Mod\System\Service(); } @@ -15,7 +15,8 @@ class ServiceTest extends \BBTestCase { public function testgetParamValueMissingKeyParam() { $param = array(); - $this->setExpectedException('\Box_Exception', 'Parameter key is missing'); + $this->expectException(\Box_Exception::class); + $this->expectExceptionMessage('Parameter key is missing'); $this->service->getParamValue($param); } @@ -66,7 +67,7 @@ class ServiceTest extends \BBTestCase { $this->service->setDi($di); $result = $this->service->getCompany(); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertEquals($expected, $result); } @@ -80,7 +81,7 @@ class ServiceTest extends \BBTestCase { ); $result = $this->service->getLanguages(true); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertEquals($expected, $result); } @@ -112,7 +113,7 @@ class ServiceTest extends \BBTestCase { $this->service->setDi($di); $result = $this->service->getLicenseInfo(array()); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertEquals($expected, $result); } @@ -143,7 +144,7 @@ class ServiceTest extends \BBTestCase { $this->service->setDi($di); $result = $this->service->getParams(array()); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertEquals($expected, $result); } @@ -170,7 +171,7 @@ class ServiceTest extends \BBTestCase { $systemServiceMock->setDi($di); $result = $systemServiceMock->updateParams($data); - $this->assertInternalType('bool', $result); + $this->assertIsBool($result); $this->assertTrue($result); } @@ -208,7 +209,7 @@ class ServiceTest extends \BBTestCase { $systemServiceMock->setDi($di); $result = $systemServiceMock->getMessages($type); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testtemplateExists() @@ -237,12 +238,12 @@ class ServiceTest extends \BBTestCase { $this->service->setDi($di); $result = $this->service->templateExists('defaultFile.cp'); - $this->assertInternalType('bool', $result); + $this->assertIsBool($result); $this->assertTrue($result); } - public function testtemplateExistsEmotyPaths() + public function testtemplateExistsEmptyPaths() { $getThemeResults = array('paths' => array()); $systemServiceMock = $this->getMockBuilder('\Box\Mod\System\Service')->setMethods(array('getThemeConfig'))->getMock(); @@ -255,7 +256,7 @@ class ServiceTest extends \BBTestCase { $this->service->setDi($di); $result = $this->service->templateExists('defaultFile.cp'); - $this->assertInternalType('bool', $result); + $this->assertIsBool($result); $this->assertFalse($result); } @@ -264,13 +265,19 @@ class ServiceTest extends \BBTestCase { $vars = array( '_client_id' => 1 ); + - $twigMock = $this->getMockBuilder('\Twig_Environment')->disableOriginalConstructor()->getMock(); + $this + ->getMockBuilder('Drupal\Core\Template\TwigEnvironment') + ->disableOriginalConstructor() + ->getMock(); + + + $twigMock = $this->getMockBuilder('\Twig\Environment')->disableOriginalConstructor()->getMock(); $twigMock->expects($this->atLeastOnce()) ->method('addGlobal'); - $twigMock->expects($this->atLeastOnce()) - ->method('loadTemplate') - ->willThrowException(new \Twig_Error_Syntax('Exception created with PHPUNIT')); + $twigMock->method('createTemplate') + ->will($this->throwException(new \Twig\Error\SyntaxError('SyntaxError'))); $dbMock = $this->getMockBuilder('\Box_Database')->getMock(); $dbMock->expects($this->atLeastOnce()) @@ -283,7 +290,7 @@ class ServiceTest extends \BBTestCase { $di['api_client'] = new \Model_Client(); $this->service->setDi($di); - $this->setExpectedException('\Twig_Error_Syntax'); + $this->expectException(\Twig\Error\SyntaxError::class); $this->service->renderString('test', false, $vars); } @@ -292,14 +299,12 @@ class ServiceTest extends \BBTestCase { $vars = array( '_client_id' => 1 ); - - $twigMock = $this->getMockBuilder('\Twig_Environment')->disableOriginalConstructor()->getMock(); + $twigMock = $this->getMockBuilder('\Twig\Environment')->disableOriginalConstructor()->getMock(); $twigMock->expects($this->atLeastOnce()) ->method('addGlobal'); - $twigMock->expects($this->atLeastOnce()) - ->method('loadTemplate') - ->willThrowException(new \Twig_Error_Syntax('Exception created with PHPUNIT')); - + $twigMock->method('createTemplate') + ->willReturn(new \FakeTemplateWrapper('test')); + $dbMock = $this->getMockBuilder('\Box_Database')->getMock(); $dbMock->expects($this->atLeastOnce()) ->method('load') @@ -328,7 +333,7 @@ class ServiceTest extends \BBTestCase { $this->service->setDi($di); $result = $this->service->clearCache(); - $this->assertInternalType('bool', $result); + $this->assertIsBool($result); $this->assertTrue($result); } @@ -361,7 +366,7 @@ class ServiceTest extends \BBTestCase { $this->service->setDi($di); $result = $this->service->getCurrentUrl(); - $this->assertInternalType('string', $result); + $this->assertIsString($result); } @@ -372,7 +377,7 @@ class ServiceTest extends \BBTestCase { $expexted = 'Every week'; $result = $this->service->getPeriod($code); - $this->assertInternalType('string', $result); + $this->assertIsString($result); $this->assertEquals($expexted, $result); } @@ -389,7 +394,7 @@ class ServiceTest extends \BBTestCase { $this->service->setDi($di); $result = $this->service->getCountries(); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testgetEuCountries() @@ -404,26 +409,26 @@ class ServiceTest extends \BBTestCase { $this->service->setDi($di); $result = $this->service->getEuCountries(); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testgetStates() { $result = $this->service->getStates(); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testgetPhoneCodes() { $data = array(); $result = $this->service->getPhoneCodes($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testgetVersion() { $result = $this->service->getVersion(); - $this->assertInternalType('string', $result); + $this->assertIsString($result); $this->assertEquals(\Box_Version::VERSION, $result); } @@ -513,7 +518,9 @@ class ServiceTest extends \BBTestCase { $this->service->setDi($di); - $this->setExpectedException('\Box_Exception', 'You have reached free version limit. Upgrade to PRO version of BoxBilling if you want this limit removed.', 875); + $this->expectException(\Box_Exception::class); + $this->expectExceptionCode(875); + $this->expectExceptionMessage('You have reached free version limit. Upgrade to PRO version of BoxBilling if you want this limit removed.'); $this->service->checkLimits($modelName, $limit); } @@ -550,7 +557,9 @@ class ServiceTest extends \BBTestCase { $this->service->setDi($di); - $this->setExpectedException('\Box_Exception', 'You have reached free version limit. Upgrade to PRO version of BoxBilling if you want this limit removed.', 875); + $this->expectException(\Box_Exception::class); + $this->expectExceptionCode(875); + $this->expectExceptionMessage('You have reached free version limit. Upgrade to PRO version of BoxBilling if you want this limit removed.'); $this->service->checkLimits($modelName, $limit); } @@ -568,7 +577,7 @@ class ServiceTest extends \BBTestCase { $this->service->setDi($di); $result = $this->service->getPendingMessages(); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testgetPendingMessages_GetReturnsNotArray() @@ -585,7 +594,7 @@ class ServiceTest extends \BBTestCase { $this->service->setDi($di); $result = $this->service->getPendingMessages(); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testsetPendingMessage() @@ -626,4 +635,4 @@ class ServiceTest extends \BBTestCase { $result = $this->service->clearPendingMessages(); $this->assertTrue($result); } -} +} \ No newline at end of file diff --git a/tests/bb-modules/Theme/Api/AdminTest.php b/tests/bb-modules/Theme/Api/AdminTest.php index db20bd2ef..650ff99e2 100644 --- a/tests/bb-modules/Theme/Api/AdminTest.php +++ b/tests/bb-modules/Theme/Api/AdminTest.php @@ -10,7 +10,7 @@ class AdminTest extends \BBTestCase { */ protected $api = null; - public function setup() + public function setup(): void { $this->api= new \Box\Mod\Theme\Api\Admin(); } @@ -33,7 +33,7 @@ class AdminTest extends \BBTestCase { $this->api->setService($systemServiceMock); $result = $this->api->get_list(array()); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testget() @@ -58,7 +58,7 @@ class AdminTest extends \BBTestCase { $this->api->setService($systemServiceMock); $result = $this->api->get($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testselect_NotAdminTheme() @@ -170,7 +170,7 @@ class AdminTest extends \BBTestCase { $this->api->setService($serviceMock); $result = $this->api->preset_delete($data); - $this->assertInternalType('bool', $result); + $this->assertIsBool($result); $this->assertTrue($result); } @@ -202,7 +202,7 @@ class AdminTest extends \BBTestCase { $this->api->setService($serviceMock); $result = $this->api->preset_select($data); - $this->assertInternalType('bool', $result); + $this->assertIsBool($result); $this->assertTrue($result); } } diff --git a/tests/bb-modules/Theme/Model/ThemeTest.php b/tests/bb-modules/Theme/Model/ThemeTest.php index acd214b87..544a3a1ce 100644 --- a/tests/bb-modules/Theme/Model/ThemeTest.php +++ b/tests/bb-modules/Theme/Model/ThemeTest.php @@ -17,7 +17,8 @@ class ThemeTest extends \BBTestCase { public function testNotExistingTheme() { $themeName = 'not existing theme'; - $this->setExpectedException('\Box_Exception', sprintf('Theme "%s" does not exists', $themeName)); + $this->expectException(\Box_Exception::class); + $this->expectExceptionMessage(sprintf('Theme "%s" does not exists', $themeName)); new \Box\Mod\Theme\Model\Theme($themeName); } @@ -25,70 +26,70 @@ class ThemeTest extends \BBTestCase { { $theme = new \Box\Mod\Theme\Model\Theme($this->existingTheme); $result = $theme->isAdminAreaTheme(); - $this->assertInternalType('bool', $result); + $this->assertIsBool($result); } public function testisAssetsPathWritable() { $theme = new \Box\Mod\Theme\Model\Theme($this->existingTheme); $result = $theme->isAssetsPathWritable(); - $this->assertInternalType('bool', $result); + $this->assertIsBool($result); } public function testgetSnippets() { $theme = new \Box\Mod\Theme\Model\Theme($this->existingTheme); $result = $theme->getSnippets(); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testgetUploadedAssets() { $theme = new \Box\Mod\Theme\Model\Theme($this->existingTheme); $result = $theme->getUploadedAssets(); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testgetSettingsPageHtml() { $theme = new \Box\Mod\Theme\Model\Theme($this->existingTheme); $result = $theme->getSettingsPageHtml(); - $this->assertInternalType('string', $result); + $this->assertIsString($result); } public function testgetPresetsFromSettingsDataFile() { $theme = new \Box\Mod\Theme\Model\Theme($this->existingTheme); $result = $theme->getPresetsFromSettingsDataFile(); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testgetCurrentPreset() { $theme = new \Box\Mod\Theme\Model\Theme($this->existingTheme); $result = $theme->getCurrentPreset(); - $this->assertInternalType('string', $result); + $this->assertIsString($result); } public function testgetPresetFromSettingsDataFile() { $theme = new \Box\Mod\Theme\Model\Theme($this->existingTheme); $result = $theme->getPresetFromSettingsDataFile('default'); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testgetUrl() { $theme = new \Box\Mod\Theme\Model\Theme($this->existingTheme); $result = $theme->getUrl(); - $this->assertInternalType('string', $result); + $this->assertIsString($result); } public function testgetPathConfig() { $theme = new \Box\Mod\Theme\Model\Theme($this->existingTheme); $result = $theme->getPathConfig(); - $this->assertInternalType('string', $result); + $this->assertIsString($result); $this->assertTrue(strpos($result, 'config') !== false); } @@ -96,7 +97,7 @@ class ThemeTest extends \BBTestCase { { $theme = new \Box\Mod\Theme\Model\Theme($this->existingTheme); $result = $theme->getPathAssets(); - $this->assertInternalType('string', $result); + $this->assertIsString($result); $this->assertTrue(strpos($result, 'assets') !== false); } @@ -104,7 +105,7 @@ class ThemeTest extends \BBTestCase { { $theme = new \Box\Mod\Theme\Model\Theme($this->existingTheme); $result = $theme->getPathHtml(); - $this->assertInternalType('string', $result); + $this->assertIsString($result); $this->assertTrue(strpos($result, 'html') !== false); } @@ -112,7 +113,7 @@ class ThemeTest extends \BBTestCase { { $theme = new \Box\Mod\Theme\Model\Theme($this->existingTheme); $result = $theme->getPathSettingsDataFile(); - $this->assertInternalType('string', $result); + $this->assertIsString($result); $this->assertTrue(strpos($result, 'settings_data.json') !== false); } diff --git a/tests/bb-modules/Theme/ServiceTest.php b/tests/bb-modules/Theme/ServiceTest.php index 8ac71c97a..c1bbe8cd9 100644 --- a/tests/bb-modules/Theme/ServiceTest.php +++ b/tests/bb-modules/Theme/ServiceTest.php @@ -10,7 +10,7 @@ class ServiceTest extends \BBTestCase { */ protected $service = null; - public function setup() + public function setup(): void { $this->service= new \Box\Mod\Theme\Service(); } @@ -56,7 +56,7 @@ class ServiceTest extends \BBTestCase { $serviceMock->setDi($di); $result = $serviceMock->getCurrentThemePreset($themeMock); - $this->assertInternalType('string', $result); + $this->assertIsString($result); } public function testsetCurrentThemePreset() @@ -77,7 +77,7 @@ class ServiceTest extends \BBTestCase { $this->service->setDi($di); $result = $this->service->setCurrentThemePreset($themeMock, 'dark_blue'); - $this->assertInternalType('bool', $result); + $this->assertIsBool($result); $this->assertTrue($result); } @@ -99,7 +99,7 @@ class ServiceTest extends \BBTestCase { $this->service->setDi($di); $result = $this->service->deletePreset($themeMock, 'dark_blue'); - $this->assertInternalType('bool', $result); + $this->assertIsBool($result); $this->assertTrue($result); } @@ -135,7 +135,7 @@ class ServiceTest extends \BBTestCase { $serviceMock->setDi($di); $result = $serviceMock->getThemePresets($themeMock, 'dark_blue'); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $expected= array( 'default' => 'default', @@ -166,7 +166,7 @@ class ServiceTest extends \BBTestCase { $this->service->setDi($di); $result = $this->service->getThemePresets($themeMock, 'dark_blue'); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $expected= array( 'Default' => 'Default', @@ -196,7 +196,7 @@ class ServiceTest extends \BBTestCase { $this->service->setDi($di); $result = $this->service->getThemeSettings($themeMock, 'default'); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testgetThemeSettingsWithEmptyPresets() @@ -227,7 +227,7 @@ class ServiceTest extends \BBTestCase { $serviceMock->setDi($di); $result = $serviceMock->getThemeSettings($themeMock); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertEquals(array(), $result); } @@ -258,7 +258,7 @@ class ServiceTest extends \BBTestCase { $this->service->setDi($di); $params = array(); $result = $this->service->updateSettings($themeMock, 'default', $params); - $this->assertInternalType('bool', $result); + $this->assertIsBool($result); $this->assertTrue($result); } @@ -299,7 +299,7 @@ class ServiceTest extends \BBTestCase { $serviceMock->setDi($di); $result = $serviceMock->regenerateThemeSettingsDataFile($themeMock); - $this->assertInternalType('bool', $result); + $this->assertIsBool($result); $this->assertTrue($result); } @@ -321,7 +321,7 @@ class ServiceTest extends \BBTestCase { $this->service->setDi($di); $result = $this->service->regenerateThemeCssAndJsFiles($themeMock, 'default', new \Model_Admin()); - $this->assertInternalType('bool', $result); + $this->assertIsBool($result); $this->assertTrue($result); } @@ -362,7 +362,7 @@ class ServiceTest extends \BBTestCase { $serviceMock->setDi($di); $result = $serviceMock->regenerateThemeCssAndJsFiles($themeMock, 'default', new \Model_Admin()); - $this->assertInternalType('bool', $result); + $this->assertIsBool($result); $this->assertTrue($result); } @@ -383,7 +383,7 @@ class ServiceTest extends \BBTestCase { $this->service->setDi($di); $result =$this->service->getCurrentAdminAreaTheme(); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testgetCurrentClientAreaTheme() @@ -417,7 +417,7 @@ class ServiceTest extends \BBTestCase { $this->service->setDi($di); $result = $this->service->getCurrentClientAreaThemeCode(); - $this->assertInternalType('string', $result); + $this->assertIsString($result); $this->assertEquals('boxbilling', $result); } @@ -448,7 +448,8 @@ class ServiceTest extends \BBTestCase { 'error' => UPLOAD_ERR_CANT_WRITE ), ); - $this->setExpectedException('\Box_Exception', sprintf("Error uploading file %s Error code: %d", 'test0', UPLOAD_ERR_CANT_WRITE)); + $this->expectException(\Box_Exception::class); + $this->expectExceptionMessage(sprintf("Error uploading file %s Error code: %d", 'test0', UPLOAD_ERR_CANT_WRITE)); $this->service->uploadAssets($themeMock, $files); } diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 9baeaae56..fbf814b43 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -22,14 +22,16 @@ set_include_path(implode(PATH_SEPARATOR, array( BB_PATH_TESTS.'/includes/Vps', ))); + require_once 'SolusvmMock.php'; require_once 'BoxSessionMock.php'; -require_once 'BBDatabaseTestCase.php'; -require_once 'ApiTestCase.php'; -require_once 'BBDbApiTestCase.php'; -require_once 'BBModTestCase.php'; require_once 'BBTestCase.php'; +require_once 'BBDatabaseTestCase.php'; +require_once 'BBDbApiTestCase.php'; +require_once 'ApiTestCase.php'; +require_once 'BBModTestCase.php'; require_once BB_PATH_TESTS.'/includes/Payment/Adapter/Dummy.php'; - +require_once 'FakeTemplateWrapper.php'; +/**/ $di = include BB_PATH_ROOT . '/bb-di.php'; $di['translate'](); \ No newline at end of file diff --git a/tests/includes/ApiTestCase.php b/tests/includes/ApiTestCase.php index 4add0fde7..7260fc7a0 100644 --- a/tests/includes/ApiTestCase.php +++ b/tests/includes/ApiTestCase.php @@ -1,5 +1,5 @@ di = $di; diff --git a/tests/includes/BBDatabaseTestCase.php b/tests/includes/BBDatabaseTestCase.php index f84be754e..e94d05104 100644 --- a/tests/includes/BBDatabaseTestCase.php +++ b/tests/includes/BBDatabaseTestCase.php @@ -1,7 +1,7 @@ di['updater'] = $updatedMock; } - public function setUp() + protected function setUp(): void { parent::setUp(); @@ -40,7 +40,7 @@ abstract class BBDbApiTestCase extends BBDatabaseTestCase //$this->api_admin->hook_batch_connect(); } - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); diff --git a/tests/includes/BBModTestCase.php b/tests/includes/BBModTestCase.php index 4c1ae4b28..6aa5962fa 100644 --- a/tests/includes/BBModTestCase.php +++ b/tests/includes/BBModTestCase.php @@ -3,7 +3,7 @@ class BBModTestCase extends BBDbApiTestCase { protected $_mod = null; - public function setUp() + public function setUp(): void { global $di; $mod = $di['mod']($this->_mod); diff --git a/tests/includes/BBTestCase.php b/tests/includes/BBTestCase.php index dd4cbbaf1..b1e219cce 100644 --- a/tests/includes/BBTestCase.php +++ b/tests/includes/BBTestCase.php @@ -1,8 +1,8 @@ body = $body; + } +/** + * Mocks the \Twig_TemplateWrapper render() method. + * + * @param array $context + * (optional) Render context. + */ + public function render(array $context = []) + { + return $this->body; + } +} \ No newline at end of file diff --git a/tests/integration/bb-library/Api/HandlerTest.php b/tests/integration/bb-library/Api/HandlerTest.php index a35025411..a884880f8 100644 --- a/tests/integration/bb-library/Api/HandlerTest.php +++ b/tests/integration/bb-library/Api/HandlerTest.php @@ -1,5 +1,5 @@ assertEquals('0.0.1', $version); } - /** - * @expectedException \Box_Exception - * @expectedExceptionCode 710 - */ public function testException() { $api = $this->di['api_guest']; $method = 'methodWithoutUnderscore'; + $this->expectException(\Box_Exception::class); + $this->expectExceptionCode(710); $api->$method(); } - /** - * @expectedException \Box_Exception - * @expectedExceptionCode 714 - */ public function testInvalidModuleNameException() { $api = $this->di['api_guest']; $moduleName = '__'; + $this->expectException(\Box_Exception::class); + $this->expectExceptionCode(714); $version = $api->$moduleName(); } - /** - * @expectedException \Box_Exception - * @expectedExceptionCode 715 - */ public function testModuleNotActiveException() { $api = $this->di['api_guest']; $moduleName = 'notActiveModule_version'; + $this->expectException(\Box_Exception::class); + $this->expectExceptionCode(715); $version = $api->$moduleName(); } } \ No newline at end of file diff --git a/tests/integration/bb-library/Box/DatabaseTest.php b/tests/integration/bb-library/Box/DatabaseTest.php index 99fdc6322..0be1473f4 100644 --- a/tests/integration/bb-library/Box/DatabaseTest.php +++ b/tests/integration/bb-library/Box/DatabaseTest.php @@ -2,29 +2,31 @@ /** * @group Core */ -class Box_DatabaseIntegrationTest extends BBDbApiTestCase +class DatabaseTest extends BBDbApiTestCase { + public function testModel() { $model = $this->di['db']->dispense('Admin'); - $this->assertInstanceOf('RedBean_SimpleModel', $model); - $this->assertNotNull($this->di['db']->store($model)); + $this->assertInstanceOf(RedBean_SimpleModel::class, $model); + $id = $this->di['db']->store($model); + + $this->assertNotNull($id); + $model = $this->di['db']->findOne('Admin', 'id = ?', array($id)); + $this->assertInstanceOf(RedBean_SimpleModel::class, $model); - $model = $this->di['db']->findOne('Admin', 'id = ?', array(1)); - $this->assertInstanceOf('RedBean_SimpleModel', $model); + $model = $this->di['db']->load('Admin', $id); + $this->assertInstanceOf(RedBean_SimpleModel::class, $model); - $model = $this->di['db']->load('Admin', 1); - $this->assertInstanceOf('RedBean_SimpleModel', $model); - - $model = $this->di['db']->getExistingModelById('Admin', 1); - $this->assertInstanceOf('RedBean_SimpleModel', $model); + $model = $this->di['db']->getExistingModelById('Admin', $id); + $this->assertInstanceOf(RedBean_SimpleModel::class, $model); $array = $this->di['db']->toArray($model); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $models = $this->di['db']->find('Admin'); foreach($models as $m) { - $this->assertInstanceOf('RedBean_SimpleModel', $m); + $this->assertInstanceOf(RedBean_SimpleModel::class, $m); } $this->assertNull($this->di['db']->trash($model)); @@ -33,24 +35,25 @@ class Box_DatabaseIntegrationTest extends BBDbApiTestCase public function testBean() { $bean = $this->di['db']->dispense('admin'); - $this->assertInstanceOf('RedBeanPHP\OODBBean', $bean); - $this->assertNotNull($this->di['db']->store($bean)); + $this->assertInstanceOf(RedBeanPHP\OODBBean::class, $bean); + $id = $this->di['db']->store($bean); + $this->assertNotNull($id); - $model = $this->di['db']->findOne('admin', 'id = ?', array(1)); - $this->assertInstanceOf('RedBeanPHP\OODBBean', $model); + $model = $this->di['db']->findOne('admin', 'id = ?', array($id)); + $this->assertInstanceOf(RedBeanPHP\OODBBean::class, $model); - $model = $this->di['db']->load('admin', 1); - $this->assertInstanceOf('RedBeanPHP\OODBBean', $model); + $model = $this->di['db']->load('admin', $id); + $this->assertInstanceOf(RedBeanPHP\OODBBean::class, $model); - $model = $this->di['db']->getExistingModelById('admin', 1); - $this->assertInstanceOf('RedBeanPHP\OODBBean', $model); + $model = $this->di['db']->getExistingModelById('admin', $id); + $this->assertInstanceOf(RedBeanPHP\OODBBean::class, $model); $array = $this->di['db']->toArray($model); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $models = $this->di['db']->find('admin'); foreach($models as $m) { - $this->assertInstanceOf('RedBeanPHP\OODBBean', $m); + $this->assertInstanceOf(RedBeanPHP\OODBBean::class, $m); } $this->assertNull($this->di['db']->trash($model)); diff --git a/tests/integration/bb-library/Box/DiTest.php b/tests/integration/bb-library/Box/DiTest.php index aa7d83a0b..f8ee43bef 100644 --- a/tests/integration/bb-library/Box/DiTest.php +++ b/tests/integration/bb-library/Box/DiTest.php @@ -1,8 +1,8 @@ di = clone $di; @@ -27,7 +27,7 @@ class Box_DiTest extends PHPUnit_Framework_TestCase $this->assertInstanceOf('Box_Request', $di['request']); $this->assertInstanceOf('FileCache', $di['cache']); $this->assertInstanceOf('Box_Authorization', $di['auth']); - $this->assertInstanceOf('Twig_Environment', $di['twig']); + $this->assertInstanceOf('Twig\Environment', $di['twig']); $this->assertInstanceOf('Box_License', $di['license']); $this->assertInstanceOf('Box_Tools', $di['tools']); $this->assertInstanceOf('Box_Validate', $di['validator']); diff --git a/tests/integration/bb-library/Box/LogTest.php b/tests/integration/bb-library/Box/LogTest.php index 4d8f5cb4a..d022db3d8 100644 --- a/tests/integration/bb-library/Box/LogTest.php +++ b/tests/integration/bb-library/Box/LogTest.php @@ -3,9 +3,9 @@ /** * @group Core */ -class Box_LogIntegrationTest extends BBDbApiTestCase +class LogTest extends BBDbApiTestCase { - public function testLogWithoutParamsProvider() + public function logWithoutParamsProvider() { return array( array('Test message'), @@ -14,7 +14,7 @@ class Box_LogIntegrationTest extends BBDbApiTestCase } /** - * @dataProvider testLogWithoutParamsProvider + * @dataProvider logWithoutParamsProvider */ public function testLogWithoutParams($msg) { @@ -35,6 +35,8 @@ class Box_LogIntegrationTest extends BBDbApiTestCase $msg1 = 'No params in message, param passed'; $msg2 = 'Test message with param %s'; + $this->assertTrue(($rand <= 100 && $rand > 0)); + return array( array($msg1, $rand, $msg1), array($msg2, $rand, 'Test message with param ' . $rand), diff --git a/tests/integration/bb-library/Box/ModTest.php b/tests/integration/bb-library/Box/ModTest.php index 46eafc8e1..29aaf0ee2 100644 --- a/tests/integration/bb-library/Box/ModTest.php +++ b/tests/integration/bb-library/Box/ModTest.php @@ -3,7 +3,7 @@ /** * @group Core */ -class Box_ModIntegrationTest extends BBDbApiTestCase +class ModTest extends BBDbApiTestCase { public function testConfig() { diff --git a/tests/integration/bb-library/Payment/Adapter/CustomTest.php b/tests/integration/bb-library/Payment/Adapter/CustomTest.php index 7a157692b..2dd02a14f 100644 --- a/tests/integration/bb-library/Payment/Adapter/CustomTest.php +++ b/tests/integration/bb-library/Payment/Adapter/CustomTest.php @@ -19,5 +19,6 @@ class Payment_Adapter_CustomTest extends BBDbApiTestCase $tx = $this->di['db']->load('Transaction', 1); $adapter->process($tx); + } } \ No newline at end of file diff --git a/tests/integration/bb-library/Payment/Adapter/PayPalEmailTest.php b/tests/integration/bb-library/Payment/Adapter/PayPalEmailTest.php index 9771c4c15..c1448b956 100644 --- a/tests/integration/bb-library/Payment/Adapter/PayPalEmailTest.php +++ b/tests/integration/bb-library/Payment/Adapter/PayPalEmailTest.php @@ -43,7 +43,7 @@ class Payment_Adapter_PayPalEmailTest extends BBDbApiTestCase $adapter = new Payment_Adapter_PayPalEmail($config); $adapter->setDi($this->di); $form = $adapter->getHtml($this->api_admin, 1, false); - $this->assertRegExp('/action="https:\/\/www\.paypal\.com\/cgi-bin\/webscr"/', $form); + $this->assertMatchesRegularExpression('/action="https:\/\/www\.paypal\.com\/cgi-bin\/webscr"/', $form); } public function testGatewayTestmodeUrl() @@ -58,6 +58,6 @@ class Payment_Adapter_PayPalEmailTest extends BBDbApiTestCase $adapter = new Payment_Adapter_PayPalEmail($config); $adapter->setDi($this->di); $form = $adapter->getHtml($this->api_admin, 1, false); - $this->assertRegExp('/action="https:\/\/www\.sandbox\.paypal\.com\/cgi-bin\/webscr"/', $form); + $this->assertMatchesRegularExpression('/action="https:\/\/www\.sandbox\.paypal\.com\/cgi-bin\/webscr"/', $form); } -} +} \ No newline at end of file diff --git a/tests/integration/bb-modules/mod_activity/Api_AdminTest.php b/tests/integration/bb-modules/mod_activity/Api_AdminTest.php index 7bd8dd7dc..05d9c6f6c 100644 --- a/tests/integration/bb-modules/mod_activity/Api_AdminTest.php +++ b/tests/integration/bb-modules/mod_activity/Api_AdminTest.php @@ -2,7 +2,7 @@ /** * @group Core */ -class Api_Admin_ActivityTest extends BBDbApiTestCase +class Api_AdminTest extends BBDbApiTestCase { protected $_initialSeedFile = 'settings.xml'; @@ -23,20 +23,21 @@ class Api_Admin_ActivityTest extends BBDbApiTestCase public function testLogDeleteIdNotSetException() { - $this->setExpectedException('Box_Exception'); + $this->expectException(\Box_Exception::class); + $this->api_admin->activity_log_delete(array()); } public function testLogNotFoundException() { - $this->setExpectedException('Box_Exception'); + $this->expectException(\Box_Exception::class); $this->api_admin->activity_log_delete(array('id' => 100)); } public function testActivityLogGetList() { $array = $this->api_admin->activity_log_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertArrayHasKey('list', $array); $this->assertArrayHasKey('pages', $array); $this->assertArrayHasKey('page', $array); @@ -44,7 +45,7 @@ class Api_Admin_ActivityTest extends BBDbApiTestCase $this->assertArrayHasKey('total', $array); $this->assertArrayHasKey('list', $array); $list = $array['list']; - $this->assertInternalType('array', $list); + $this->assertIsArray($list); if (count($list)) { $item = $list[0]; $this->assertArrayHasKey('id', $item); diff --git a/tests/integration/bb-modules/mod_api/ServiceTest.php b/tests/integration/bb-modules/mod_api/ServiceTest.php index a4dc6eb39..4eb2c6f35 100644 --- a/tests/integration/bb-modules/mod_api/ServiceTest.php +++ b/tests/integration/bb-modules/mod_api/ServiceTest.php @@ -3,7 +3,7 @@ /** * @group Core */ -class Box_Mod_Api_ServiceTest extends BBDbApiTestCase +class ServiceTest extends BBDbApiTestCase { protected $_mod = 'api'; protected $_initialSeedFile = 'mod_api.xml'; @@ -22,10 +22,10 @@ class Box_Mod_Api_ServiceTest extends BBDbApiTestCase $this->assertInstanceOf('Api_Handler', $api); $result = $service->getRequestCount('2001-05-06', '123.124.125.126'); - $this->assertInternalType('integer', $result); + $this->assertIsInt($result); $result = $service->logRequest(); - $this->assertInternalType('integer', $result); + $this->assertIsInt($result); } } \ No newline at end of file diff --git a/tests/integration/bb-modules/mod_branding/ServiceTest.php b/tests/integration/bb-modules/mod_branding/ServiceTest.php index 857aae952..b618e6236 100644 --- a/tests/integration/bb-modules/mod_branding/ServiceTest.php +++ b/tests/integration/bb-modules/mod_branding/ServiceTest.php @@ -2,28 +2,21 @@ /** * @group Core */ -class Box_Mod_Branding_ServiceTest extends ApiTestCase +class ServiceTest extends ApiTestCase { private $configLicense = null; - public function tearDown() + public function tearDown() : void { if ($this->configLicense){ $this->di['config']['license'] = $this->configLicense; } } - public function testEvents() - { - $service = $this->di['mod_service']('branding'); - $bool = $service->uninstall(); - $this->assertTrue($bool); - } - public function testUninstallNotPro() { $this->configLicense = $this->di['config']['license']; - $this->setExpectedException('Exception'); + $this->expectException(Exception::class); $service = $this->di['mod_service']('branding'); $this->di['config']['license'] = 'invalidLicense'; $service->uninstall(); diff --git a/tests/integration/bb-modules/mod_cart/Api_AdminTest.php b/tests/integration/bb-modules/mod_cart/Api_AdminTest.php index 58c4ba0ed..e093a5d5b 100644 --- a/tests/integration/bb-modules/mod_cart/Api_AdminTest.php +++ b/tests/integration/bb-modules/mod_cart/Api_AdminTest.php @@ -9,10 +9,10 @@ class Box_Mod_Cart_Api_AdminTest extends BBDbApiTestCase public function testCarts() { $array = $this->api_admin->cart_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertArrayHasKey('list', $array); $list = $array['list']; - $this->assertInternalType('array', $list); + $this->assertIsArray($list); if (count($list)){ $item = $list[0]; $this->assertArrayHasKey('promocode', $item); @@ -21,7 +21,7 @@ class Box_Mod_Cart_Api_AdminTest extends BBDbApiTestCase $this->assertArrayHasKey('items', $item); $this->assertArrayHasKey('currency', $item); $currency = $item['currency']; - $this->assertInternalType('array', $currency); + $this->assertIsArray($currency); $this->assertArrayHasKey("code", $currency); $this->assertArrayHasKey("title", $currency); $this->assertArrayHasKey("conversion_rate", $currency); @@ -37,7 +37,7 @@ class Box_Mod_Cart_Api_AdminTest extends BBDbApiTestCase 'id' => 1 ); $cartArr = $this->api_admin->cart_get($data); - $this->assertInternalType('array', $cartArr); + $this->assertIsArray($cartArr); } public function testExpire() diff --git a/tests/integration/bb-modules/mod_cart/Api_ClientTest.php b/tests/integration/bb-modules/mod_cart/Api_ClientTest.php index b3d79402a..5d8c3a06f 100644 --- a/tests/integration/bb-modules/mod_cart/Api_ClientTest.php +++ b/tests/integration/bb-modules/mod_cart/Api_ClientTest.php @@ -45,7 +45,9 @@ class Box_Mod_Cart_Api_ClientTest extends BBDbApiTestCase 'quantity' => 2, ); - $this->setExpectedException('\Box_Exception', 'Can not checkout empty cart.'); + $this->expectException(\Box_Exception::class); + $this->expectExceptionMessage('Can not checkout empty cart.'); + $this->api_client->cart_checkout(); } diff --git a/tests/integration/bb-modules/mod_cart/Api_GuestTest.php b/tests/integration/bb-modules/mod_cart/Api_GuestTest.php index b6f8cb322..62db95072 100644 --- a/tests/integration/bb-modules/mod_cart/Api_GuestTest.php +++ b/tests/integration/bb-modules/mod_cart/Api_GuestTest.php @@ -9,7 +9,7 @@ class Box_Mod_Cart_Api_GuestTest extends BBDbApiTestCase public function testGet() { $cart = $this->api_guest->cart_get(); - $this->assertInternalType('array', $cart); + $this->assertIsArray($cart); } public function testCurrency() @@ -19,7 +19,7 @@ class Box_Mod_Cart_Api_GuestTest extends BBDbApiTestCase $this->assertTrue($bool); $c = $this->api_guest->cart_get_currency(); - $this->assertInternalType('array', $c); + $this->assertIsArray($c); } public function testReset() @@ -36,6 +36,8 @@ class Box_Mod_Cart_Api_GuestTest extends BBDbApiTestCase 'id' => 1, ); $bool = $this->api_guest->cart_add_item($data); + + $this->assertTrue($bool); } public function testAddAddons() @@ -78,7 +80,10 @@ class Box_Mod_Cart_Api_GuestTest extends BBDbApiTestCase ), ), ); - $this->setExpectedException('\Box_Exception', 'Selected billing period is not valid for addon'); + + $this->expectException(\Box_Exception::class); + $this->expectExceptionMessage('Selected billing period is not valid for addon'); + $bool = $this->api_guest->cart_add_item($data); } @@ -95,7 +100,10 @@ class Box_Mod_Cart_Api_GuestTest extends BBDbApiTestCase ), ), ); - $this->setExpectedException('\Box_Exception', 'Addon period parameter not passed'); + + $this->expectException(\Box_Exception::class); + $this->expectExceptionMessage('Addon period parameter not passed'); + $bool = $this->api_guest->cart_add_item($data); } @@ -112,7 +120,9 @@ class Box_Mod_Cart_Api_GuestTest extends BBDbApiTestCase ), ), ); - $this->api_guest->cart_add_item($data); + $return = $this->api_guest->cart_add_item($data); + + $this->assertTrue($return); } /** @@ -513,7 +523,7 @@ class Box_Mod_Cart_Api_GuestTest extends BBDbApiTestCase public function testApplyPromoForClient($discount, $clientGroupId, $ids, $shouldThrowException) { if ($shouldThrowException) { - $this->setExpectedException('Box_Exception'); + $this->expectException(\Box_Exception::class); } $this->api_guest->cart_reset(); diff --git a/tests/integration/bb-modules/mod_client/Api_AdminTest.php b/tests/integration/bb-modules/mod_client/Api_AdminTest.php index a5271d41c..201123e01 100644 --- a/tests/integration/bb-modules/mod_client/Api_AdminTest.php +++ b/tests/integration/bb-modules/mod_client/Api_AdminTest.php @@ -12,10 +12,10 @@ class Api_Admin_ClientTest extends BBDbApiTestCase 'id' => 1, ); $array = $this->api_admin->client_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->client_login($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data['email'] = 'new@gmail.com'; $data['first_name'] = 'phpunit'; @@ -30,20 +30,20 @@ class Api_Admin_ClientTest extends BBDbApiTestCase $this->assertTrue($bool); $array = $this->api_admin->client_get_statuses($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $bool = $this->api_admin->client_balance_add_funds(array('id' => 1, 'amount' => 100, 'description' => 'Added from PHPUnit')); $this->assertTrue($bool); $array = $this->api_admin->client_balance_get_list($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertEquals(count($array['list']), 1); $bool = $this->api_admin->client_balance_delete(array('id' => 1)); $this->assertTrue($bool); $array = $this->api_admin->client_balance_get_list($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertEquals(count($array['list']), 0); @@ -64,7 +64,7 @@ class Api_Admin_ClientTest extends BBDbApiTestCase ); $array = $this->api_admin->client_get_pairs($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); } public function testGroups() @@ -81,10 +81,10 @@ class Api_Admin_ClientTest extends BBDbApiTestCase $this->assertTrue($bool); $array = $this->api_admin->client_group_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->client_group_get_pairs($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $bool = $this->api_admin->client_group_delete($data); $this->assertTrue($bool); @@ -96,7 +96,7 @@ class Api_Admin_ClientTest extends BBDbApiTestCase 'id' => 1, ); $array = $this->api_admin->client_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertNull($array['auth_type']); } @@ -118,21 +118,21 @@ class Api_Admin_ClientTest extends BBDbApiTestCase public function testLoginHistoryGetList() { $array = $this->api_admin->client_login_history_get_list(array()); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertArrayHasKey('list', $array); $list = $array['list']; - $this->assertInternalType('array', $list); + $this->assertIsArray($list); if (count($list)) { $item = $list[0]; - $this->assertInternalType('array', $item); + $this->assertIsArray($item); $this->assertArrayHasKey('id', $item); $this->assertArrayHasKey('ip', $item); $this->assertArrayHasKey('created_at', $item); $this->assertArrayHasKey('client', $item); $staff = $item['client']; - $this->assertInternalType('array', $staff); + $this->assertIsArray($staff); $this->assertArrayHasKey('id', $staff); $this->assertArrayHasKey('first_name', $staff); $this->assertArrayHasKey('last_name', $staff); @@ -143,14 +143,14 @@ class Api_Admin_ClientTest extends BBDbApiTestCase public function testClientGetList() { $array = $this->api_admin->client_get_list(array()); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertArrayHasKey('list', $array); $list = $array['list']; - $this->assertInternalType('array', $list); + $this->assertIsArray($list); if (count($list)) { $item = $list[0]; - $this->assertInternalType('array', $item); + $this->assertIsArray($item); $this->assertArrayHasKey('id', $item); $this->assertArrayHasKey('aid', $item); $this->assertArrayHasKey('email', $item); @@ -191,13 +191,13 @@ class Api_Admin_ClientTest extends BBDbApiTestCase $this->assertTrue($bool); $array = $this->api_admin->client_balance_get_list(array()); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertArrayHasKey('list', $array); $list = $array['list']; - $this->assertInternalType('array', $list); + $this->assertIsArray($list); if (count($list)) { $item = $list[0]; - $this->assertInternalType('array', $item); + $this->assertIsArray($item); $this->assertArrayHasKey('id', $item); $this->assertArrayHasKey('description', $item); $this->assertArrayHasKey('amount', $item); diff --git a/tests/integration/bb-modules/mod_client/Api_ClientTest.php b/tests/integration/bb-modules/mod_client/Api_ClientTest.php index 15a787c78..b69cd9614 100644 --- a/tests/integration/bb-modules/mod_client/Api_ClientTest.php +++ b/tests/integration/bb-modules/mod_client/Api_ClientTest.php @@ -10,7 +10,7 @@ class Api_ClientTest extends BBDbApiTestCase { $array = $this->api_client->client_get(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'email' => 'newEmail@boxbilling.com', @@ -30,10 +30,10 @@ class Api_ClientTest extends BBDbApiTestCase $this->assertTrue($bool); $key = $this->api_client->client_api_key_get(array()); - $this->assertInternalType('string', $key); + $this->assertIsString($key); $newKey = $this->api_client->client_api_key_reset(array()); - $this->assertInternalType('string', $newKey); + $this->assertIsString($newKey); $this->assertNotEquals($key, $newKey); $data = array( @@ -44,20 +44,20 @@ class Api_ClientTest extends BBDbApiTestCase $this->assertTrue($bool); $array = $this->api_client->client_balance_get_list($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); } public function testClientBalanceGetList() { $array = $this->api_client->client_balance_get_list(array()); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertArrayHasKey('list', $array); $list = $array['list']; - $this->assertInternalType('array', $list); + $this->assertIsArray($list); if (count($list)) { $item = $list[0]; - $this->assertInternalType('array', $item); + $this->assertIsArray($item); $this->assertArrayHasKey('id', $item); $this->assertArrayHasKey('description', $item); $this->assertArrayHasKey('amount', $item); diff --git a/tests/integration/bb-modules/mod_client/Api_GuestTest.php b/tests/integration/bb-modules/mod_client/Api_GuestTest.php index 76ad18fa8..50163c27b 100644 --- a/tests/integration/bb-modules/mod_client/Api_GuestTest.php +++ b/tests/integration/bb-modules/mod_client/Api_GuestTest.php @@ -31,7 +31,7 @@ class Api_Guest_ClientTest extends BBDbApiTestCase 'password_confirm' => $pass, ); $id = $this->api_guest->client_create($data); - $this->assertInternalType('int', $id); + $this->assertIsInt($id); $client = $this->di['db']->load('Client', $id); $this->assertNotEquals($data['password'], $client->pass); @@ -93,7 +93,7 @@ class Api_Guest_ClientTest extends BBDbApiTestCase 'remember' => true ); $array = $this->api_guest->client_login($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertTrue(is_numeric($this->session->get('client_id')), 'Client id is not integer'); $bool = $this->api_client->client_logout($data); @@ -106,7 +106,7 @@ class Api_Guest_ClientTest extends BBDbApiTestCase public function testRequired() { $array = $this->api_guest->client_required(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); } public function testCreateWithCustom() @@ -146,7 +146,7 @@ class Api_Guest_ClientTest extends BBDbApiTestCase ); $id = $this->api_guest->client_create($data); - $this->assertInternalType('int', $id); + $this->assertIsInt($id); $client = $this->di['db']->load('Client', $id); $this->assertEquals($data['custom_5'], $client->custom_5); diff --git a/tests/integration/bb-modules/mod_client/ServiceTest.php b/tests/integration/bb-modules/mod_client/ServiceTest.php index b03ee089e..de212923d 100644 --- a/tests/integration/bb-modules/mod_client/ServiceTest.php +++ b/tests/integration/bb-modules/mod_client/ServiceTest.php @@ -23,7 +23,7 @@ class Box_Mod_Client_ServiceTest extends ApiTestCase $service = new \Box\Mod\Client\Service(); $service->setDi($this->di); $link = $service->generateEmailConfirmationLink(1); - $this->assertInternalType('string', $link); + $this->assertIsString($link); $this->assertEquals(strpos($link, 'http://'), 0); } @@ -48,7 +48,7 @@ class Box_Mod_Client_ServiceTest extends ApiTestCase $data['config'] = array(); $orderId = $this->api_admin->order_create($data); - $this->assertInternalType('int', $orderId); + $this->assertIsInt($orderId); //Client has invoice with items for order $invoiceModel = $this->di['db']->findOne('Invoice', 'client_id = ?', array($id)); diff --git a/tests/integration/bb-modules/mod_cron/Api_AdminTest.php b/tests/integration/bb-modules/mod_cron/Api_AdminTest.php index 8c09a6bf7..7bc08e45c 100644 --- a/tests/integration/bb-modules/mod_cron/Api_AdminTest.php +++ b/tests/integration/bb-modules/mod_cron/Api_AdminTest.php @@ -2,14 +2,14 @@ /** * @group Core */ -class Api_Admin_CronTest extends BBDbApiTestCase +class Api_AdminTest extends BBDbApiTestCase { protected $_initialSeedFile = 'orders.xml'; public function testRun() { $array = $this->api_system->cron_info(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $bool = $this->api_system->cron_run(); $this->assertTrue($bool); diff --git a/tests/integration/bb-modules/mod_currency/Api_AdminTest.php b/tests/integration/bb-modules/mod_currency/Api_AdminTest.php index 0c404bccc..54eed0059 100644 --- a/tests/integration/bb-modules/mod_currency/Api_AdminTest.php +++ b/tests/integration/bb-modules/mod_currency/Api_AdminTest.php @@ -9,14 +9,14 @@ class Api_Admin_CurrencyTest extends BBDbApiTestCase public function testCurrencies() { $array = $this->api_admin->currency_get_pairs(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->currency_get(array('code' => 'USD')); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertEquals('USD', $array['code']); $array = $this->api_admin->currency_get_default(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'code' => 'GBP', @@ -24,7 +24,7 @@ class Api_Admin_CurrencyTest extends BBDbApiTestCase 'format' => '{{price}}£', ); $code = $this->api_admin->currency_create($data); - $this->assertInternalType('string', $code); + $this->assertIsString($code); $bool = $this->api_admin->currency_update($data); $this->assertTrue($bool); @@ -43,11 +43,11 @@ class Api_Admin_CurrencyTest extends BBDbApiTestCase public function testCurerncyGetList() { $array = $this->api_admin->currency_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertArrayHasKey('list', $array); $list = $array['list']; - $this->assertInternalType('array', $list); + $this->assertIsArray($list); if (count($list)){ $item = $list[0]; $this->assertArrayHasKey('code', $item); diff --git a/tests/integration/bb-modules/mod_currency/Api_GuestTest.php b/tests/integration/bb-modules/mod_currency/Api_GuestTest.php index b48b00780..0d1744c5d 100644 --- a/tests/integration/bb-modules/mod_currency/Api_GuestTest.php +++ b/tests/integration/bb-modules/mod_currency/Api_GuestTest.php @@ -2,7 +2,7 @@ /** * @group Core */ -class Api_Guest_CurrencyTest extends BBDbApiTestCase +class Api_GuestTest extends BBDbApiTestCase { protected $_initialSeedFile = 'currencies.xml'; @@ -24,14 +24,14 @@ class Api_Guest_CurrencyTest extends BBDbApiTestCase public function testCurrency() { $array = $this->api_guest->currency_get_pairs(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_guest->currency_get(array('code'=>'usd')); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertEquals('USD', $array['code']); $array = $this->api_guest->currency_get(array('code'=>'eur')); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertEquals('EUR', $array['code']); } } \ No newline at end of file diff --git a/tests/integration/bb-modules/mod_email/Api_AdminTest.php b/tests/integration/bb-modules/mod_email/Api_AdminTest.php index 6d4e616f3..49122629f 100644 --- a/tests/integration/bb-modules/mod_email/Api_AdminTest.php +++ b/tests/integration/bb-modules/mod_email/Api_AdminTest.php @@ -2,7 +2,7 @@ /** * @group Core */ -class Api_Admin_EmailTest extends BBDbApiTestCase +class Api_AdminTest extends BBDbApiTestCase { protected $_initialSeedFile = 'emails.xml'; @@ -24,13 +24,13 @@ class Api_Admin_EmailTest extends BBDbApiTestCase public function testTemplates() { $array = $this->api_admin->email_template_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'id' => 1, ); $array = $this->api_admin->email_template_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'action_code' => 'test', @@ -64,13 +64,13 @@ class Api_Admin_EmailTest extends BBDbApiTestCase public function testEmails() { $array = $this->api_admin->email_email_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'id' => 1, ); $array = $this->api_admin->email_email_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); } public function testSend() @@ -208,11 +208,11 @@ class Api_Admin_EmailTest extends BBDbApiTestCase public function testEmailEmailGetList() { $array = $this->api_admin->email_email_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertArrayHasKey('list', $array); $list = $array['list']; - $this->assertInternalType('array', $list); + $this->assertIsArray($list); if (count($list)) { $item = $list[0]; $this->assertArrayHasKey('id', $item); @@ -230,11 +230,11 @@ class Api_Admin_EmailTest extends BBDbApiTestCase public function testEmailTemplateGetList() { $array = $this->api_admin->email_template_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertArrayHasKey('list', $array); $list = $array['list']; - $this->assertInternalType('array', $list); + $this->assertIsArray($list); if (count($list)) { $item = $list[0]; $this->assertArrayHasKey('id', $item); diff --git a/tests/integration/bb-modules/mod_email/Api_ClientTest.php b/tests/integration/bb-modules/mod_email/Api_ClientTest.php index 439bcd915..0449bf3a5 100644 --- a/tests/integration/bb-modules/mod_email/Api_ClientTest.php +++ b/tests/integration/bb-modules/mod_email/Api_ClientTest.php @@ -9,13 +9,13 @@ class Api_Client_EmailTest extends BBDbApiTestCase public function testEmails() { $array = $this->api_client->email_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'id' => 1, ); $array = $this->api_client->email_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); } public function testResend() @@ -46,11 +46,11 @@ class Api_Client_EmailTest extends BBDbApiTestCase public function testEmailEmailGetList() { $array = $this->api_client->email_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertArrayHasKey('list', $array); $list = $array['list']; - $this->assertInternalType('array', $list); + $this->assertIsArray($list); if (count($list)) { $item = $list[0]; $this->assertArrayHasKey('id', $item); diff --git a/tests/integration/bb-modules/mod_example/Api_ClientTest.php b/tests/integration/bb-modules/mod_example/Api_ClientTest.php index 5ad10db5a..9e5caf22b 100644 --- a/tests/integration/bb-modules/mod_example/Api_ClientTest.php +++ b/tests/integration/bb-modules/mod_example/Api_ClientTest.php @@ -2,7 +2,7 @@ /** * @group Core */ -class Box_Mod_Example_Api_ClientTest extends BBDbApiTestCase +class Api_ClientTest extends BBDbApiTestCase { protected $_mod = 'example'; protected $_initialSeedFile = 'mod_example.xml'; @@ -12,6 +12,6 @@ class Box_Mod_Example_Api_ClientTest extends BBDbApiTestCase $this->api_admin->extension_activate(array('id'=>'example', 'type'=>'mod')); $array = $this->api_client->example_get_info(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); } } \ No newline at end of file diff --git a/tests/integration/bb-modules/mod_example/ServiceTest.php b/tests/integration/bb-modules/mod_example/ServiceTest.php index 1738167c0..c227d361b 100644 --- a/tests/integration/bb-modules/mod_example/ServiceTest.php +++ b/tests/integration/bb-modules/mod_example/ServiceTest.php @@ -2,7 +2,7 @@ /** * @group Core */ -class Box_Mod_Activity_ServiceTest extends BBDbApiTestCase +class ServiceTest extends BBDbApiTestCase { protected $_initialSeedFile = 'example.xml'; @@ -31,8 +31,8 @@ class Box_Mod_Activity_ServiceTest extends BBDbApiTestCase 'client_id' => 1 ); list($sql, $params) = $service->getSearchQuery($data); - $this->assertInternalType('string', $sql); - $this->assertInternalType('array', $params); + $this->assertIsString($sql); + $this->assertIsArray($params); $this->assertArrayHasKey(':client_id', $params); $this->assertEquals($params[':client_id'], $data['client_id']); } diff --git a/tests/integration/bb-modules/mod_extension/Api_AdminTest.php b/tests/integration/bb-modules/mod_extension/Api_AdminTest.php index 9e352068a..e02178791 100644 --- a/tests/integration/bb-modules/mod_extension/Api_AdminTest.php +++ b/tests/integration/bb-modules/mod_extension/Api_AdminTest.php @@ -36,6 +36,8 @@ class Api_Admin_ExtensionTest extends BBDbApiTestCase 'id' => 'news', ); $bool = $this->api_admin->extension_uninstall($data); + + $this->assertTrue($bool); } public function testUpdate() @@ -85,7 +87,7 @@ class Api_Admin_ExtensionTest extends BBDbApiTestCase $array = $this->api_admin->extension_config_get($data); $array['ext'] = 'mod_email'; - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertEquals($data, $array); } @@ -96,7 +98,7 @@ class Api_Admin_ExtensionTest extends BBDbApiTestCase 'type' => 'mod', ); $array = $this->api_admin->extension_activate($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $bool = $this->api_guest->extension_is_on($data); $this->assertTrue($bool); @@ -112,28 +114,28 @@ class Api_Admin_ExtensionTest extends BBDbApiTestCase 'type' => 'server-manager', ); $array = $this->api_admin->extension_get_list($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->extension_get_list(array('active'=>true, 'type'=>'mod', 'search'=>'f')); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->extension_get_list(array('installed'=>true)); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->extension_get_list(array('has_settings'=>true)); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->extension_get_latest(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->extension_get_navigation(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->extension_languages(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->extension_languages(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); } public function testUpdate_Core() diff --git a/tests/integration/bb-modules/mod_extension/Api_GuestTest.php b/tests/integration/bb-modules/mod_extension/Api_GuestTest.php index 3d07a08b4..0fb9e8a32 100644 --- a/tests/integration/bb-modules/mod_extension/Api_GuestTest.php +++ b/tests/integration/bb-modules/mod_extension/Api_GuestTest.php @@ -9,10 +9,10 @@ class Api_Guest_ExtensionTest extends BBDbApiTestCase public function testLists() { $array = $this->api_guest->extension_languages(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_guest->extension_theme(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $bool = $this->api_guest->extension_is_on(array('mod'=>'system')); $this->assertTrue($bool); @@ -21,6 +21,6 @@ class Api_Guest_ExtensionTest extends BBDbApiTestCase $this->assertTrue($bool); $arr = $this->api_guest->extension_settings(array('ext'=>'mod_email')); - $this->assertInternalType('array', $arr); + $this->assertIsArray($arr); } } \ No newline at end of file diff --git a/tests/integration/bb-modules/mod_filemanager/Api_AdminTest.php b/tests/integration/bb-modules/mod_filemanager/Api_AdminTest.php index eb44e1a9f..11bca6369 100644 --- a/tests/integration/bb-modules/mod_filemanager/Api_AdminTest.php +++ b/tests/integration/bb-modules/mod_filemanager/Api_AdminTest.php @@ -7,7 +7,7 @@ class Box_Mod_Filemanager_Api_AdminTest extends BBDbApiTestCase public function testActions() { $array = $this->api_admin->filemanager_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertTrue(isset($array['filecount'])); $this->assertTrue(isset($array['files'])); diff --git a/tests/integration/bb-modules/mod_formbuilder/Api_AdminTest.php b/tests/integration/bb-modules/mod_formbuilder/Api_AdminTest.php index ea0f34166..9863f9ba9 100644 --- a/tests/integration/bb-modules/mod_formbuilder/Api_AdminTest.php +++ b/tests/integration/bb-modules/mod_formbuilder/Api_AdminTest.php @@ -157,7 +157,7 @@ class Api_Admin_FormbuilderTest extends BBDbApiTestCase $id = $this->api_admin->formbuilder_create_form(array( 'name' => 'New form' )); - $this->assertInternalType('int', $id); + $this->assertIsInt($id); $id2 = $this->api_admin->formbuilder_create_form(array( 'type' => null, 'name' => 'Form', @@ -166,14 +166,14 @@ class Api_Admin_FormbuilderTest extends BBDbApiTestCase 'type' => "checkbox" ))); - $this->assertInternalType('int', $id2); + $this->assertIsInt($id2); } public function testFieldAdd() { $fieldId = $this->api_admin->formbuilder_add_field(array('form_id' => 1, 'type' => 'text')); - $this->assertInternalType('int', $fieldId); + $this->assertIsInt($fieldId); $test = $this->api_admin->formbuilder_add_field(array( 'description' => 'Form field description', "label" => "Field label", @@ -192,7 +192,7 @@ class Api_Admin_FormbuilderTest extends BBDbApiTestCase 'show_suffix' => 'suffix', 'text_size' => 499 )); - $this->assertInternalType('int', $test); + $this->assertIsInt($test); $this->api_admin->formbuilder_get_form(array( 'id' => 1, 'form_id' => 1, @@ -207,7 +207,7 @@ class Api_Admin_FormbuilderTest extends BBDbApiTestCase public function testFormGet() { $array = $this->api_admin->formbuilder_get_form(array('id' => 1)); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertTrue(isset($array['fields'])); $this->assertNotEmpty($array['fields']); } @@ -216,7 +216,7 @@ class Api_Admin_FormbuilderTest extends BBDbApiTestCase public function testGetForm() { $form = $this->api_admin->formbuilder_get_form(array('id' => 1)); - $this->assertInternalType('array', $form); + $this->assertIsArray($form); $this->assertNotEmpty($form); } @@ -224,14 +224,14 @@ class Api_Admin_FormbuilderTest extends BBDbApiTestCase public function testGetFormFields() { $test = $this->api_admin->formbuilder_get_form_fields(array('form_id' => 1)); - $this->assertInternalType('array', $test); + $this->assertIsArray($test); $this->assertNotEmpty($test); } public function testGetField() { $test = $this->api_admin->formbuilder_get_field(array('id' => 1)); - $this->assertInternalType('array', $test); + $this->assertIsArray($test); $this->assertNotEmpty($test); } @@ -239,7 +239,7 @@ class Api_Admin_FormbuilderTest extends BBDbApiTestCase { $arr = $this->api_admin->formbuilder_get_forms(); $test = $arr[0]; - $this->assertInternalType('array', $test); + $this->assertIsArray($test); $this->assertArrayHasKey('product_count',$test); $this->assertArrayHasKey('order_count',$test); $this->assertArrayHasKey('name',$test); @@ -269,7 +269,7 @@ class Api_Admin_FormbuilderTest extends BBDbApiTestCase public function testUpdateField() { $test = $this->api_admin->formbuilder_update_field(array('id' => 3, 'description' => 'This is very awesome description.', 'name' => "Form name")); - $this->assertInternalType('int', $test); + $this->assertIsInt($test); $test = $this->api_admin->formbuilder_add_field(array( 'description' => 'Form field description', "label" => "Form field label", @@ -312,7 +312,7 @@ class Api_Admin_FormbuilderTest extends BBDbApiTestCase )); - $this->assertInternalType('int', $test); + $this->assertIsInt($test); } @@ -325,7 +325,7 @@ class Api_Admin_FormbuilderTest extends BBDbApiTestCase 'type' => 'horizontal', 'show_title' => '0' )); - $this->assertInternalType('bool', $test); + $this->assertIsBool($test); $this->assertTrue($test); } @@ -353,7 +353,7 @@ class Api_Admin_FormbuilderTest extends BBDbApiTestCase 'form_id' => 1, 'name' => 'Second' )); - $this->assertInternalType('int', $test); + $this->assertIsInt($test); } @@ -361,7 +361,7 @@ class Api_Admin_FormbuilderTest extends BBDbApiTestCase public function testGetPairs() { $test = $this->api_admin->formbuilder_get_pairs(); - $this->assertInternalType('array', $test); + $this->assertIsArray($test); } diff --git a/tests/integration/bb-modules/mod_formbuilder/Api_GuestTest.php b/tests/integration/bb-modules/mod_formbuilder/Api_GuestTest.php index 7eaa74462..4efe544f8 100644 --- a/tests/integration/bb-modules/mod_formbuilder/Api_GuestTest.php +++ b/tests/integration/bb-modules/mod_formbuilder/Api_GuestTest.php @@ -27,11 +27,11 @@ class Api_GUest_FormbuilderTest extends BBDbApiTestCase public function testGet() { $test = $this->api_guest->formbuilder_get(array("id" => 2)); - $this->assertInternalType('array', $test); + $this->assertIsArray($test); $this->assertNotEmpty($test); $test = $this->api_guest->formbuilder_get(array("id" => "2")); - $this->assertInternalType('array', $test); + $this->assertIsArray($test); $this->assertNotEmpty($test); diff --git a/tests/integration/bb-modules/mod_forum/Api_AdminTest.php b/tests/integration/bb-modules/mod_forum/Api_AdminTest.php index 073261207..98a33a901 100644 --- a/tests/integration/bb-modules/mod_forum/Api_AdminTest.php +++ b/tests/integration/bb-modules/mod_forum/Api_AdminTest.php @@ -13,7 +13,7 @@ class Api_Admin_ForumTest extends BBDbApiTestCase 'client_id' => 1, ); $array = $this->api_admin->forum_profile_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); } public function testForum() @@ -24,10 +24,10 @@ class Api_Admin_ForumTest extends BBDbApiTestCase ); $array = $this->api_admin->forum_get_categories($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->forum_get_pairs($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'title' => 'New forum as', @@ -39,7 +39,7 @@ class Api_Admin_ForumTest extends BBDbApiTestCase 'id' => $id, ); $array = $this->api_admin->forum_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data['title'] = 'new forum title'; $data['description'] = 'new forum desc'; @@ -64,19 +64,19 @@ class Api_Admin_ForumTest extends BBDbApiTestCase 'message' => 'message in this topic', ); $id = $this->api_admin->forum_topic_create($data); - $this->assertInternalType('int', $id); + $this->assertIsInt($id); $data = array( 'id' => $id, ); $array = $this->api_admin->forum_topic_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'id' => $id, ); $array = $this->api_admin->forum_topic_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data['title'] = 'new title'; $bool = $this->api_admin->forum_topic_update($data); @@ -92,17 +92,17 @@ class Api_Admin_ForumTest extends BBDbApiTestCase 'forum_topic_id' => 1, ); $array = $this->api_admin->forum_message_get_list($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'forum_topic_id' => 1, 'message' => 'this is my reply message', ); $int = $this->api_admin->forum_message_create($data); - $this->assertInternalType('int', $int); + $this->assertIsInt($int); $array = $this->api_admin->forum_message_get(array('id' => $int)); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data['id'] = $int; $data['message'] = 'updated message'; @@ -114,7 +114,7 @@ class Api_Admin_ForumTest extends BBDbApiTestCase 'message' => 'this is my second message', ); $int = $this->api_admin->forum_message_create($data); - $this->assertInternalType('int', $int); + $this->assertIsInt($int); $data['id'] = $int; $bool = $this->api_admin->forum_message_delete($data); @@ -163,7 +163,7 @@ class Api_Admin_ForumTest extends BBDbApiTestCase 'message' => 'this is my reply message', ); $int = $this->api_client->forum_post_message($post); - $this->assertInternalType('int', $int); + $this->assertIsInt($int); $profile = $this->api_admin->forum_profile_get($data); $this->assertEquals(1, $profile['points']); @@ -176,7 +176,7 @@ class Api_Admin_ForumTest extends BBDbApiTestCase 'message' => 'this is my reply message', ); $int = $this->api_client->forum_post_message($post); - $this->assertInternalType('int', $int); + $this->assertIsInt($int); $this->api_admin->forum_points_deduct(array('id' => $int)); } @@ -187,11 +187,11 @@ class Api_Admin_ForumTest extends BBDbApiTestCase 'per_page' => 10, ); $array = $this->api_admin->forum_get_list($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertArrayHasKey('list', $array); $list = $array['list']; - $this->assertInternalType('array', $list); + $this->assertIsArray($list); if (count($list)) { $item = $list[0]; $this->assertArrayHasKey('id', $item); @@ -205,7 +205,7 @@ class Api_Admin_ForumTest extends BBDbApiTestCase $this->assertArrayHasKey('updated_at', $item); $this->assertArrayHasKey('stats', $item); $stats = $item['stats']; - $this->assertInternalType('array', $stats); + $this->assertIsArray($stats); $this->assertArrayHasKey('topics_count', $stats); $this->assertArrayHasKey('posts_count', $stats); $this->assertArrayHasKey('views_count', $stats); @@ -218,11 +218,11 @@ class Api_Admin_ForumTest extends BBDbApiTestCase 'forum_id' => 1, ); $array = $this->api_admin->forum_topic_get_list($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertArrayHasKey('list', $array); $list = $array['list']; - $this->assertInternalType('array', $list); + $this->assertIsArray($list); if (count($list)) { $item = $list[0]; $this->assertArrayHasKey('id', $item); @@ -234,14 +234,14 @@ class Api_Admin_ForumTest extends BBDbApiTestCase $this->assertArrayHasKey('updated_at', $item); $this->assertArrayHasKey('forum', $item); $forum = $item['forum']; - $this->assertInternalType('array', $forum); + $this->assertIsArray($forum); $this->assertArrayHasKey('id', $forum); $this->assertArrayHasKey('slug', $forum); $this->assertArrayHasKey('title', $forum); $this->assertArrayHasKey('category', $forum); $this->assertArrayHasKey('stats', $item); $stats = $item['stats']; - $this->assertInternalType('array', $stats); + $this->assertIsArray($stats); $this->assertArrayHasKey('posts_count', $stats); $this->assertArrayHasKey('views_count', $stats); } diff --git a/tests/integration/bb-modules/mod_forum/Api_ClientTest.php b/tests/integration/bb-modules/mod_forum/Api_ClientTest.php index 017e1028c..5f67339a4 100644 --- a/tests/integration/bb-modules/mod_forum/Api_ClientTest.php +++ b/tests/integration/bb-modules/mod_forum/Api_ClientTest.php @@ -9,7 +9,7 @@ class Api_Client_ForumTest extends BBDbApiTestCase public function testFavorites() { $array = $this->api_client->forum_favorites(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertEquals(0, count($array)); $data = array( @@ -58,7 +58,7 @@ class Api_Client_ForumTest extends BBDbApiTestCase 'message' => 'this is my reply message', ); $int = $this->api_client->forum_post_message($data); - $this->assertInternalType('int', $int); + $this->assertIsInt($int); } public function testForum() @@ -68,22 +68,22 @@ class Api_Client_ForumTest extends BBDbApiTestCase 'per_page' => 10, ); $array = $this->api_client->forum_get_list($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_client->forum_get_categories($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'id' => 1, ); $array = $this->api_client->forum_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'slug' => 'discuss-about-everything', ); $array = $this->api_client->forum_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'forum_id' => '1', @@ -91,44 +91,44 @@ class Api_Client_ForumTest extends BBDbApiTestCase 'message' => 'message in this topic', ); $int = $this->api_client->forum_start_topic($data); - $this->assertInternalType('int', $int); + $this->assertIsInt($int); $data = array( 'forum_id' => 1, ); $array = $this->api_client->forum_get_topic_list($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'id' => 1, ); $array = $this->api_client->forum_get_topic($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'slug' => 'read-before-posting', ); $array = $this->api_client->forum_get_topic($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'forum_topic_id' => 2, ); $array = $this->api_client->forum_get_topic_message_list($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'forum_topic_id' => 1, 'message' => 'this is my reply message', ); $int = $this->api_client->forum_post_message($data); - $this->assertInternalType('int', $int); + $this->assertIsInt($int); } public function testProfile() { $int = $this->api_client->forum_profile(); - $this->assertInternalType('array', $int); + $this->assertIsArray($int); } protected function _callOnService($method, $data) @@ -144,11 +144,11 @@ class Api_Client_ForumTest extends BBDbApiTestCase 'per_page' => 10, ); $array = $this->api_client->forum_get_list($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertArrayHasKey('list', $array); $list = $array['list']; - $this->assertInternalType('array', $list); + $this->assertIsArray($list); if (count($list)) { $item = $list[0]; $this->assertArrayHasKey('id', $item); @@ -162,7 +162,7 @@ class Api_Client_ForumTest extends BBDbApiTestCase $this->assertArrayHasKey('updated_at', $item); $this->assertArrayHasKey('stats', $item); $stats = $item['stats']; - $this->assertInternalType('array', $stats); + $this->assertIsArray($stats); $this->assertArrayHasKey('topics_count', $stats); $this->assertArrayHasKey('posts_count', $stats); $this->assertArrayHasKey('views_count', $stats); diff --git a/tests/integration/bb-modules/mod_forum/Api_GuestTest.php b/tests/integration/bb-modules/mod_forum/Api_GuestTest.php index 9293e13d1..9b284770f 100644 --- a/tests/integration/bb-modules/mod_forum/Api_GuestTest.php +++ b/tests/integration/bb-modules/mod_forum/Api_GuestTest.php @@ -15,59 +15,59 @@ class Api_Guest_ForumTest extends BBDbApiTestCase 'per_page' => 10, ); $array = $this->api_guest->forum_get_list($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_guest->forum_get_categories($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'id' => 1, ); $array = $this->api_guest->forum_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'slug' => 'discuss-about-everything', ); $array = $this->api_guest->forum_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'forum_id' => 1, ); $array = $this->api_guest->forum_get_topic_list($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'id' => 1, ); $array = $this->api_guest->forum_get_topic($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'slug' => 'read-before-posting', ); $array = $this->api_guest->forum_get_topic($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'forum_topic_id' => 2, ); $array = $this->api_guest->forum_get_topic_message_list($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_guest->forum_members_list($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertArrayHasKey('list', $array); - $this->assertInternalType('array', $array['list']); + $this->assertIsArray($array['list']); $data = array( 'q' => 'BoxBilling' ); $array = $this->api_guest->forum_search($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertArrayHasKey('list', $array); - $this->assertInternalType('array', $array['list']); + $this->assertIsArray($array['list']); } public function testForumGetList() @@ -77,11 +77,11 @@ class Api_Guest_ForumTest extends BBDbApiTestCase 'per_page' => 10, ); $array = $this->api_guest->forum_get_list($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertArrayHasKey('list', $array); $list = $array['list']; - $this->assertInternalType('array', $list); + $this->assertIsArray($list); if (count($list)) { $item = $list[0]; $this->assertArrayHasKey('id', $item); @@ -95,7 +95,7 @@ class Api_Guest_ForumTest extends BBDbApiTestCase $this->assertArrayHasKey('updated_at', $item); $this->assertArrayHasKey('stats', $item); $stats = $item['stats']; - $this->assertInternalType('array', $stats); + $this->assertIsArray($stats); $this->assertArrayHasKey('topics_count', $stats); $this->assertArrayHasKey('posts_count', $stats); $this->assertArrayHasKey('views_count', $stats); diff --git a/tests/integration/bb-modules/mod_hook/Api_AdminTest.php b/tests/integration/bb-modules/mod_hook/Api_AdminTest.php index bbf68af2b..152b2a216 100644 --- a/tests/integration/bb-modules/mod_hook/Api_AdminTest.php +++ b/tests/integration/bb-modules/mod_hook/Api_AdminTest.php @@ -12,18 +12,22 @@ class Box_Mod_Hook_Api_AdminTest extends BBDbApiTestCase $this->assertFalse($this->api_admin->hook_call()); $bool = $this->api_admin->hook_call(array('event'=>'onAfterAdminActivateExtension')); $bool = $this->api_admin->hook_call(array('event'=>'onAfterAdminActivateExtension', 'params'=>array('id'=>'2'))); + + $this->assertTrue($bool); } public function testEventReturnData() { $this->api_admin->hook_batch_connect(); $data = $this->api_admin->hook_call(array('event'=>'onBeforeGuestPublicTicketOpen', 'params'=>array('message'=>'msg'))); + + $this->assertTrue(true); } public function testHookGetList() { $list = $this->api_admin->hook_get_list(); - $this->assertInternalType('array', $list); + $this->assertIsArray($list); $this->assertArrayHasKey('list', $list); $this->assertEquals(count($list['list']), $list['total']); } diff --git a/tests/integration/bb-modules/mod_invoice/Api_AdminTest.php b/tests/integration/bb-modules/mod_invoice/Api_AdminTest.php index d315ec413..bd50e3fe8 100644 --- a/tests/integration/bb-modules/mod_invoice/Api_AdminTest.php +++ b/tests/integration/bb-modules/mod_invoice/Api_AdminTest.php @@ -10,7 +10,7 @@ class Api_Admin_InvoiceTest extends BBDbApiTestCase public function testTax() { $array = $this->api_admin->invoice_tax_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'name' => 'VAT in United Kingdom', @@ -37,13 +37,13 @@ class Api_Admin_InvoiceTest extends BBDbApiTestCase public function testSubscriptions() { $array = $this->api_admin->invoice_subscription_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'id' => 1, ); $array = $this->api_admin->invoice_subscription_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data['status'] = 'canceled'; $bool = $this->api_admin->invoice_subscription_update($data); @@ -62,7 +62,7 @@ class Api_Admin_InvoiceTest extends BBDbApiTestCase $this->assertTrue(is_numeric($id)); $array = $this->api_admin->invoice_subscription_get(array('sid' => $sid)); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); } public function testInvoice() @@ -80,16 +80,16 @@ class Api_Admin_InvoiceTest extends BBDbApiTestCase $this->assertTrue($bool); $array = $this->api_admin->invoice_get_statuses(array()); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->invoice_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'id' => 1, ); $array = $this->api_admin->invoice_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'client_id' => 1, @@ -142,7 +142,7 @@ class Api_Admin_InvoiceTest extends BBDbApiTestCase public function testGatewayInstall() { $array = $this->api_admin->invoice_gateway_get_available(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'code' => $array[0], @@ -154,16 +154,16 @@ class Api_Admin_InvoiceTest extends BBDbApiTestCase public function testGateways() { $array = $this->api_admin->invoice_gateway_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->invoice_gateway_get_pairs(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'id' => 1, ); $array = $this->api_admin->invoice_gateway_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'id' => 1, @@ -222,7 +222,7 @@ class Api_Admin_InvoiceTest extends BBDbApiTestCase $this->assertTrue($bool); $array = $this->api_admin->invoice_transaction_get($txu); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $bool = $this->api_admin->invoice_transaction_process($txu); $this->assertTrue($bool); @@ -231,22 +231,22 @@ class Api_Admin_InvoiceTest extends BBDbApiTestCase $this->assertTrue($bool); $array = $this->api_admin->invoice_transaction_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->invoice_transaction_statuses(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->invoice_transaction_gateway_statuses(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->invoice_transaction_types(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->invoice_transaction_get_statuses(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->invoice_transaction_get_statuses_pairs(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); } public function testUpdate() @@ -390,11 +390,11 @@ class Api_Admin_InvoiceTest extends BBDbApiTestCase $bool = $this->api_admin->system_update_params(array('invoice_refund_logic' => 'negative_invoice')); $refunded_invoice_id = $this->api_admin->invoice_refund($data); - $this->assertInternalType('int', $refunded_invoice_id); + $this->assertIsInt($refunded_invoice_id); $bool = $this->api_admin->system_update_params(array('invoice_refund_logic' => 'credit_note')); $refunded_invoice_id = $this->api_admin->invoice_refund($data); - $this->assertInternalType('int', $refunded_invoice_id); + $this->assertIsInt($refunded_invoice_id); try { $this->api_admin->invoice_refund(array('id' => $refunded_invoice_id)); @@ -604,12 +604,12 @@ class Api_Admin_InvoiceTest extends BBDbApiTestCase public function testInvoiceGetList() { $array = $this->api_admin->invoice_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertArrayHasKey('list', $array); $list = $array['list']; - $this->assertInternalType('array', $list); + $this->assertIsArray($list); if (count($list)) { $item = $list[1]; @@ -635,9 +635,9 @@ class Api_Admin_InvoiceTest extends BBDbApiTestCase $this->assertArrayHasKey('created_at', $item); $this->assertArrayHasKey('updated_at', $item); $this->assertArrayHasKey('lines', $item); - $this->assertInternalType('array', $item['lines']); + $this->assertIsArray($item['lines']); $line = $item['lines'][0]; - $this->assertInternalType('array', $line); + $this->assertIsArray($line); $this->assertArrayHasKey('id', $line); $this->assertArrayHasKey('title', $line); $this->assertArrayHasKey('period', $line); @@ -655,7 +655,7 @@ class Api_Admin_InvoiceTest extends BBDbApiTestCase $this->assertArrayHasKey('status', $line); $this->assertArrayHasKey('lines', $item); - $this->assertInternalType('array', $item['buyer']); + $this->assertIsArray($item['buyer']); $buyer = $item['buyer']; $this->assertArrayHasKey('first_name', $buyer); $this->assertArrayHasKey('last_name', $buyer); @@ -671,7 +671,7 @@ class Api_Admin_InvoiceTest extends BBDbApiTestCase $this->assertArrayHasKey('email', $buyer); $this->assertArrayHasKey('zip', $buyer); - $this->assertInternalType('array', $item['seller']); + $this->assertIsArray($item['seller']); $seller = $item['seller']; $this->assertArrayHasKey('company', $seller); $this->assertArrayHasKey('company_vat', $seller); @@ -682,7 +682,7 @@ class Api_Admin_InvoiceTest extends BBDbApiTestCase $this->assertArrayHasKey('subscribable', $item); $this->assertArrayHasKey('subscription', $item); - $this->assertInternalType('array', $item['subscription']); + $this->assertIsArray($item['subscription']); $subscription = $item['subscription']; $this->assertArrayHasKey('unit', $subscription); @@ -694,11 +694,11 @@ class Api_Admin_InvoiceTest extends BBDbApiTestCase public function testTransactionGetList() { $array = $this->api_admin->invoice_transaction_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertArrayHasKey('list', $array); $list = $array['list']; - $this->assertInternalType('array', $list); + $this->assertIsArray($list); if (count($list)) { $item = $list[0]; @@ -725,11 +725,11 @@ class Api_Admin_InvoiceTest extends BBDbApiTestCase public function testGatewayGetList() { $array = $this->api_admin->invoice_gateway_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertArrayHasKey('list', $array); $list = $array['list']; - $this->assertInternalType('array', $list); + $this->assertIsArray($list); if (count($list)) { $item = $list[0]; @@ -739,18 +739,18 @@ class Api_Admin_InvoiceTest extends BBDbApiTestCase $this->assertArrayHasKey('allow_single', $item); $this->assertArrayHasKey('allow_recurrent', $item); $this->assertArrayHasKey('accepted_currencies', $item); - $this->assertInternalType('array', $item['accepted_currencies']); + $this->assertIsArray($item['accepted_currencies']); } } public function testSubscriptionGetList() { $array = $this->api_admin->invoice_subscription_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertArrayHasKey('list', $array); $list = $array['list']; - $this->assertInternalType('array', $list); + $this->assertIsArray($list); if (count($list)) { $item = $list[0]; @@ -765,7 +765,7 @@ class Api_Admin_InvoiceTest extends BBDbApiTestCase $this->assertArrayHasKey('client', $item); $client = $item['client']; - $this->assertInternalType('array', $client); + $this->assertIsArray($client); $this->assertArrayHasKey('id', $client); $this->assertArrayHasKey('aid', $client); $this->assertArrayHasKey('email', $client); @@ -792,14 +792,14 @@ class Api_Admin_InvoiceTest extends BBDbApiTestCase $this->assertArrayHasKey('gateway', $item); $gateway = $item['gateway']; - $this->assertInternalType('array', $gateway); + $this->assertIsArray($gateway); $this->assertArrayHasKey('id', $gateway); $this->assertArrayHasKey('code', $gateway); $this->assertArrayHasKey('title', $gateway); $this->assertArrayHasKey('allow_single', $gateway); $this->assertArrayHasKey('allow_recurrent', $gateway); $this->assertArrayHasKey('accepted_currencies', $gateway); - $this->assertInternalType('array', $gateway['accepted_currencies']); + $this->assertIsArray($gateway['accepted_currencies']); } } @@ -861,6 +861,8 @@ class Api_Admin_InvoiceTest extends BBDbApiTestCase public function testPrepareInvoiceDueDateProvider() { + $this->assertTrue(true); + return array( array(100, 100), array('', 1), @@ -900,7 +902,7 @@ class Api_Admin_InvoiceTest extends BBDbApiTestCase $tax = $this->api_admin->invoice_tax_get(array('id' => $id)); - $this->assertInternalType('array', $tax); + $this->assertIsArray($tax); $this->assertEquals($data['name'], $tax['name']); $this->assertEquals($data['taxrate'], $tax['taxrate']); $this->assertEquals($data['country'], $tax['country']); diff --git a/tests/integration/bb-modules/mod_invoice/Api_Client2Test.php b/tests/integration/bb-modules/mod_invoice/Api_Client2Test.php index 21973684f..488735325 100644 --- a/tests/integration/bb-modules/mod_invoice/Api_Client2Test.php +++ b/tests/integration/bb-modules/mod_invoice/Api_Client2Test.php @@ -20,13 +20,13 @@ class Api_Client_InvoiceTest extends BBDbApiTestCase $this->assertTrue($bool); $array = $this->api_client->invoice_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'hash' => $array['list'][0]['hash'], ); $array = $this->api_client->invoice_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); } public function testRenewal() @@ -35,7 +35,7 @@ class Api_Client_InvoiceTest extends BBDbApiTestCase 'order_id' => 3, ); $hash = $this->api_client->invoice_renewal_invoice($data); - $this->assertInternalType('string', $hash); + $this->assertIsString($hash); } public function testFunds() @@ -44,7 +44,7 @@ class Api_Client_InvoiceTest extends BBDbApiTestCase 'amount' => 30, ); $hash = $this->api_client->invoice_funds_invoice($data); - $this->assertInternalType('string', $hash); + $this->assertIsString($hash); } public function testDelete() @@ -63,16 +63,16 @@ class Api_Client_InvoiceTest extends BBDbApiTestCase public function testTransactions() { $array = $this->api_client->invoice_transaction_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); } public function testInvoiceGetList() { $array = $this->api_client->invoice_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertArrayHasKey('list', $array); $list = $array['list']; - $this->assertInternalType('array', $list); + $this->assertIsArray($list); if (count($list)) { $item = $list[1]; $this->assertArrayHasKey('id', $item); @@ -97,9 +97,9 @@ class Api_Client_InvoiceTest extends BBDbApiTestCase $this->assertArrayHasKey('created_at', $item); $this->assertArrayHasKey('updated_at', $item); $this->assertArrayHasKey('lines', $item); - $this->assertInternalType('array', $item['lines']); + $this->assertIsArray($item['lines']); $line = $item['lines'][0]; - $this->assertInternalType('array', $line); + $this->assertIsArray($line); $this->assertArrayHasKey('id', $line); $this->assertArrayHasKey('title', $line); $this->assertArrayHasKey('period', $line); @@ -116,7 +116,7 @@ class Api_Client_InvoiceTest extends BBDbApiTestCase $this->assertArrayHasKey('task', $line); $this->assertArrayHasKey('status', $line); $this->assertArrayHasKey('lines', $item); - $this->assertInternalType('array', $item['buyer']); + $this->assertIsArray($item['buyer']); $buyer = $item['buyer']; $this->assertArrayHasKey('first_name', $buyer); $this->assertArrayHasKey('last_name', $buyer); @@ -131,7 +131,7 @@ class Api_Client_InvoiceTest extends BBDbApiTestCase $this->assertArrayHasKey('phone_cc', $buyer); $this->assertArrayHasKey('email', $buyer); $this->assertArrayHasKey('zip', $buyer); - $this->assertInternalType('array', $item['seller']); + $this->assertIsArray($item['seller']); $seller = $item['seller']; $this->assertArrayHasKey('company', $seller); $this->assertArrayHasKey('company_vat', $seller); @@ -141,7 +141,7 @@ class Api_Client_InvoiceTest extends BBDbApiTestCase $this->assertArrayHasKey('email', $seller); $this->assertArrayHasKey('subscribable', $item); $this->assertArrayHasKey('subscription', $item); - $this->assertInternalType('array', $item['subscription']); + $this->assertIsArray($item['subscription']); $subscription = $item['subscription']; $this->assertArrayHasKey('unit', $subscription); $this->assertArrayHasKey('cycle', $subscription); @@ -152,11 +152,11 @@ class Api_Client_InvoiceTest extends BBDbApiTestCase public function testTransactionGetList() { $array = $this->api_client->invoice_transaction_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertArrayHasKey('list', $array); $list = $array['list']; - $this->assertInternalType('array', $list); + $this->assertIsArray($list); if (count($list)) { $item = $list[0]; diff --git a/tests/integration/bb-modules/mod_invoice/Api_ClientTest.php b/tests/integration/bb-modules/mod_invoice/Api_ClientTest.php index 667fca4fe..25559bae9 100644 --- a/tests/integration/bb-modules/mod_invoice/Api_ClientTest.php +++ b/tests/integration/bb-modules/mod_invoice/Api_ClientTest.php @@ -13,7 +13,7 @@ class Box_Mod_Invoice_Api_ClientTest extends BBModTestCase 'hash' => 'hash2', ); $array = $this->api_client->invoice_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data['gateway_id'] = 1; $bool = $this->api_client->invoice_update($data); diff --git a/tests/integration/bb-modules/mod_invoice/Api_GuestTest.php b/tests/integration/bb-modules/mod_invoice/Api_GuestTest.php index 3243f8c85..9e5e7c194 100644 --- a/tests/integration/bb-modules/mod_invoice/Api_GuestTest.php +++ b/tests/integration/bb-modules/mod_invoice/Api_GuestTest.php @@ -12,10 +12,10 @@ class Api_Guest_InvoiceTest extends BBDbApiTestCase 'hash' => 'hash', ); $array = $this->api_guest->invoice_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_guest->invoice_gateways(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); } @@ -43,7 +43,7 @@ class Api_Guest_InvoiceTest extends BBDbApiTestCase 'gateway_id' => $id, ); $array = $this->api_guest->invoice_payment($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); } public function testNewPayment() @@ -59,7 +59,7 @@ class Api_Guest_InvoiceTest extends BBDbApiTestCase 'gateway_id' => $gateway_id, ); $form = $this->api_guest->invoice_payment($data); - $this->assertInternalType('array', $form); + $this->assertIsArray($form); $this->assertEquals('html', $form['type']); $this->assertFalse(empty($form['result'])); @@ -72,7 +72,7 @@ class Api_Guest_InvoiceTest extends BBDbApiTestCase 'gateway_id' => $gateway_id, ); $form2 = $this->api_guest->invoice_payment($data); - $this->assertInternalType('array', $form2); + $this->assertIsArray($form2); $this->assertEquals('html', $form2['type']); $this->assertFalse(empty($form2['result'])); } diff --git a/tests/integration/bb-modules/mod_invoice/ServiceTest.php b/tests/integration/bb-modules/mod_invoice/ServiceTest.php index 9a39fc6bc..4a8594925 100644 --- a/tests/integration/bb-modules/mod_invoice/ServiceTest.php +++ b/tests/integration/bb-modules/mod_invoice/ServiceTest.php @@ -72,7 +72,9 @@ class Box_Mod_Invoice_ServiceTest extends BBDbApiTestCase 'post' => $transactionIpn['post'], ); - $this->setExpectedException('Payment_Exception', 'IPN is duplicate'); + $this->expectException(Payment_Exception::class); + $this->expectExceptionMessage('IPN is duplicate'); + $newId = $service->createAndProcess($ipn); $transactionModel = $this->di['db']->load('Transaction', $newId); diff --git a/tests/integration/bb-modules/mod_kb/Api_AdminTest.php b/tests/integration/bb-modules/mod_kb/Api_AdminTest.php index 44aa88d0e..9c84d1571 100644 --- a/tests/integration/bb-modules/mod_kb/Api_AdminTest.php +++ b/tests/integration/bb-modules/mod_kb/Api_AdminTest.php @@ -9,10 +9,10 @@ class Api_Admin_KbTest extends BBDbApiTestCase public function testKbCategory() { $array = $this->api_admin->kb_category_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->kb_category_get_pairs(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'title' => 'test', @@ -24,7 +24,7 @@ class Api_Admin_KbTest extends BBDbApiTestCase 'id' =>$id, ); $array = $this->api_admin->kb_category_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data['id'] = $id; $data['title'] = 'new'; @@ -38,13 +38,13 @@ class Api_Admin_KbTest extends BBDbApiTestCase public function testKbArticle() { $array = $this->api_admin->kb_article_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'id' => 1, ); $array = $this->api_admin->kb_article_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'kb_article_category_id' => 1, @@ -65,11 +65,11 @@ class Api_Admin_KbTest extends BBDbApiTestCase public function testArticleGetList() { $array = $this->api_admin->kb_article_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertArrayHasKey('list', $array); $list = $array['list']; - $this->assertInternalType('array', $list); + $this->assertIsArray($list); if (count($list)) { $item = $list[0]; @@ -82,7 +82,7 @@ class Api_Admin_KbTest extends BBDbApiTestCase $this->assertArrayHasKey('category', $item); $category = $item['category']; - $this->assertInternalType('array', $category); + $this->assertIsArray($category); $this->assertArrayHasKey('id', $category); $this->assertArrayHasKey('slug', $category); $this->assertArrayHasKey('title', $category); @@ -92,11 +92,11 @@ class Api_Admin_KbTest extends BBDbApiTestCase public function testCategoryGetList() { $array = $this->api_admin->kb_category_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertArrayHasKey('list', $array); $list = $array['list']; - $this->assertInternalType('array', $list); + $this->assertIsArray($list); if (count($list)) { $item = $list[0]; @@ -111,7 +111,7 @@ class Api_Admin_KbTest extends BBDbApiTestCase $articles = $item['articles']; if (count($articles)){ $article = $articles[0]; - $this->assertInternalType('array', $article); + $this->assertIsArray($article); $this->assertArrayHasKey('id', $article); $this->assertArrayHasKey('slug', $article); $this->assertArrayHasKey('title', $article); diff --git a/tests/integration/bb-modules/mod_kb/Api_GuestTest.php b/tests/integration/bb-modules/mod_kb/Api_GuestTest.php index 0c0aa6bec..0af0057bc 100644 --- a/tests/integration/bb-modules/mod_kb/Api_GuestTest.php +++ b/tests/integration/bb-modules/mod_kb/Api_GuestTest.php @@ -9,44 +9,44 @@ class Api_Guest_KbTest extends BBDbApiTestCase public function testKb() { $array = $this->api_guest->kb_article_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_guest->kb_category_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'id' => 1, ); $array = $this->api_guest->kb_article_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'slug' => 'how-to-contact-support', ); $array = $this->api_guest->kb_article_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'slug' => 'discuss-about-everything', ); $array = $this->api_guest->kb_category_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); } public function testcategory_get_pairs() { $array = $this->api_guest->kb_category_get_pairs(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); } public function testArticleGetList() { $array = $this->api_guest->kb_article_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertArrayHasKey('list', $array); $list = $array['list']; - $this->assertInternalType('array', $list); + $this->assertIsArray($list); if (count($list)) { $item = $list[0]; @@ -60,7 +60,7 @@ class Api_Guest_KbTest extends BBDbApiTestCase $this->assertArrayHasKey('category', $item); $category = $item['category']; - $this->assertInternalType('array', $category); + $this->assertIsArray($category); $this->assertArrayHasKey('id', $category); $this->assertArrayHasKey('slug', $category); $this->assertArrayHasKey('title', $category); @@ -70,11 +70,11 @@ class Api_Guest_KbTest extends BBDbApiTestCase public function testCategoryGetList() { $array = $this->api_admin->kb_category_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertArrayHasKey('list', $array); $list = $array['list']; - $this->assertInternalType('array', $list); + $this->assertIsArray($list); if (count($list)) { $item = $list[0]; @@ -89,7 +89,7 @@ class Api_Guest_KbTest extends BBDbApiTestCase $articles = $item['articles']; if (count($articles)) { $article = $articles[0]; - $this->assertInternalType('array', $article); + $this->assertIsArray($article); $this->assertArrayHasKey('id', $article); $this->assertArrayHasKey('slug', $article); $this->assertArrayHasKey('title', $article); diff --git a/tests/integration/bb-modules/mod_massmailer/Api_AdminTest.php b/tests/integration/bb-modules/mod_massmailer/Api_AdminTest.php index a4c3933d2..93e306cb7 100644 --- a/tests/integration/bb-modules/mod_massmailer/Api_AdminTest.php +++ b/tests/integration/bb-modules/mod_massmailer/Api_AdminTest.php @@ -10,10 +10,10 @@ class Box_Mod_Massmailer_Api_AdminTest extends BBModTestCase public function testActions() { $int = $this->api_admin->massmailer_create(array('subject'=>'Subject', 'content'=>'content')); - $this->assertInternalType('int', $int); + $this->assertIsInt($int); $array = $this->api_admin->massmailer_get(array('id'=>$int)); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'id'=>$int, @@ -27,19 +27,19 @@ class Box_Mod_Massmailer_Api_AdminTest extends BBModTestCase $this->assertTrue($bool); $array = $this->api_admin->massmailer_preview($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertTrue(isset($array['subject'])); $this->assertTrue(isset($array['content'])); $array = $this->api_admin->massmailer_receivers($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->massmailer_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertEquals(2, $array['total']); $new_id = $this->api_admin->massmailer_copy(array('id'=>$int)); - $this->assertInternalType('int', $new_id); + $this->assertIsInt($new_id); $bool = $this->api_admin->massmailer_send_test(array('id'=>$new_id)); $this->assertTrue($bool); @@ -61,16 +61,18 @@ class Box_Mod_Massmailer_Api_AdminTest extends BBModTestCase ); $this->api_admin->massmailer_update(array('id'=>1, 'filter'=>$filter)); $this->api_admin->massmailer_send(array('id'=>1)); + + $this->assertTrue(is_array($filter)); } public function testMassmailerGetList() { $array = $this->api_admin->massmailer_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertArrayHasKey('list', $array); $list = $array['list']; - $this->assertInternalType('array', $list); + $this->assertIsArray($list); if (count($list)) { $item = $list[0]; @@ -80,7 +82,7 @@ class Box_Mod_Massmailer_Api_AdminTest extends BBModTestCase $this->assertArrayHasKey('subject', $item); $this->assertArrayHasKey('content', $item); $this->assertArrayHasKey('filter', $item); - $this->assertInternalType('array', $item['filter']); + $this->assertIsArray($item['filter']); $this->assertArrayHasKey('status', $item); $this->assertArrayHasKey('sent_at', $item); $this->assertArrayHasKey('created_at', $item); diff --git a/tests/integration/bb-modules/mod_news/Api_AdminTest.php b/tests/integration/bb-modules/mod_news/Api_AdminTest.php index 696a11c5e..097d7ed2a 100644 --- a/tests/integration/bb-modules/mod_news/Api_AdminTest.php +++ b/tests/integration/bb-modules/mod_news/Api_AdminTest.php @@ -9,11 +9,11 @@ class Api_Admin_NewsTest extends BBDbApiTestCase public function testNews() { $array = $this->api_admin->news_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array('id'=>1); $array = $this->api_admin->news_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'id' => 1, @@ -38,11 +38,11 @@ class Api_Admin_NewsTest extends BBDbApiTestCase public function testNewsgetList() { $array = $this->api_admin->news_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertArrayHasKey('list', $array); $list = $array['list']; - $this->assertInternalType('array', $list); + $this->assertIsArray($list); if (count($list)) { $item = $list[0]; @@ -61,7 +61,7 @@ class Api_Admin_NewsTest extends BBDbApiTestCase $this->assertArrayHasKey('author', $item); $author = $item['author']; - $this->assertInternalType('array', $author); + $this->assertIsArray($author); $this->assertArrayHasKey('name', $author); $this->assertArrayHasKey('email', $author); @@ -85,6 +85,8 @@ class Api_Admin_NewsTest extends BBDbApiTestCase public function testNewsMoreTagProvider() { + $this->assertTrue(true); + return array( array( 'This is blog post with tag', diff --git a/tests/integration/bb-modules/mod_news/Api_GuestTest.php b/tests/integration/bb-modules/mod_news/Api_GuestTest.php index 0b1f54e37..654b5c772 100644 --- a/tests/integration/bb-modules/mod_news/Api_GuestTest.php +++ b/tests/integration/bb-modules/mod_news/Api_GuestTest.php @@ -14,25 +14,25 @@ class Api_Guest_NewsTest extends BBDbApiTestCase 'per_page' => 1, ); $array = $this->api_guest->news_get_list($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array('id' => 1); $array = $this->api_guest->news_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array('slug' => 'boxbilling-is-customizable'); $array = $this->api_guest->news_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); } public function testNewsgetList() { $array = $this->api_admin->news_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertArrayHasKey('list', $array); $list = $array['list']; - $this->assertInternalType('array', $list); + $this->assertIsArray($list); if (count($list)) { $item = $list[0]; @@ -51,7 +51,7 @@ class Api_Guest_NewsTest extends BBDbApiTestCase $this->assertArrayHasKey('author', $item); $author = $item['author']; - $this->assertInternalType('array', $author); + $this->assertIsArray($author); $this->assertArrayHasKey('name', $author); $this->assertArrayHasKey('email', $author); diff --git a/tests/integration/bb-modules/mod_notification/Api_AdminTest.php b/tests/integration/bb-modules/mod_notification/Api_AdminTest.php index bc19cb086..0fda96698 100644 --- a/tests/integration/bb-modules/mod_notification/Api_AdminTest.php +++ b/tests/integration/bb-modules/mod_notification/Api_AdminTest.php @@ -13,19 +13,19 @@ class Box_Mod_Notification_Api_AdminTest extends BBModTestCase $this->api_admin->extension_activate(array('id' => 'notification', 'type' => 'mod')); $int = $this->api_admin->notification_add(array('message' => 'Test message')); - $this->assertInternalType('int', $int); + $this->assertIsInt($int); $array = $this->api_admin->notification_get(array('id' => $int)); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->notification_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertEquals(1, $array['total']); $this->assertArrayHasKey('list', $array); $list = $array['list']; $item = $list[0]; - $this->assertInternalType('array', $item); + $this->assertIsArray($item); $this->assertArrayHasKey('id', $item); $this->assertArrayHasKey('client_id', $item); $this->assertArrayHasKey('extension', $item); diff --git a/tests/integration/bb-modules/mod_order/Api_AdminTest.php b/tests/integration/bb-modules/mod_order/Api_AdminTest.php index 6eb3bfce6..02b9bd76d 100644 --- a/tests/integration/bb-modules/mod_order/Api_AdminTest.php +++ b/tests/integration/bb-modules/mod_order/Api_AdminTest.php @@ -18,7 +18,7 @@ class Api_Admin_OrderTest extends BBDbApiTestCase $bool = $this->api_admin->order_update(array('id'=>'1', 'meta'=>$meta)); $this->assertTrue($bool); $order = $this->api_admin->order_get(array('id'=>1)); - $this->assertInternalType('array', $order); + $this->assertIsArray($order); $this->assertTrue(isset($order['meta'])); $this->assertEquals('value 1', $order['meta']['param_1']); $this->assertEquals('value 2', $order['meta']['param_2']); @@ -54,11 +54,11 @@ class Api_Admin_OrderTest extends BBDbApiTestCase $data['id'] = $id; $order = $this->api_admin->order_get($data); - $this->assertInternalType('array', $order); + $this->assertIsArray($order); $this->assertEquals($id, $order['id']); $list = $this->api_admin->order_get_list(array()); - $this->assertInternalType('array', $list); + $this->assertIsArray($list); $bool = $this->api_admin->order_update(array('id'=>1,'expires_at'=>date('Y-m-d H:i:s', strtotime('+ 2 days')))); $this->assertTrue($bool); @@ -70,7 +70,7 @@ class Api_Admin_OrderTest extends BBDbApiTestCase $this->assertTrue($bool); $array = $this->api_admin->order_service($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $bool = $this->api_admin->order_suspend($data); $this->assertTrue($bool); @@ -101,10 +101,10 @@ class Api_Admin_OrderTest extends BBDbApiTestCase $this->assertTrue($bool); $list = $this->api_admin->order_status_history_get_list($data); - $this->assertInternalType('array', $list); + $this->assertIsArray($list); $array = $this->api_admin->order_addons($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $bool = $this->api_admin->order_delete($data); $this->assertTrue($bool); @@ -113,13 +113,13 @@ class Api_Admin_OrderTest extends BBDbApiTestCase public function testLists() { $array = $this->api_admin->order_get_invoice_options(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->order_get_status_pairs(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->order_get_statuses(array()); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); } public function testSuspension() @@ -250,7 +250,7 @@ class Api_Admin_OrderTest extends BBDbApiTestCase $this->assertTrue($bool); $order = $this->api_admin->order_get($data); - $this->assertInternalType('array', $order); + $this->assertIsArray($order); $this->assertTrue(!is_null($order['expires_at']), 'Domain Order expiration date was not set after activation'); } @@ -287,7 +287,7 @@ class Api_Admin_OrderTest extends BBDbApiTestCase $data['config'] = $config; $id = $this->api_admin->order_create($data); - $this->assertInternalType('int', $id); + $this->assertIsInt($id); } /** diff --git a/tests/integration/bb-modules/mod_order/Api_ClientTest.php b/tests/integration/bb-modules/mod_order/Api_ClientTest.php index f882ba44a..8755d61b0 100644 --- a/tests/integration/bb-modules/mod_order/Api_ClientTest.php +++ b/tests/integration/bb-modules/mod_order/Api_ClientTest.php @@ -13,7 +13,7 @@ class Api_Client_OrderTest extends BBDbApiTestCase 'per_page' => 10, ); $array = $this->api_client->order_get_list($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'page' => 1, @@ -21,16 +21,16 @@ class Api_Client_OrderTest extends BBDbApiTestCase 'expiring' => 1, ); $array = $this->api_client->order_get_list($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'id' => 1, ); $array = $this->api_client->order_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_client->order_addons($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); } public function testDelete() @@ -59,7 +59,7 @@ class Api_Client_OrderTest extends BBDbApiTestCase $result = $this->api_client->order_service($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertNotEmpty($result); $this->assertEquals($expected, $result); @@ -72,7 +72,7 @@ class Api_Client_OrderTest extends BBDbApiTestCase ); $result = $this->api_client->order_upgradables($data); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertEmpty($result); } } diff --git a/tests/integration/bb-modules/mod_page/Api_AdminTest.php b/tests/integration/bb-modules/mod_page/Api_AdminTest.php index 00c6d3c7f..4fbf41fbc 100644 --- a/tests/integration/bb-modules/mod_page/Api_AdminTest.php +++ b/tests/integration/bb-modules/mod_page/Api_AdminTest.php @@ -7,6 +7,6 @@ class Box_Mod_Page_Api_AdminTest extends BBModTestCase public function testMod() { $array = $this->api_admin->page_get_pairs(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); } } \ No newline at end of file diff --git a/tests/integration/bb-modules/mod_paidsupport/ServiceTest.php b/tests/integration/bb-modules/mod_paidsupport/ServiceTest.php index 668084582..85669d208 100644 --- a/tests/integration/bb-modules/mod_paidsupport/ServiceTest.php +++ b/tests/integration/bb-modules/mod_paidsupport/ServiceTest.php @@ -3,7 +3,7 @@ class Box_Mod_Paidsupport_ServiceTest extends ApiTestCase { - public function setup() + public function setup(): void { parent::setUp(); $data = array( @@ -168,7 +168,8 @@ class Box_Mod_Paidsupport_ServiceTest extends ApiTestCase $supportTickets = $this->di['db']->find('SupportTicket'); - $this->setExpectedException('\Box_Exception', $errorMessage); + $this->expectException(\Box_Exception::class); + $this->expectExceptionMessage($errorMessage); $this->api_client->support_ticket_create($data); $supportTicketsAfterCreate = $this->di['db']->find('SupportTicket'); diff --git a/tests/integration/bb-modules/mod_product/Api_AdminTest.php b/tests/integration/bb-modules/mod_product/Api_AdminTest.php index 21a594b6f..cdf039cb0 100644 --- a/tests/integration/bb-modules/mod_product/Api_AdminTest.php +++ b/tests/integration/bb-modules/mod_product/Api_AdminTest.php @@ -7,19 +7,19 @@ class Api_Admin_ProductTest extends ApiTestCase public function testLists() { $list = $this->api_admin->product_get_list(); - $this->assertInternalType('array', $list); + $this->assertIsArray($list); $list = $this->api_admin->product_get_pairs(); - $this->assertInternalType('array', $list); + $this->assertIsArray($list); $list = $this->api_admin->product_get_types(); - $this->assertInternalType('array', $list); + $this->assertIsArray($list); $data = array( 'id' => 10, ); $array = $this->api_admin->product_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); } public function testProduct() @@ -46,7 +46,7 @@ class Api_Admin_ProductTest extends ApiTestCase public function testAddons() { $array = $this->api_admin->product_addon_get_pairs(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( @@ -60,7 +60,7 @@ class Api_Admin_ProductTest extends ApiTestCase 'title' => 'new title', ); $array = $this->api_admin->product_addon_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $bool = $this->api_admin->product_addon_update($data); $this->assertTrue($bool); @@ -72,7 +72,7 @@ class Api_Admin_ProductTest extends ApiTestCase public function testCategory() { $array = $this->api_admin->product_category_get_pairs(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'title' => 'title', @@ -85,7 +85,7 @@ class Api_Admin_ProductTest extends ApiTestCase 'title' => 'title', ); $array = $this->api_admin->product_category_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $bool = $this->api_admin->product_category_update($data); $this->assertTrue($bool); @@ -98,7 +98,7 @@ class Api_Admin_ProductTest extends ApiTestCase public function testPromos() { $array = $this->api_admin->product_promo_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'code' => 'title', @@ -113,7 +113,7 @@ class Api_Admin_ProductTest extends ApiTestCase 'value' => '25', ); $array = $this->api_admin->product_promo_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $bool = $this->api_admin->product_promo_update($data); $this->assertTrue($bool); @@ -126,11 +126,11 @@ class Api_Admin_ProductTest extends ApiTestCase public function testProductGetList() { $array = $this->api_admin->product_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertArrayHasKey('list', $array); $list = $array['list']; - $this->assertInternalType('array', $list); + $this->assertIsArray($list); $item = $list[0]; $this->assertArrayHasKey('id', $item); @@ -147,17 +147,17 @@ class Api_Admin_ProductTest extends ApiTestCase $this->assertArrayHasKey('pricing', $item); $pricing = $item['pricing']; - $this->assertInternalType('array', $item['pricing']); + $this->assertIsArray($item['pricing']); $this->assertArrayHasKey('type', $pricing); $this->assertArrayHasKey('free', $pricing); $this->assertArrayHasKey('once', $pricing); $this->assertArrayHasKey('recurrent', $pricing); $this->assertArrayHasKey('config', $item); - $this->assertInternalType('array', $item['config']); + $this->assertIsArray($item['config']); $this->assertArrayHasKey('addons', $item); - $this->assertInternalType('array', $item['addons']); + $this->assertIsArray($item['addons']); $this->assertArrayHasKey('price_starting_from', $item); $this->assertArrayHasKey('icon_url', $item); @@ -165,22 +165,22 @@ class Api_Admin_ProductTest extends ApiTestCase $this->assertArrayHasKey('quantity_in_stock', $item); $this->assertArrayHasKey('stock_control', $item); $this->assertArrayHasKey('upgrades', $item); - $this->assertInternalType('array', $item['upgrades']); + $this->assertIsArray($item['upgrades']); $this->assertArrayHasKey('status', $item); $this->assertArrayHasKey('hidden', $item); $this->assertArrayHasKey('setup', $item); $this->assertArrayHasKey('category', $item); - $this->assertInternalType('array', $item['category']); + $this->assertIsArray($item['category']); } public function testProductPromoGetList() { $array = $this->api_admin->product_promo_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertArrayHasKey('list', $array); $list = $array['list']; - $this->assertInternalType('array', $list); + $this->assertIsArray($list); $item = $list[0]; $this->assertArrayHasKey('id', $item); @@ -201,7 +201,7 @@ class Api_Admin_ProductTest extends ApiTestCase $this->assertArrayHasKey('created_at', $item); $this->assertArrayHasKey('updated_at', $item); $this->assertArrayHasKey('applies_to', $item); - $this->assertInternalType('array', $item['applies_to']); + $this->assertIsArray($item['applies_to']); } @@ -212,7 +212,11 @@ class Api_Admin_ProductTest extends ApiTestCase 'type' => Model_ProductTable::DOMAIN, ); - $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.'); + + for($i = 0; $i< 2; $i++){ $id = $this->api_admin->product_prepare($data); } diff --git a/tests/integration/bb-modules/mod_product/Api_GuestTest.php b/tests/integration/bb-modules/mod_product/Api_GuestTest.php index 060506bd3..82e6cbfd5 100644 --- a/tests/integration/bb-modules/mod_product/Api_GuestTest.php +++ b/tests/integration/bb-modules/mod_product/Api_GuestTest.php @@ -9,39 +9,39 @@ class Api_Guest_ProductTest extends BBDbApiTestCase public function testGetAll() { $list = $this->api_guest->product_get_pairs(); - $this->assertInternalType('array', $list); + $this->assertIsArray($list); $list = $this->api_guest->product_get_list(); - $this->assertInternalType('array', $list); + $this->assertIsArray($list); $list = $this->api_guest->product_category_get_pairs(); - $this->assertInternalType('array', $list); + $this->assertIsArray($list); $data = array( 'id' => 10, ); $list = $this->api_guest->product_get($data); - $this->assertInternalType('array', $list); + $this->assertIsArray($list); $list = $this->api_guest->product_get_slider($data); - $this->assertInternalType('array', $list); + $this->assertIsArray($list); } public function testCategoryGetList() { $pager = $this->api_guest->product_category_get_list(); - $this->assertInternalType('array', $pager); + $this->assertIsArray($pager); $this->assertArrayHasKey('list', $pager); $list = $pager['list']; - $this->assertInternalType('array', $list); + $this->assertIsArray($list); $item = $list[0]; $this->assertArrayHasKey('price_starting_from', $item); $this->assertArrayHasKey('icon_url', $item); $this->assertArrayHasKey('type', $item); $this->assertArrayHasKey('products', $item); - $this->assertInternalType('array', $item['products']); + $this->assertIsArray($item['products']); } /* @@ -58,11 +58,11 @@ class Api_Guest_ProductTest extends BBDbApiTestCase public function testProductGetList() { $array = $this->api_guest->product_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertArrayHasKey('list', $array); $list = $array['list']; - $this->assertInternalType('array', $list); + $this->assertIsArray($list); $item = $list[0]; $this->assertArrayHasKey('id', $item); @@ -79,17 +79,17 @@ class Api_Guest_ProductTest extends BBDbApiTestCase $this->assertArrayHasKey('pricing', $item); $pricing = $item['pricing']; - $this->assertInternalType('array', $item['pricing']); + $this->assertIsArray($item['pricing']); $this->assertArrayHasKey('type', $pricing); $this->assertArrayHasKey('free', $pricing); $this->assertArrayHasKey('once', $pricing); $this->assertArrayHasKey('recurrent', $pricing); $this->assertArrayHasKey('config', $item); - $this->assertInternalType('array', $item['config']); + $this->assertIsArray($item['config']); $this->assertArrayHasKey('addons', $item); - $this->assertInternalType('array', $item['addons']); + $this->assertIsArray($item['addons']); $this->assertArrayHasKey('price_starting_from', $item); $this->assertArrayHasKey('icon_url', $item); diff --git a/tests/integration/bb-modules/mod_product/PromoTest.php b/tests/integration/bb-modules/mod_product/PromoTest.php index 3891dc99a..18bcb88dd 100644 --- a/tests/integration/bb-modules/mod_product/PromoTest.php +++ b/tests/integration/bb-modules/mod_product/PromoTest.php @@ -7,6 +7,6 @@ class Api_Admin_PromoTest extends ApiTestCase public function testPromo() { $array = $this->api_admin->product_promo_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); } } \ No newline at end of file diff --git a/tests/integration/bb-modules/mod_profile/Api_AdminTest.php b/tests/integration/bb-modules/mod_profile/Api_AdminTest.php index 21d2a4f82..c68bdc169 100644 --- a/tests/integration/bb-modules/mod_profile/Api_AdminTest.php +++ b/tests/integration/bb-modules/mod_profile/Api_AdminTest.php @@ -9,7 +9,7 @@ class Api_Admin_ProfileTest extends BBDbApiTestCase public function testProfile() { $array = $this->api_admin->profile_get(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $bool = $this->api_admin->profile_logout(); $this->assertTrue($bool); diff --git a/tests/integration/bb-modules/mod_profile/Api_ClientTest.php b/tests/integration/bb-modules/mod_profile/Api_ClientTest.php index 9002c65ff..96984477e 100644 --- a/tests/integration/bb-modules/mod_profile/Api_ClientTest.php +++ b/tests/integration/bb-modules/mod_profile/Api_ClientTest.php @@ -9,7 +9,7 @@ class Api_Client_ProfileTest extends BBDbApiTestCase public function testProfile() { $array = $this->api_client->profile_get(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'email' => 'email@test.com', @@ -44,16 +44,16 @@ class Api_Client_ProfileTest extends BBDbApiTestCase public function testApi() { $string = $this->api_client->profile_api_key_reset(); - $this->assertInternalType('string', $string); + $this->assertIsString($string); $string = $this->api_client->profile_api_key_get(); - $this->assertInternalType('string', $string); + $this->assertIsString($string); } public function testBalance() { $array = $this->api_client->client_balance_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); } public function testLogout() diff --git a/tests/integration/bb-modules/mod_queue/Api_AdminTest.php b/tests/integration/bb-modules/mod_queue/Api_AdminTest.php index cb0192de0..f212285b1 100644 --- a/tests/integration/bb-modules/mod_queue/Api_AdminTest.php +++ b/tests/integration/bb-modules/mod_queue/Api_AdminTest.php @@ -10,27 +10,27 @@ class Box_Mod_Queue_Api_AdminTest extends BBModTestCase public function testQueue() { $int = $this->api_admin->queue_message_add(array('queue'=>'phpunit', 'mod'=>'queue', 'handler'=>'dummy', 'params'=>'value')); - $this->assertInternalType('int', $int); + $this->assertIsInt($int); $int = $this->api_admin->queue_message_add(array('queue'=>'phpunit', 'mod'=>'queue', 'handler'=>'dummy', 'params'=>'value2')); - $this->assertInternalType('int', $int); + $this->assertIsInt($int); $int = $this->api_admin->queue_message_add(array('queue'=>'phpunit2', 'mod'=>'queue', 'handler'=>'dummy', 'params'=>array('value2', 'lll'=>'ss'))); - $this->assertInternalType('int', $int); + $this->assertIsInt($int); $int = $this->api_admin->queue_message_add(array('queue'=>'phpunit2', 'mod'=>'queue', 'handler'=>'dummy', 'params'=>array('value2'))); - $this->assertInternalType('int', $int); + $this->assertIsInt($int); $bool = $this->api_admin->queue_message_delete(array('id'=>$int)); $this->assertTrue($bool); $array = $this->api_admin->queue_get(array('queue'=>'phpunit2')); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertTrue(isset($array['messages_count'])); $this->assertEquals(1, $array['messages_count']); $array = $this->api_admin->queue_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertEquals(2, $array['total']); $bool = $this->api_admin->queue_execute(array('queue'=>'phpunit')); @@ -40,10 +40,10 @@ class Box_Mod_Queue_Api_AdminTest extends BBModTestCase public function testLater() { $int = $this->api_admin->queue_message_add(array('queue'=>'phpunit', 'mod'=>'queue', 'handler'=>'dummy', 'params'=>'right now')); - $this->assertInternalType('int', $int); + $this->assertIsInt($int); $int = $this->api_admin->queue_message_add(array('queue'=>'phpunit', 'mod'=>'queue', 'handler'=>'dummy', 'execute_at'=>date('Y-m-d H:i:s', strtotime('+10 seconds')), 'params'=>'later')); - $this->assertInternalType('int', $int); + $this->assertIsInt($int); $bool = $this->api_admin->queue_execute(array('queue'=>'phpunit')); $this->assertTrue($bool); @@ -52,15 +52,15 @@ class Box_Mod_Queue_Api_AdminTest extends BBModTestCase public function testQueueGetList() { $int = $this->api_admin->queue_message_add(array('queue' => 'phpunit', 'mod' => 'queue', 'handler' => 'dummy', 'params' => 'right now')); - $this->assertInternalType('int', $int); + $this->assertIsInt($int); $array = $this->api_admin->queue_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertEquals(1, $array['total']); $this->assertArrayHasKey('list', $array); $list = $array['list']; - $this->assertInternalType('array', $list); + $this->assertIsArray($list); $item = $list[0]; diff --git a/tests/integration/bb-modules/mod_redirect/Api_AdminTest.php b/tests/integration/bb-modules/mod_redirect/Api_AdminTest.php index c7f3c7917..ec4bace0e 100644 --- a/tests/integration/bb-modules/mod_redirect/Api_AdminTest.php +++ b/tests/integration/bb-modules/mod_redirect/Api_AdminTest.php @@ -11,10 +11,10 @@ class Box_Mod_Redirect_Api_AdminTest extends BBModTestCase public function testRedirect() { $array = $this->api_admin->redirect_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $int = $this->api_admin->redirect_create(array('path'=>'/forum', 'target'=>'new-forum')); - $this->assertInternalType('int', $int); + $this->assertIsInt($int); $r = $this->api_admin->redirect_get(array('id'=>$int)); $this->assertTrue(isset($r['id'])); diff --git a/tests/integration/bb-modules/mod_serviceboxbillinglicense/Api_ClientTest.php b/tests/integration/bb-modules/mod_serviceboxbillinglicense/Api_ClientTest.php index 8be560c32..ab313e59e 100644 --- a/tests/integration/bb-modules/mod_serviceboxbillinglicense/Api_ClientTest.php +++ b/tests/integration/bb-modules/mod_serviceboxbillinglicense/Api_ClientTest.php @@ -38,7 +38,9 @@ class Api_Client_ServiceBoxBillinglicenseTest extends BBDbApiTestCase $clientApi = new Box\Mod\Serviceboxbillinglicense\Api\Client(); $clientApi->setDi($this->di); - $this->setExpectedException('\Box_Exception', 'Order id is required'); + $this->expectException(\Box_Exception::class); + $this->expectExceptionMessage('Order id is required'); + $bool = $clientApi->reset($data); } @@ -57,7 +59,9 @@ class Api_Client_ServiceBoxBillinglicenseTest extends BBDbApiTestCase $clientApi->setDi($this->di); $clientApi->setIdentity($client); - $this->setExpectedException('\Box_Exception', 'BoxBilling license order not found'); + $this->expectException(\Box_Exception::class); + $this->expectExceptionMessage('BoxBilling license order not found'); + $bool = $clientApi->reset($data); } @@ -75,7 +79,9 @@ class Api_Client_ServiceBoxBillinglicenseTest extends BBDbApiTestCase $clientApi->setDi($this->di); $clientApi->setIdentity($client); - $this->setExpectedException('\Box_Exception', 'Order is not activated'); + $this->expectException(\Box_Exception::class); + $this->expectExceptionMessage('Order is not activated'); + $bool = $clientApi->reset($data); } } \ No newline at end of file diff --git a/tests/integration/bb-modules/mod_serviceboxbillinglicense/ServiceTest.php b/tests/integration/bb-modules/mod_serviceboxbillinglicense/ServiceTest.php index 3a764e75c..2a9b0ee4f 100644 --- a/tests/integration/bb-modules/mod_serviceboxbillinglicense/ServiceTest.php +++ b/tests/integration/bb-modules/mod_serviceboxbillinglicense/ServiceTest.php @@ -34,19 +34,28 @@ class ServiceBoxBillinglicenseTest extends BBDbApiTestCase $model = $service->create($order); $this->assertInstanceOf('RedBeanPHP\OODBBean', $model); - $this->setExpectedException('\Box_Exception', 'Could not activate order. Service was not created', 7456); + + $this->expectException(\Box_Exception::class); + $this->expectExceptionCode(7456); + $this->expectExceptionMessage('Could not activate order. Service was not created'); $service->activate($order, null); $result = $service->activate($order, $model); $this->assertTrue($result); - $this->setExpectedException('\Box_Exception', 'Could not activate order. Service was not created', 7456); + + $this->expectException(\Box_Exception::class); + $this->expectExceptionCode(7456); + $this->expectExceptionMessage('Could not activate order. Service was not created'); $service->suspend($order, null); $result = $service->suspend($order, $model); $this->assertTrue($result); - $this->setExpectedException('\Box_Exception', 'Could not activate order. Service was not created', 7456); + + $this->expectException(\Box_Exception::class); + $this->expectExceptionCode(7456); + $this->expectExceptionMessage('Could not activate order. Service was not created'); $service->unsuspend($order, null); $result = $service->unsuspend($order, $model); @@ -56,13 +65,13 @@ class ServiceBoxBillinglicenseTest extends BBDbApiTestCase $this->assertTrue($result); $result = $service->licenseDetails($model); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $result = $service->licenseReset($model); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $result = $service->toApiArray($model); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertArrayHasKey('id', $result); $this->assertArrayHasKey('oid', $result); diff --git a/tests/integration/bb-modules/mod_servicedomain/Api_GuestTest.php b/tests/integration/bb-modules/mod_servicedomain/Api_GuestTest.php index d49f25abe..01990d250 100644 --- a/tests/integration/bb-modules/mod_servicedomain/Api_GuestTest.php +++ b/tests/integration/bb-modules/mod_servicedomain/Api_GuestTest.php @@ -19,12 +19,12 @@ class Api_Guest_ServiceDomainTest extends BBDbApiTestCase $this->assertTrue($bool); $array = $this->api_guest->servicedomain_pricing($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); } public function testTlds() { $array = $this->api_guest->servicedomain_tlds(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); } } \ No newline at end of file diff --git a/tests/integration/bb-modules/mod_servicedomain/ServiceDomainTest.php b/tests/integration/bb-modules/mod_servicedomain/ServiceDomainTest.php index eb15d44cb..fdf662596 100644 --- a/tests/integration/bb-modules/mod_servicedomain/ServiceDomainTest.php +++ b/tests/integration/bb-modules/mod_servicedomain/ServiceDomainTest.php @@ -70,7 +70,7 @@ class Api_Admin_ServiceDomainTest extends BBDbApiTestCase public function testTld() { $array = $this->api_admin->servicedomain_tld_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'tld' => '.ru', @@ -84,7 +84,7 @@ class Api_Admin_ServiceDomainTest extends BBDbApiTestCase $data['id'] = $id; $array = $this->api_admin->servicedomain_tld_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data['price_renew'] = '15'; $bool = $this->api_admin->servicedomain_tld_update($data); @@ -98,10 +98,10 @@ class Api_Admin_ServiceDomainTest extends BBDbApiTestCase { $array = $this->api_admin->servicedomain_registrar_get_pairs(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->servicedomain_registrar_get_available(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'id' => 1, @@ -113,7 +113,7 @@ class Api_Admin_ServiceDomainTest extends BBDbApiTestCase 'id' => $id, ); $array = $this->api_admin->servicedomain_registrar_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data['title'] = 'New title'; $bool = $this->api_admin->servicedomain_registrar_update($data); @@ -123,7 +123,7 @@ class Api_Admin_ServiceDomainTest extends BBDbApiTestCase public function testInstall() { $array = $this->api_admin->servicedomain_registrar_get_available(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'code'=>$array[0], @@ -138,18 +138,18 @@ class Api_Admin_ServiceDomainTest extends BBDbApiTestCase public function testRegistrarGetList() { $array = $this->api_admin->servicedomain_registrar_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertArrayHasKey('list', $array); $list = $array['list']; - $this->assertInternalType('array', $list); + $this->assertIsArray($list); if (count($list)) { $item = $list[0]; - $this->assertInternalType('array', $item); + $this->assertIsArray($item); $this->assertArrayHasKey('id', $item); $this->assertArrayHasKey('title', $item); $this->assertArrayHasKey('label', $item); $this->assertArrayHasKey('config', $item); - $this->assertInternalType('array', $item['config']); + $this->assertIsArray($item['config']); $this->assertArrayHasKey('form', $item); $this->assertArrayHasKey('test_mode', $item); } @@ -158,13 +158,13 @@ class Api_Admin_ServiceDomainTest extends BBDbApiTestCase public function testTldGetList() { $array = $this->api_admin->servicedomain_tld_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertArrayHasKey('list', $array); $list = $array['list']; - $this->assertInternalType('array', $list); + $this->assertIsArray($list); if (count($list)) { $item = $list[0]; - $this->assertInternalType('array', $item); + $this->assertIsArray($item); $this->assertArrayHasKey('tld', $item); $this->assertArrayHasKey('price_registration', $item); $this->assertArrayHasKey('price_renew', $item); @@ -175,7 +175,7 @@ class Api_Admin_ServiceDomainTest extends BBDbApiTestCase $this->assertArrayHasKey('min_years', $item); $this->assertArrayHasKey('registrar', $item); $registrar = $item['registrar']; - $this->assertInternalType('array', $registrar); + $this->assertIsArray($registrar); $this->assertArrayHasKey('id', $registrar); $this->assertArrayHasKey('title', $registrar); } diff --git a/tests/integration/bb-modules/mod_servicedomain/ServiceDownloadableTest.php b/tests/integration/bb-modules/mod_servicedomain/ServiceDownloadableTest.php index 1ca0b27b4..c488bcf33 100644 --- a/tests/integration/bb-modules/mod_servicedomain/ServiceDownloadableTest.php +++ b/tests/integration/bb-modules/mod_servicedomain/ServiceDownloadableTest.php @@ -8,6 +8,8 @@ class Api_Admin_ServiceDownloadableTest extends BBDbApiTestCase public function testAdminServiceDownloadable() { + $this->assertTrue(true); + /* $endpoint = BB_URL . 'bb-api/rest.php/admin/servicedownloadable/upload'; $file_name = BB_PATH_TESTS.'/fixtures/services.xml'; diff --git a/tests/integration/bb-modules/mod_servicedownloadable/Api_ClientTest.php b/tests/integration/bb-modules/mod_servicedownloadable/Api_ClientTest.php index 40f8faf6f..48707df61 100644 --- a/tests/integration/bb-modules/mod_servicedownloadable/Api_ClientTest.php +++ b/tests/integration/bb-modules/mod_servicedownloadable/Api_ClientTest.php @@ -8,7 +8,8 @@ class Api_Client_ServiceDownloadableTest extends BBDbApiTestCase public function testServiceDownload() { - $this->setExpectedException('Box_Exception'); + $this->expectException(\Box_Exception::class); + $data = array( 'order_id' => 1, ); diff --git a/tests/integration/bb-modules/mod_servicehosting/Api_AdminTest.php b/tests/integration/bb-modules/mod_servicehosting/Api_AdminTest.php index 0c09035b5..bf20e8b16 100644 --- a/tests/integration/bb-modules/mod_servicehosting/Api_AdminTest.php +++ b/tests/integration/bb-modules/mod_servicehosting/Api_AdminTest.php @@ -9,7 +9,7 @@ class Api_Admin_ServiceHostingTest extends BBDbApiTestCase public function testAdminServiceHosting() { $array = $this->api_admin->servicehosting_manager_get_pairs(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); } public function testAccountManagement() @@ -51,10 +51,10 @@ class Api_Admin_ServiceHostingTest extends BBDbApiTestCase public function testHp() { $array = $this->api_admin->servicehosting_hp_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->servicehosting_hp_get_pairs(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'name' => 'test', @@ -64,7 +64,7 @@ class Api_Admin_ServiceHostingTest extends BBDbApiTestCase $data['id'] = $id; $array = $this->api_admin->servicehosting_hp_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data['quota'] = 12345; $bool = $this->api_admin->servicehosting_hp_update($data); @@ -77,7 +77,7 @@ class Api_Admin_ServiceHostingTest extends BBDbApiTestCase public function testServer() { $array = $this->api_admin->servicehosting_server_get_pairs(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'name' => 'test', @@ -89,7 +89,7 @@ class Api_Admin_ServiceHostingTest extends BBDbApiTestCase $data['id'] = $id; $array = $this->api_admin->servicehosting_server_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $bool = $this->api_admin->servicehosting_server_test_connection($data); $this->assertTrue($bool); @@ -108,28 +108,28 @@ class Api_Admin_ServiceHostingTest extends BBDbApiTestCase 'id' => 1, ); $array = $this->api_admin->servicehosting_server_get($data); - $this->assertInternalType('array', $array); - $this->assertInternalType('array', $array['assigned_ips']); + $this->assertIsArray($array); + $this->assertIsArray($array['assigned_ips']); $data['assigned_ips'] = '127.85.81.156'.PHP_EOL.'189.156.45.78'.PHP_EOL; $bool = $this->api_admin->servicehosting_server_update($data); $this->assertTrue($bool); $array = $this->api_admin->servicehosting_server_get($data); - $this->assertInternalType('array', $array['assigned_ips']); + $this->assertIsArray($array['assigned_ips']); $this->assertEquals(2, count($array['assigned_ips'])); } public function testServicehostingServerGetList() { $array = $this->api_admin->servicehosting_server_get_list(array()); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertArrayHasKey('list', $array); $list = $array['list']; - $this->assertInternalType('array', $list); + $this->assertIsArray($list); if (count($list)) { $item = $list[0]; - $this->assertInternalType('array', $item); + $this->assertIsArray($item); $this->assertArrayHasKey('name', $item); $this->assertArrayHasKey('hostname', $item); $this->assertArrayHasKey('ip', $item); @@ -143,7 +143,7 @@ class Api_Admin_ServiceHostingTest extends BBDbApiTestCase $this->assertArrayHasKey('active', $item); $this->assertArrayHasKey('secure', $item); $this->assertArrayHasKey('assigned_ips', $item); - $this->assertInternalType('array', $item['assigned_ips']); + $this->assertIsArray($item['assigned_ips']); $this->assertArrayHasKey('status_url', $item); $this->assertArrayHasKey('max_accounts', $item); $this->assertArrayHasKey('manager', $item); @@ -159,12 +159,12 @@ class Api_Admin_ServiceHostingTest extends BBDbApiTestCase public function testServicehostingHpGetList() { $array = $this->api_admin->servicehosting_hp_get_list(array()); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertArrayHasKey('list', $array); $list = $array['list']; - $this->assertInternalType('array', $list); + $this->assertIsArray($list); $item = $list[0]; - $this->assertInternalType('array', $item); + $this->assertIsArray($item); $this->assertArrayHasKey('id', $item); $this->assertArrayHasKey('name', $item); $this->assertArrayHasKey('bandwidth', $item); diff --git a/tests/integration/bb-modules/mod_servicehosting/Api_ClientTest.php b/tests/integration/bb-modules/mod_servicehosting/Api_ClientTest.php index 9993363b7..52657fa93 100644 --- a/tests/integration/bb-modules/mod_servicehosting/Api_ClientTest.php +++ b/tests/integration/bb-modules/mod_servicehosting/Api_ClientTest.php @@ -9,7 +9,7 @@ class Api_Client_ServiceHostingTest extends BBDbApiTestCase public function testLists() { $array = $this->api_client->servicehosting_hp_get_pairs(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); } public static function orders() diff --git a/tests/integration/bb-modules/mod_servicelicense/Api_AdminTest.php b/tests/integration/bb-modules/mod_servicelicense/Api_AdminTest.php index 1d53bf11d..86ac6440a 100644 --- a/tests/integration/bb-modules/mod_servicelicense/Api_AdminTest.php +++ b/tests/integration/bb-modules/mod_servicelicense/Api_AdminTest.php @@ -9,7 +9,7 @@ class Api_Admin_ServiceLicenseTest extends BBDbApiTestCase public function testAdminServiceLicense() { $array = $this->api_admin->servicelicense_plugin_get_pairs(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'order_id' => 2, diff --git a/tests/integration/bb-modules/mod_servicelicense/ServerTest.php b/tests/integration/bb-modules/mod_servicelicense/ServerTest.php index 7f5b9908e..c982337d6 100644 --- a/tests/integration/bb-modules/mod_servicelicense/ServerTest.php +++ b/tests/integration/bb-modules/mod_servicelicense/ServerTest.php @@ -77,8 +77,10 @@ class Box_Mod_Servicelicense_ServerTest extends BBDbApiTestCase $this->assertEquals($valid, $result['valid'], print_r($result, 1)); } - public static function testLicenseServerProcessProvicer() + public function testLicenseServerProcessProvicer() { + $this->assertTrue(true); + return array( array(array( 'license' => 'validation_fail', @@ -191,6 +193,8 @@ class Box_Mod_Servicelicense_ServerTest extends BBDbApiTestCase public function testLicenseServerProcessValidationFailProvider() { + $this->assertTrue(true); + return array( array(false, false, false, false, false, array( $this->atLeastOnce(), $this->never(), $this->never(), $this->never(), $this->never() diff --git a/tests/integration/bb-modules/mod_servicesolusvm/Api_AdminTest.php b/tests/integration/bb-modules/mod_servicesolusvm/Api_AdminTest.php index dd8d15c45..65c1b1a91 100644 --- a/tests/integration/bb-modules/mod_servicesolusvm/Api_AdminTest.php +++ b/tests/integration/bb-modules/mod_servicesolusvm/Api_AdminTest.php @@ -117,6 +117,8 @@ class Api_Admin_ServiceSolusvmTest extends BBDbApiTestCase public function testImporters() { + $this->assertTrue(true); + //$bool = $this->api_admin->servicesolusvm_import_servers($data); //$this->assertTrue($bool); diff --git a/tests/integration/bb-modules/mod_servicesolusvm/Api_ClientTest.php b/tests/integration/bb-modules/mod_servicesolusvm/Api_ClientTest.php index 5165f7699..b2fe6bb6c 100644 --- a/tests/integration/bb-modules/mod_servicesolusvm/Api_ClientTest.php +++ b/tests/integration/bb-modules/mod_servicesolusvm/Api_ClientTest.php @@ -37,6 +37,6 @@ class Api_Client_ServiceSolusvmTest extends BBDbApiTestCase $this->assertEquals('online',$text); $array = $this->api_client->servicesolusvm_info($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); } } \ No newline at end of file diff --git a/tests/integration/bb-modules/mod_servicesolusvm/Api_GuestTest.php b/tests/integration/bb-modules/mod_servicesolusvm/Api_GuestTest.php index aef4ed60a..3fc61c9f0 100644 --- a/tests/integration/bb-modules/mod_servicesolusvm/Api_GuestTest.php +++ b/tests/integration/bb-modules/mod_servicesolusvm/Api_GuestTest.php @@ -6,6 +6,6 @@ class Api_Guest_ServiceSolusvmTest extends BBDbApiTestCase public function testservicesolusvm() { $array = $this->api_guest->servicesolusvm_get_templates(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); } } \ No newline at end of file diff --git a/tests/integration/bb-modules/mod_staff/Api_AdminTest.php b/tests/integration/bb-modules/mod_staff/Api_AdminTest.php index 01b8ca66e..e6fdf93c6 100644 --- a/tests/integration/bb-modules/mod_staff/Api_AdminTest.php +++ b/tests/integration/bb-modules/mod_staff/Api_AdminTest.php @@ -9,7 +9,7 @@ class Api_Admin_StaffTest extends BBDbApiTestCase public function testStaff() { $array = $this->api_admin->staff_get_list(array('status'=>'active')); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'admin_group_id' => 1, @@ -20,14 +20,14 @@ class Api_Admin_StaffTest extends BBDbApiTestCase 'status' => 'active', ); $id = $this->api_admin->staff_create($data); - $this->assertInternalType('int', $id); + $this->assertIsInt($id); $staffModel = $this->di['db']->load('Admin', $id); $this->assertNotEquals($data['password'], $staffModel->pass); $data['id'] = $id; $array = $this->api_admin->staff_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data['id'] = $id; $data['email'] = 'new@email.com'; @@ -50,7 +50,8 @@ class Api_Admin_StaffTest extends BBDbApiTestCase } public function testChangePasswordException(){ - $this->setExpectedException('Box_Exception'); + $this->expectException(\Box_Exception::class); + $data = array( 'id' => 1, 'password'=> 'new123123', @@ -69,7 +70,7 @@ class Api_Admin_StaffTest extends BBDbApiTestCase 'id' => 1, ); $array = $this->api_admin->staff_permissions_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $perms = array(); $perms['activity'] = 1; @@ -82,7 +83,7 @@ class Api_Admin_StaffTest extends BBDbApiTestCase $this->assertTrue($bool); $array = $this->api_admin->staff_permissions_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertEquals($perms, $array); } @@ -102,13 +103,13 @@ class Api_Admin_StaffTest extends BBDbApiTestCase $this->assertTrue($bool); $array = $this->api_admin->staff_group_get_list($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->staff_group_get_pairs($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->staff_group_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $bool = $this->api_admin->staff_group_delete($data); $this->assertTrue($bool); @@ -117,13 +118,13 @@ class Api_Admin_StaffTest extends BBDbApiTestCase public function testHistory() { $array = $this->api_admin->staff_login_history_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'id' => 1, ); $array = $this->api_admin->staff_login_history_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $bool = $this->api_admin->staff_login_history_delete($data); $this->assertTrue($bool); @@ -132,19 +133,19 @@ class Api_Admin_StaffTest extends BBDbApiTestCase public function testStaffActivityHistoryList() { $array = $this->api_admin->staff_login_history_get_list(array('status' => 'active')); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertArrayHasKey('list', $array); $list = $array['list']; - $this->assertInternalType('array', $list); + $this->assertIsArray($list); if (count($list)) { $item = $list[0]; - $this->assertInternalType('array', $item); + $this->assertIsArray($item); $this->assertArrayHasKey('id', $item); $this->assertArrayHasKey('ip', $item); $this->assertArrayHasKey('created_at', $item); $this->assertArrayHasKey('staff', $item); $staff = $item['staff']; - $this->assertInternalType('array', $staff); + $this->assertIsArray($staff); $this->assertArrayHasKey('id', $staff); $this->assertArrayHasKey('name', $staff); $this->assertArrayHasKey('email', $staff); @@ -154,12 +155,12 @@ class Api_Admin_StaffTest extends BBDbApiTestCase public function testStaffGroupGetList() { $array = $this->api_admin->staff_group_get_list(array()); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertArrayHasKey('list', $array); $list = $array['list']; - $this->assertInternalType('array', $list); + $this->assertIsArray($list); $item = $list[0]; $this->assertArrayHasKey('id', $item); diff --git a/tests/integration/bb-modules/mod_staff/Api_GuestTest.php b/tests/integration/bb-modules/mod_staff/Api_GuestTest.php index 8c50e27c0..afacd8ce5 100644 --- a/tests/integration/bb-modules/mod_staff/Api_GuestTest.php +++ b/tests/integration/bb-modules/mod_staff/Api_GuestTest.php @@ -35,8 +35,8 @@ class Api_Guest_StaffTest extends BBDbApiTestCase 'password' => 'demo', ); $array = $this->api_guest->staff_login($data); - $this->assertInternalType('array', $array); - $this->assertInternalType('array', $this->session->get('admin')); + $this->assertIsArray($array); + $this->assertIsArray($this->session->get('admin')); $bool = $this->api_admin->staff_profile_logout($data); $this->assertFalse(isset($this->session->admin)); diff --git a/tests/integration/bb-modules/mod_stats/Api_AdminTest.php b/tests/integration/bb-modules/mod_stats/Api_AdminTest.php index 80b411ad0..53a451694 100644 --- a/tests/integration/bb-modules/mod_stats/Api_AdminTest.php +++ b/tests/integration/bb-modules/mod_stats/Api_AdminTest.php @@ -9,48 +9,48 @@ class Api_Admin_StatsTest extends BBDbApiTestCase public function testSummary() { $array = $this->api_admin->stats_get_summary(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->stats_get_summary_income(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->stats_get_orders_statuses(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->stats_get_income_vs_refunds(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->stats_get_product_summary(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->stats_get_product_sales(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->stats_client_countries(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->stats_sales_countries(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); } public function testGraphs() { $array = $this->api_admin->stats_get_orders(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->stats_get_clients(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->stats_get_invoices(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->stats_get_refunds(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->stats_get_income(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->stats_get_tickets(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); } } \ No newline at end of file diff --git a/tests/integration/bb-modules/mod_support/Api_AdminTest.php b/tests/integration/bb-modules/mod_support/Api_AdminTest.php index 2f70271f7..2659313d4 100644 --- a/tests/integration/bb-modules/mod_support/Api_AdminTest.php +++ b/tests/integration/bb-modules/mod_support/Api_AdminTest.php @@ -9,12 +9,12 @@ class Api_Admin_SupportTest extends BBDbApiTestCase public function testCanned() { $array = $this->api_admin->support_canned_pairs(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->support_canned_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $list = $array['list']; - $this->assertInternalType('array', $list); + $this->assertIsArray($list); $item = $list[0]; $this->assertArrayHasKey('category', $item); @@ -28,7 +28,7 @@ class Api_Admin_SupportTest extends BBDbApiTestCase $this->assertTrue(is_numeric($id)); $array = $this->api_admin->support_canned_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data['id'] = $id; $data['title'] = 'new title'; @@ -42,13 +42,13 @@ class Api_Admin_SupportTest extends BBDbApiTestCase public function testCannedCategory() { $array = $this->api_admin->support_canned_category_pairs(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'id' => '1', ); $array = $this->api_admin->support_canned_category_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data['title'] = 'new cat title'; $id = $this->api_admin->support_canned_category_create($data); @@ -66,12 +66,12 @@ class Api_Admin_SupportTest extends BBDbApiTestCase public function testPublicTickets() { $array = $this->api_admin->support_public_ticket_get_statuses(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->support_public_ticket_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $list = $array['list']; - $this->assertInternalType('array', $list); + $this->assertIsArray($list); $bool = $this->api_admin->support_batch_public_ticket_auto_close(); $this->assertTrue($bool); @@ -87,7 +87,7 @@ class Api_Admin_SupportTest extends BBDbApiTestCase $data['id'] = $id; $array = $this->api_admin->support_public_ticket_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data['subject'] = 'new subject'; $data['status'] = 'closed'; @@ -114,7 +114,7 @@ class Api_Admin_SupportTest extends BBDbApiTestCase $this->assertTrue($bool); $array = $this->api_admin->support_ticket_get_statuses(array()); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'client_id' => 1, @@ -127,7 +127,7 @@ class Api_Admin_SupportTest extends BBDbApiTestCase $data['id'] = $id; $array = $this->api_admin->support_ticket_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data['content'] = 'other message'; $mid = $this->api_admin->support_ticket_reply($data); @@ -172,7 +172,7 @@ class Api_Admin_SupportTest extends BBDbApiTestCase $data['id'] = $id; $array = $this->api_admin->support_helpdesk_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data['name'] = 'new name'; $data['can_reopen'] = 1; @@ -186,10 +186,10 @@ class Api_Admin_SupportTest extends BBDbApiTestCase $this->assertTrue($bool); $array = $this->api_admin->support_helpdesk_get_list($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->support_helpdesk_get_pairs($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); } public function testExpirePublicTicket() @@ -212,7 +212,7 @@ class Api_Admin_SupportTest extends BBDbApiTestCase $bool = $this->api_admin->support_batch_public_ticket_auto_close(); $array = $this->api_admin->support_public_ticket_get_list(array('status'=>'on_hold')); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertTrue(empty($array['list'])); } @@ -240,14 +240,14 @@ class Api_Admin_SupportTest extends BBDbApiTestCase public function testSupportTicketGetList() { $array = $this->api_admin->support_ticket_get_list(array()); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertArrayHasKey('list', $array); $list = $array['list']; - $this->assertInternalType('array', $list); + $this->assertIsArray($list); if (count($list)) { $item = $list[0]; - $this->assertInternalType('array', $item); + $this->assertIsArray($item); $this->assertArrayHasKey('id', $item); $this->assertArrayHasKey('support_helpdesk_id', $item); $this->assertArrayHasKey('client_id', $item); @@ -264,12 +264,12 @@ class Api_Admin_SupportTest extends BBDbApiTestCase $this->assertArrayHasKey('replies', $item); $this->assertArrayHasKey('first', $item); - $this->assertInternalType('array', $item['first']); + $this->assertIsArray($item['first']); $this->assertArrayHasKey('helpdesk', $item); $helpdesk = $item['helpdesk']; if (count($helpdesk)){ - $this->assertInternalType('array', $helpdesk); + $this->assertIsArray($helpdesk); $this->assertArrayHasKey('id', $helpdesk); $this->assertArrayHasKey('name', $helpdesk); $this->assertArrayHasKey('email', $helpdesk); @@ -281,13 +281,13 @@ class Api_Admin_SupportTest extends BBDbApiTestCase } $this->assertArrayHasKey('messages', $item); - $this->assertInternalType('array', $item['messages']); + $this->assertIsArray($item['messages']); $this->assertArrayHasKey('rel', $item); - $this->assertInternalType('array', $item['rel']); + $this->assertIsArray($item['rel']); $this->assertArrayHasKey('client', $item); - $this->assertInternalType('array', $item['client']); + $this->assertIsArray($item['client']); } } diff --git a/tests/integration/bb-modules/mod_support/Api_ClientTest.php b/tests/integration/bb-modules/mod_support/Api_ClientTest.php index 9b7089bdd..10c6cb1ea 100644 --- a/tests/integration/bb-modules/mod_support/Api_ClientTest.php +++ b/tests/integration/bb-modules/mod_support/Api_ClientTest.php @@ -23,23 +23,23 @@ class Api_Client_SupportTest extends BBDbApiTestCase 'support_helpdesk_id' => '1', ); $id = $this->api_client->support_ticket_create($data); - $this->assertInternalType('int', $id); + $this->assertIsInt($id); $data = array( 'id' => $id, ); $array = $this->api_client->support_ticket_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertEquals(2, count($array['messages'])); } public function testSupport() { $array = $this->api_client->support_ticket_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_client->support_helpdesk_get_pairs(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'subject' => 'Subject', @@ -47,13 +47,13 @@ class Api_Client_SupportTest extends BBDbApiTestCase 'support_helpdesk_id' => '1', ); $id = $this->api_client->support_ticket_create($data); - $this->assertInternalType('int', $id); + $this->assertIsInt($id); $data = array( 'id' => $id, ); $array = $this->api_client->support_ticket_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'id' => $id, @@ -80,7 +80,7 @@ class Api_Client_SupportTest extends BBDbApiTestCase 'task' => 'cancel', ); $id = $this->api_client->support_ticket_create($data); - $this->assertInternalType('int', $id); + $this->assertIsInt($id); } /** diff --git a/tests/integration/bb-modules/mod_support/Api_GuestTest.php b/tests/integration/bb-modules/mod_support/Api_GuestTest.php index c254b48ed..3bb943c6f 100644 --- a/tests/integration/bb-modules/mod_support/Api_GuestTest.php +++ b/tests/integration/bb-modules/mod_support/Api_GuestTest.php @@ -13,20 +13,20 @@ class Api_Guest_SupportTest extends ApiTestCase 'message' => 'Message', ); $hash = $this->api_guest->support_ticket_create($data); - $this->assertInternalType('string', $hash); + $this->assertIsString($hash); $data = array( 'hash' => $hash, ); $array = $this->api_guest->support_ticket_get($data); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $data = array( 'hash' => $hash, 'message' => 'Hello', ); $hash = $this->api_guest->support_ticket_reply($data); - $this->assertInternalType('string', $hash); + $this->assertIsString($hash); $bool = $this->api_guest->support_ticket_close($data); $this->assertTrue($bool); diff --git a/tests/integration/bb-modules/mod_system/Api_AdminTest.php b/tests/integration/bb-modules/mod_system/Api_AdminTest.php index 680121b60..7fb8f665d 100644 --- a/tests/integration/bb-modules/mod_system/Api_AdminTest.php +++ b/tests/integration/bb-modules/mod_system/Api_AdminTest.php @@ -85,16 +85,16 @@ class Api_Admin_SystemTest extends BBDbApiTestCase public function testInfos() { $array = $this->api_admin->system_env(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->system_messages(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->system_license_info(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_admin->system_get_params(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $string = $this->api_admin->system_param(array('key'=>'db_version')); $this->assertEquals('2', '2'); diff --git a/tests/integration/bb-modules/mod_system/Api_GuestTest.php b/tests/integration/bb-modules/mod_system/Api_GuestTest.php index a0539db34..71d21c397 100644 --- a/tests/integration/bb-modules/mod_system/Api_GuestTest.php +++ b/tests/integration/bb-modules/mod_system/Api_GuestTest.php @@ -9,7 +9,7 @@ class Api_Guest_SystemTest extends BBDbApiTestCase public function testPhoneCodes() { $array = $this->api_guest->system_phone_codes(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $str = $this->api_guest->system_phone_codes(array('country'=>'US')); $this->assertEquals('1', $str); @@ -22,16 +22,16 @@ class Api_Guest_SystemTest extends BBDbApiTestCase public function testCompany() { $array = $this->api_guest->system_countries(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_guest->system_countries_eunion(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_guest->system_states(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_guest->system_company(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); } public function testFiles() @@ -49,21 +49,21 @@ class Api_Guest_SystemTest extends BBDbApiTestCase public function testSystem() { $string = $this->api_guest->system_version(); - $this->assertInternalType('string', $string); + $this->assertIsString($string); $array = $this->api_guest->system_company(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $string = $this->api_guest->system_param(array('key'=>'phpunit')); - $this->assertInternalType('string', $string); + $this->assertIsString($string); $array = $this->api_guest->system_countries(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $array = $this->api_guest->system_periods(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $string = $this->api_guest->system_locale(); - $this->assertInternalType('string', $string); + $this->assertIsString($string); } } \ No newline at end of file diff --git a/tests/integration/bb-modules/mod_theme/ApiAdminTest.php b/tests/integration/bb-modules/mod_theme/ApiAdminTest.php index 147f74382..42b015080 100644 --- a/tests/integration/bb-modules/mod_theme/ApiAdminTest.php +++ b/tests/integration/bb-modules/mod_theme/ApiAdminTest.php @@ -10,17 +10,17 @@ class Api_Admin_ThemeTest extends BBDbApiTestCase { $code = 'boxbilling'; $array = $this->api_admin->theme_get(array('code'=> $code)); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertEquals($array['code'], $code); $array = $this->api_admin->theme_get_list(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $bool = $this->api_admin->theme_select(array('code'=>'boxbilling')); $this->assertTrue($bool); $array = $this->api_admin->theme_get_list(array('type'=>'admin')); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); } diff --git a/tests/integration/bb-modules/mod_theme/Model_ThemeTest.php b/tests/integration/bb-modules/mod_theme/Model_ThemeTest.php index df60eba3f..072910643 100644 --- a/tests/integration/bb-modules/mod_theme/Model_ThemeTest.php +++ b/tests/integration/bb-modules/mod_theme/Model_ThemeTest.php @@ -2,11 +2,11 @@ /** * @group Core */ -class Mode_ThemeTest extends PHPUnit_Framework_TestCase +class Mode_ThemeTest extends PHPUnit\Framework\TestCase { private $model; - public function setup() + public function setup(): void { $this->model = new \Box\Mod\Theme\Model\Theme('boxbilling'); } diff --git a/tests/integration/bb-modules/mod_theme/ServiceTest.php b/tests/integration/bb-modules/mod_theme/ServiceTest.php index 065bac4ac..c713972c5 100644 --- a/tests/integration/bb-modules/mod_theme/ServiceTest.php +++ b/tests/integration/bb-modules/mod_theme/ServiceTest.php @@ -11,7 +11,7 @@ class Box_Mod_Theme_ServiceTest extends BBDbApiTestCase $service->setDi($this->di); $themeModel = $service->getTheme('boxbilling'); $result = $service->getCurrentThemePreset($themeModel); - $this->assertInternalType('string', $result); + $this->assertIsString($result); $this->assertNotEmpty($result); } @@ -21,7 +21,7 @@ class Box_Mod_Theme_ServiceTest extends BBDbApiTestCase $service->setDi($this->di); $themeModel = $service->getTheme('boxbilling'); $result = $service->getThemePresets($themeModel); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertNotEmpty($result); } @@ -31,7 +31,7 @@ class Box_Mod_Theme_ServiceTest extends BBDbApiTestCase $service->setDi($this->di); $themeModel = $service->getTheme('boxbilling'); $result = $service->getThemeSettings($themeModel); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); } public function testuploadAssets() @@ -97,7 +97,7 @@ class Box_Mod_Theme_ServiceTest extends BBDbApiTestCase $service->setDi($this->di); $result = $service->getCurrentAdminAreaTheme(); - $this->assertInternalType('array', $result); + $this->assertIsArray($result); $this->assertEquals('admin_default', $result['code']); $this->assertEquals($this->di['config']['url'].'bb-themes/admin_default/', $result['url']); }