From 1102e9f1e803b22d23c8a42224cfcd343f27a511 Mon Sep 17 00:00:00 2001 From: Taras Machyshyn Date: Tue, 27 Aug 2019 14:57:31 +0300 Subject: [PATCH] Added support PHPUnit 8 --- tests/integration/Core/BaseTestCase.php | 4 +-- .../integration/Espo/Upgrade/GeneralTest.php | 10 +++---- tests/integration/Espo/User/AclTest.php | 10 +++---- tests/unit/Espo/Core/CronManagerTest.php | 4 +-- .../unit/Espo/Core/EntryPointManagerTest.php | 4 +-- .../unit/Espo/Core/Formula/EvaluatorTest.php | 6 ++-- tests/unit/Espo/Core/Formula/FormulaTest.php | 6 ++-- tests/unit/Espo/Core/Formula/ParserTest.php | 6 ++-- tests/unit/Espo/Core/HookManagerTest.php | 6 ++-- .../unit/Espo/Core/Htmlizer/HtmlizerTest.php | 5 ++-- .../Espo/Core/Mail/FiltersMatcherTest.php | 4 +-- tests/unit/Espo/Core/Mail/ImporterTest.php | 30 ++++++++++++------- .../Espo/Core/SelectManagers/BaseTest.php | 4 +-- .../Espo/Core/Upgrades/ActionManagerTest.php | 4 +-- .../Espo/Core/Upgrades/Actions/BaseTest.php | 4 +-- tests/unit/Espo/Core/Utils/ConfigTest.php | 4 +-- .../Espo/Core/Utils/Database/HelperTest.php | 4 +-- .../unit/Espo/Core/Utils/FieldManagerTest.php | 6 ++-- .../Espo/Core/Utils/File/ClassParserTest.php | 4 +-- .../unit/Espo/Core/Utils/File/ManagerTest.php | 6 ++-- .../Espo/Core/Utils/File/PermissionTest.php | 4 +-- tests/unit/Espo/Core/Utils/JsonTest.php | 6 ++-- tests/unit/Espo/Core/Utils/LanguageTest.php | 4 +-- tests/unit/Espo/Core/Utils/LayoutTest.php | 4 +-- tests/unit/Espo/Core/Utils/MetadataTest.php | 6 ++-- .../unit/Espo/Core/Utils/PasswordHashTest.php | 4 +-- tests/unit/Espo/Core/Utils/RouteTest.php | 6 ++-- .../unit/Espo/Core/Utils/ScheduledJobTest.php | 4 +-- tests/unit/Espo/Core/Utils/SystemTest.php | 6 ++-- tests/unit/Espo/Entities/EmailTest.php | 4 +-- tests/unit/Espo/ORM/DB/MapperTest.php | 4 +-- tests/unit/Espo/ORM/DB/QueryTest.php | 4 +-- tests/unit/Espo/ORM/EntityTest.php | 4 +-- tests/unit/Espo/Services/ImportTest.php | 5 ++-- 34 files changed, 100 insertions(+), 96 deletions(-) diff --git a/tests/integration/Core/BaseTestCase.php b/tests/integration/Core/BaseTestCase.php index 953ddb3ac9..d9e58b609b 100644 --- a/tests/integration/Core/BaseTestCase.php +++ b/tests/integration/Core/BaseTestCase.php @@ -114,7 +114,7 @@ abstract class BaseTestCase extends \PHPUnit\Framework\TestCase return $this->espoTester->sendRequest($method, $action, $data); } - protected function setUp() + protected function setUp() : void { $this->beforeSetUp(); @@ -134,7 +134,7 @@ abstract class BaseTestCase extends \PHPUnit\Framework\TestCase $this->afterStartApplication(); } - protected function tearDown() + protected function tearDown() : void { $this->espoTester->terminate(); $this->espoTester = NULL; diff --git a/tests/integration/Espo/Upgrade/GeneralTest.php b/tests/integration/Espo/Upgrade/GeneralTest.php index c390fa630d..dff38124ef 100644 --- a/tests/integration/Espo/Upgrade/GeneralTest.php +++ b/tests/integration/Espo/Upgrade/GeneralTest.php @@ -73,22 +73,20 @@ class GeneralTest extends \tests\integration\Core\BaseTestCase return $upgradeId; } - /** - * @expectedException \Espo\Core\Exceptions\Error - */ public function testUninstall() { + $this->expectException('\\Espo\\Core\\Exceptions\\Error'); + $upgradeId = $this->testInstall(); $upgradeManager = new \Espo\Core\UpgradeManager($this->getContainer()); $upgradeManager->uninstall(array('id' => $upgradeId)); } - /** - * @expectedException \Espo\Core\Exceptions\Error - */ public function testDelete() { + $this->expectException('\\Espo\\Core\\Exceptions\\Error'); + $upgradeId = $this->testInstall(); $upgradeManager = new \Espo\Core\UpgradeManager($this->getContainer()); diff --git a/tests/integration/Espo/User/AclTest.php b/tests/integration/Espo/User/AclTest.php index 4a951dfdf0..c7d9cc6d8e 100644 --- a/tests/integration/Espo/User/AclTest.php +++ b/tests/integration/Espo/User/AclTest.php @@ -45,11 +45,10 @@ class AclTest extends \tests\integration\Core\BaseTestCase $metadata->save(); } - /** - * @expectedException \Espo\Core\Exceptions\Forbidden - */ public function testUserAccess() { + $this->expectException('\\Espo\\Core\\Exceptions\\Forbidden'); + $this->createUser('tester', array( 'assignmentPermission' => 'team', 'userPermission' => 'team', @@ -86,11 +85,10 @@ class AclTest extends \tests\integration\Core\BaseTestCase $result = $controllerManager->process('Account', 'create', $params, $data, $request); } - /** - * @expectedException \Espo\Core\Exceptions\Forbidden - */ public function testPortalUserAccess() { + $this->expectException('\\Espo\\Core\\Exceptions\\Forbidden'); + $newUser = $this->createUser(array( 'userName' => 'tester', 'lastName' => 'tester', diff --git a/tests/unit/Espo/Core/CronManagerTest.php b/tests/unit/Espo/Core/CronManagerTest.php index 910bb74df8..18fc9ff4af 100644 --- a/tests/unit/Espo/Core/CronManagerTest.php +++ b/tests/unit/Espo/Core/CronManagerTest.php @@ -39,7 +39,7 @@ class CronManagerTest extends \PHPUnit\Framework\TestCase protected $filesPath= 'tests/unit/testData/EntryPoints'; - protected function setUp() + protected function setUp() : void { $this->objects['container'] = $this->getMockBuilder('\\Espo\\Core\\Container')->disableOriginalConstructor()->getMock(); @@ -67,7 +67,7 @@ class CronManagerTest extends \PHPUnit\Framework\TestCase $this->reflection = new ReflectionHelper($this->object); } - protected function tearDown() + protected function tearDown() : void { $this->object = NULL; } diff --git a/tests/unit/Espo/Core/EntryPointManagerTest.php b/tests/unit/Espo/Core/EntryPointManagerTest.php index 6fd4e62bbe..29c4d926b3 100644 --- a/tests/unit/Espo/Core/EntryPointManagerTest.php +++ b/tests/unit/Espo/Core/EntryPointManagerTest.php @@ -40,7 +40,7 @@ class EntryPointManagerTest extends \PHPUnit\Framework\TestCase protected $filesPath= 'tests/unit/testData/EntryPoints'; - protected function setUp() + protected function setUp() : void { $this->objects['container'] = $this->getMockBuilder('\\Espo\\Core\\Container')->disableOriginalConstructor()->getMock(); @@ -58,7 +58,7 @@ class EntryPointManagerTest extends \PHPUnit\Framework\TestCase )); } - protected function tearDown() + protected function tearDown() : void { $this->object = NULL; } diff --git a/tests/unit/Espo/Core/Formula/EvaluatorTest.php b/tests/unit/Espo/Core/Formula/EvaluatorTest.php index 589a7428dd..737409394e 100644 --- a/tests/unit/Espo/Core/Formula/EvaluatorTest.php +++ b/tests/unit/Espo/Core/Formula/EvaluatorTest.php @@ -33,12 +33,12 @@ use \Espo\ORM\Entity; class EvaluatorTest extends \PHPUnit\Framework\TestCase { - protected function setUp() + protected function setUp() : void { $this->evaluator = new \Espo\Core\Formula\Evaluator(); } - protected function tearDown() + protected function tearDown() : void { $this->evaluator = null; } @@ -102,4 +102,4 @@ class EvaluatorTest extends \PHPUnit\Framework\TestCase $actual = $this->evaluator->process($expression); $this->assertEquals(2.5, $actual); } -} \ No newline at end of file +} diff --git a/tests/unit/Espo/Core/Formula/FormulaTest.php b/tests/unit/Espo/Core/Formula/FormulaTest.php index 794c3da2fc..be454fca6f 100644 --- a/tests/unit/Espo/Core/Formula/FormulaTest.php +++ b/tests/unit/Espo/Core/Formula/FormulaTest.php @@ -34,7 +34,7 @@ use \Espo\ORM\Entity; class FormulaTest extends \PHPUnit\Framework\TestCase { - protected function setUp() + protected function setUp() : void { $container = $this->container = $this->getMockBuilder('\\Espo\\Core\\Container')->disableOriginalConstructor()->getMock(); @@ -77,7 +77,7 @@ class FormulaTest extends \PHPUnit\Framework\TestCase ])); } - protected function tearDown() + protected function tearDown() : void { $this->container = null; $this->functionFactory = null; @@ -2862,4 +2862,4 @@ class FormulaTest extends \PHPUnit\Framework\TestCase $this->assertEquals(5, $variables->counter); $this->assertEquals('hello', $variables->test); } -} \ No newline at end of file +} diff --git a/tests/unit/Espo/Core/Formula/ParserTest.php b/tests/unit/Espo/Core/Formula/ParserTest.php index 5ff996103a..de0586d978 100644 --- a/tests/unit/Espo/Core/Formula/ParserTest.php +++ b/tests/unit/Espo/Core/Formula/ParserTest.php @@ -33,12 +33,12 @@ use \Espo\ORM\Entity; class ParserTest extends \PHPUnit\Framework\TestCase { - protected function setUp() + protected function setUp() : void { $this->parser = new \Espo\Core\Formula\Parser(); } - protected function tearDown() + protected function tearDown() : void { $this->parser = null; } @@ -784,4 +784,4 @@ class ParserTest extends \PHPUnit\Framework\TestCase ]; $this->assertEquals($expected, $actual); } -} \ No newline at end of file +} diff --git a/tests/unit/Espo/Core/HookManagerTest.php b/tests/unit/Espo/Core/HookManagerTest.php index 435b9e75e7..09b27da4f7 100644 --- a/tests/unit/Espo/Core/HookManagerTest.php +++ b/tests/unit/Espo/Core/HookManagerTest.php @@ -39,7 +39,7 @@ class HookManagerTest extends \PHPUnit\Framework\TestCase protected $filesPath = 'tests/unit/testData/Hooks'; - protected function setUp() + protected function setUp() : void { $this->objects['container'] = $this->getMockBuilder('\\Espo\\Core\\Container')->disableOriginalConstructor()->getMock(); @@ -62,7 +62,7 @@ class HookManagerTest extends \PHPUnit\Framework\TestCase $this->reflection = new ReflectionHelper($this->object); } - protected function tearDown() + protected function tearDown() : void { $this->object = NULL; $this->reflection = NULL; @@ -437,4 +437,4 @@ class HookManagerTest extends \PHPUnit\Framework\TestCase '\\Espo\\Hooks\\Note\\Notifications', ); } -} \ No newline at end of file +} diff --git a/tests/unit/Espo/Core/Htmlizer/HtmlizerTest.php b/tests/unit/Espo/Core/Htmlizer/HtmlizerTest.php index eec18cfd60..3e4c1aeba9 100644 --- a/tests/unit/Espo/Core/Htmlizer/HtmlizerTest.php +++ b/tests/unit/Espo/Core/Htmlizer/HtmlizerTest.php @@ -41,7 +41,7 @@ class HtmlizerTest extends \PHPUnit\Framework\TestCase protected $number; - protected function setUp() + protected function setUp() : void { date_default_timezone_set('UTC'); @@ -77,7 +77,7 @@ class HtmlizerTest extends \PHPUnit\Framework\TestCase $this->htmlizer = new \Espo\Core\Htmlizer\Htmlizer($this->fileManager, $this->dateTime, $this->number); } - protected function tearDown() + protected function tearDown() : void { unset($this->htmlizer); unset($this->fileManager); @@ -170,4 +170,3 @@ class HtmlizerTest extends \PHPUnit\Framework\TestCase $this->assertEquals('test', $html); } } - diff --git a/tests/unit/Espo/Core/Mail/FiltersMatcherTest.php b/tests/unit/Espo/Core/Mail/FiltersMatcherTest.php index 44d6c36abc..e42da8113e 100644 --- a/tests/unit/Espo/Core/Mail/FiltersMatcherTest.php +++ b/tests/unit/Espo/Core/Mail/FiltersMatcherTest.php @@ -35,7 +35,7 @@ class FiltersMatcherTest extends \PHPUnit\Framework\TestCase { protected $object; - protected function setUp() + protected function setUp() : void { $this->object = new \Espo\Core\Mail\FiltersMatcher(); @@ -80,7 +80,7 @@ class FiltersMatcherTest extends \PHPUnit\Framework\TestCase ); } - protected function tearDown() + protected function tearDown() : void { $this->object = NULL; } diff --git a/tests/unit/Espo/Core/Mail/ImporterTest.php b/tests/unit/Espo/Core/Mail/ImporterTest.php index 047a446a1f..ca008f53c4 100644 --- a/tests/unit/Espo/Core/Mail/ImporterTest.php +++ b/tests/unit/Espo/Core/Mail/ImporterTest.php @@ -34,7 +34,7 @@ use \Espo\Entities\Email; class ImporterTest extends \PHPUnit\Framework\TestCase { - function setUp() + function setUp() : void { $GLOBALS['log'] = $this->getMockBuilder('\\Espo\\Core\\Utils\\Log')->disableOriginalConstructor()->getMock(); @@ -126,13 +126,18 @@ class ImporterTest extends \PHPUnit\Framework\TestCase $this->assertEquals('test 3', $email->get('name')); $teamIdList = $email->getLinkMultipleIdList('teams'); - $this->assertContains('teamTestId', $teamIdList); + $this->assertTrue(in_array('teamTestId', $teamIdList)); $userIdList = $email->getLinkMultipleIdList('users'); - $this->assertContains('userTestId', $userIdList); + $this->assertTrue(in_array('userTestId', $userIdList)); - $this->assertContains('
Admin Test', $email->get('body')); - $this->assertContains('Admin Test', $email->get('bodyPlain')); + if (method_exists($this, 'assertStringContainsString')) { /* PHPUnit 7+ */ + $this->assertStringContainsString('
Admin Test', $email->get('body')); + $this->assertStringContainsString('Admin Test', $email->get('bodyPlain')); + } else { /* PHPUnit 6 */ + $this->assertContains('
Admin Test', $email->get('body')); + $this->assertContains('Admin Test', $email->get('bodyPlain')); + } $this->assertEquals('', $email->get('messageId')); } @@ -182,14 +187,19 @@ class ImporterTest extends \PHPUnit\Framework\TestCase $this->assertEquals('test 3', $email->get('name')); $teamIdList = $email->getLinkMultipleIdList('teams'); - $this->assertContains('teamTestId', $teamIdList); + $this->assertTrue(in_array('teamTestId', $teamIdList)); $userIdList = $email->getLinkMultipleIdList('users'); - $this->assertContains('userTestId', $userIdList); + $this->assertTrue(in_array('userTestId', $userIdList)); - $this->assertContains('
Admin Test', $email->get('body')); - $this->assertContains('Admin Test', $email->get('bodyPlain')); + if (method_exists($this, 'assertStringContainsString')) { /* PHPUnit 7+ */ + $this->assertStringContainsString('
Admin Test', $email->get('body')); + $this->assertStringContainsString('Admin Test', $email->get('bodyPlain')); + } else { /* PHPUnit 6 */ + $this->assertContains('
Admin Test', $email->get('body')); + $this->assertContains('Admin Test', $email->get('bodyPlain')); + } $this->assertEquals('', $email->get('messageId')); } -} \ No newline at end of file +} diff --git a/tests/unit/Espo/Core/SelectManagers/BaseTest.php b/tests/unit/Espo/Core/SelectManagers/BaseTest.php index 97ab0c3e32..c2155a3b00 100644 --- a/tests/unit/Espo/Core/SelectManagers/BaseTest.php +++ b/tests/unit/Espo/Core/SelectManagers/BaseTest.php @@ -33,7 +33,7 @@ use \tests\unit\testData\Entities\Test2; class BaseTest extends \PHPUnit\Framework\TestCase { - protected function setUp() + protected function setUp() : void { $entity = $this->entity = new Test2(); @@ -74,7 +74,7 @@ class BaseTest extends \PHPUnit\Framework\TestCase $this->user->id = 'test_id'; } - protected function tearDown() + protected function tearDown() : void { unset($this->entity); unset($this->acl); diff --git a/tests/unit/Espo/Core/Upgrades/ActionManagerTest.php b/tests/unit/Espo/Core/Upgrades/ActionManagerTest.php index 52be3cfe8d..761461dca5 100644 --- a/tests/unit/Espo/Core/Upgrades/ActionManagerTest.php +++ b/tests/unit/Espo/Core/Upgrades/ActionManagerTest.php @@ -54,7 +54,7 @@ class ActionManagerTest extends \PHPUnit\Framework\TestCase ), ); - protected function setUp() + protected function setUp() : void { $this->objects['container'] = $this->getMockBuilder('\Espo\Core\Container')->disableOriginalConstructor()->getMock(); @@ -63,7 +63,7 @@ class ActionManagerTest extends \PHPUnit\Framework\TestCase $this->reflection = new ReflectionHelper($this->object); } - protected function tearDown() + protected function tearDown() : void { $this->object = NULL; } diff --git a/tests/unit/Espo/Core/Upgrades/Actions/BaseTest.php b/tests/unit/Espo/Core/Upgrades/Actions/BaseTest.php index 7b606ff3ae..b17aa5cf38 100644 --- a/tests/unit/Espo/Core/Upgrades/Actions/BaseTest.php +++ b/tests/unit/Espo/Core/Upgrades/Actions/BaseTest.php @@ -56,7 +56,7 @@ class BaseTest extends \PHPUnit\Framework\TestCase protected $currentVersion = '11.5.2'; - protected function setUp() + protected function setUp() : void { $this->objects['container'] = $this->getMockBuilder('\Espo\Core\Container')->disableOriginalConstructor()->getMock(); $this->objects['actionManager'] = $this->getMockBuilder('\Espo\Core\Upgrades\ActionManager')->disableOriginalConstructor()->getMock(); @@ -98,7 +98,7 @@ class BaseTest extends \PHPUnit\Framework\TestCase /* END */ } - protected function tearDown() + protected function tearDown() : void { $this->object = NULL; diff --git a/tests/unit/Espo/Core/Utils/ConfigTest.php b/tests/unit/Espo/Core/Utils/ConfigTest.php index c3573ff583..dcbbe14324 100644 --- a/tests/unit/Espo/Core/Utils/ConfigTest.php +++ b/tests/unit/Espo/Core/Utils/ConfigTest.php @@ -43,7 +43,7 @@ class ConfigTest extends \PHPUnit\Framework\TestCase protected $systemConfigPath = 'tests/unit/testData/Utils/Config/systemConfig.php'; - protected function setUp() + protected function setUp() : void { $this->objects['fileManager'] = new \Espo\Core\Utils\File\Manager(); @@ -60,7 +60,7 @@ class ConfigTest extends \PHPUnit\Framework\TestCase $this->reflection->setProperty('systemConfigPath', $this->systemConfigPath); } - protected function tearDown() + protected function tearDown() : void { $this->object = NULL; } diff --git a/tests/unit/Espo/Core/Utils/Database/HelperTest.php b/tests/unit/Espo/Core/Utils/Database/HelperTest.php index d16e80ba35..e343553185 100644 --- a/tests/unit/Espo/Core/Utils/Database/HelperTest.php +++ b/tests/unit/Espo/Core/Utils/Database/HelperTest.php @@ -40,7 +40,7 @@ class HelperTest extends \PHPUnit\Framework\TestCase protected $reflection; - protected function setUp() + protected function setUp() : void { $this->objects['config'] = $this->getMockBuilder('\\Espo\\Core\\Utils\\Config')->disableOriginalConstructor()->getMock(); @@ -58,7 +58,7 @@ class HelperTest extends \PHPUnit\Framework\TestCase ])); } - protected function tearDown() + protected function tearDown() : void { $this->object = NULL; } diff --git a/tests/unit/Espo/Core/Utils/FieldManagerTest.php b/tests/unit/Espo/Core/Utils/FieldManagerTest.php index 2241151967..fa270ea590 100644 --- a/tests/unit/Espo/Core/Utils/FieldManagerTest.php +++ b/tests/unit/Espo/Core/Utils/FieldManagerTest.php @@ -39,7 +39,7 @@ class FieldManagerTest extends \PHPUnit\Framework\TestCase protected $reflection; - protected function setUp() + protected function setUp() : void { $this->objects['container'] = $this->getMockBuilder('\\Espo\\Core\\Container')->disableOriginalConstructor()->getMock(); @@ -65,7 +65,7 @@ class FieldManagerTest extends \PHPUnit\Framework\TestCase $this->reflection->setProperty('metadataHelper', $this->objects['metadataHelper']); } - protected function tearDown() + protected function tearDown() : void { $this->object = NULL; } @@ -403,4 +403,4 @@ class FieldManagerTest extends \PHPUnit\Framework\TestCase ); $this->assertEquals($result, $this->reflection->invokeMethod('normalizeDefs', array('CustomEntity', $input1, $input2))); } -} \ No newline at end of file +} diff --git a/tests/unit/Espo/Core/Utils/File/ClassParserTest.php b/tests/unit/Espo/Core/Utils/File/ClassParserTest.php index c249e444c7..af6aa945e6 100644 --- a/tests/unit/Espo/Core/Utils/File/ClassParserTest.php +++ b/tests/unit/Espo/Core/Utils/File/ClassParserTest.php @@ -41,7 +41,7 @@ class ClassParserTest extends \PHPUnit\Framework\TestCase protected $reflection; - protected function setUp() + protected function setUp() : void { $this->objects['fileManager'] = new \Espo\Core\Utils\File\Manager(); $this->objects['config'] = $this->getMockBuilder('\Espo\Core\Utils\Config')->disableOriginalConstructor()->getMock(); @@ -52,7 +52,7 @@ class ClassParserTest extends \PHPUnit\Framework\TestCase $this->reflection = new ReflectionHelper($this->object); } - protected function tearDown() + protected function tearDown() : void { $this->object = NULL; } diff --git a/tests/unit/Espo/Core/Utils/File/ManagerTest.php b/tests/unit/Espo/Core/Utils/File/ManagerTest.php index fe690a6556..a6f68b9a8c 100644 --- a/tests/unit/Espo/Core/Utils/File/ManagerTest.php +++ b/tests/unit/Espo/Core/Utils/File/ManagerTest.php @@ -42,7 +42,7 @@ class ManagerTest extends \PHPUnit\Framework\TestCase protected $reflection; - protected function setUp() + protected function setUp() : void { $this->objects['config'] = $this->getMockBuilder('\Espo\Core\Utils\Config')->disableOriginalConstructor()->getMock(); @@ -51,7 +51,7 @@ class ManagerTest extends \PHPUnit\Framework\TestCase $this->reflection = new ReflectionHelper($this->object); } - protected function tearDown() + protected function tearDown() : void { $this->object = NULL; } @@ -506,4 +506,4 @@ class ManagerTest extends \PHPUnit\Framework\TestCase } } -} \ No newline at end of file +} diff --git a/tests/unit/Espo/Core/Utils/File/PermissionTest.php b/tests/unit/Espo/Core/Utils/File/PermissionTest.php index 814660a6c8..35f950ce52 100644 --- a/tests/unit/Espo/Core/Utils/File/PermissionTest.php +++ b/tests/unit/Espo/Core/Utils/File/PermissionTest.php @@ -41,7 +41,7 @@ class PermissionTest extends \PHPUnit\Framework\TestCase protected $fileList; - protected function setUp() + protected function setUp() : void { $this->objects['fileManager'] = $this->getMockBuilder('\Espo\Core\Utils\File\Manager')->disableOriginalConstructor()->getMock(); @@ -67,7 +67,7 @@ class PermissionTest extends \PHPUnit\Framework\TestCase ); } - protected function tearDown() + protected function tearDown() : void { $this->object = NULL; } diff --git a/tests/unit/Espo/Core/Utils/JsonTest.php b/tests/unit/Espo/Core/Utils/JsonTest.php index 933a5fcf62..e6924f599f 100644 --- a/tests/unit/Espo/Core/Utils/JsonTest.php +++ b/tests/unit/Espo/Core/Utils/JsonTest.php @@ -33,12 +33,12 @@ use Espo\Core\Utils\Json; class JsonTest extends \PHPUnit\Framework\TestCase { - protected function setUp() + protected function setUp() : void { $GLOBALS['log'] = $this->getMockBuilder('\Espo\Core\Utils\Log')->disableOriginalConstructor()->getMock(); } - protected function tearDown() + protected function tearDown() : void { $this->object = NULL; } @@ -81,4 +81,4 @@ class JsonTest extends \PHPUnit\Framework\TestCase } -?> \ No newline at end of file +?> diff --git a/tests/unit/Espo/Core/Utils/LanguageTest.php b/tests/unit/Espo/Core/Utils/LanguageTest.php index 28027744cf..e9d01897bc 100644 --- a/tests/unit/Espo/Core/Utils/LanguageTest.php +++ b/tests/unit/Espo/Core/Utils/LanguageTest.php @@ -47,7 +47,7 @@ class LanguageTest extends \PHPUnit\Framework\TestCase 'customPath' => 'tests/unit/testData/Utils/I18n/Espo/Custom/Resources/i18n/{language}', ]; - protected function setUp() + protected function setUp() : void { $this->objects['fileManager'] = new \Espo\Core\Utils\File\Manager(); @@ -69,7 +69,7 @@ class LanguageTest extends \PHPUnit\Framework\TestCase $this->reflection->setProperty('currentLanguage', 'en_US'); } - protected function tearDown() + protected function tearDown() : void { $this->object = NULL; } diff --git a/tests/unit/Espo/Core/Utils/LayoutTest.php b/tests/unit/Espo/Core/Utils/LayoutTest.php index a053df3be0..d523ca1e6d 100644 --- a/tests/unit/Espo/Core/Utils/LayoutTest.php +++ b/tests/unit/Espo/Core/Utils/LayoutTest.php @@ -42,7 +42,7 @@ class LayoutTest extends \PHPUnit\Framework\TestCase protected $filesPath= 'tests/unit/testData/FileManager'; - protected function setUp() + protected function setUp() : void { $this->objects['fileManager'] = $this->getMockBuilder('\\Espo\\Core\\Utils\\File\\Manager')->disableOriginalConstructor()->getMock(); $this->objects['metadata'] = $this->getMockBuilder('\\Espo\\Core\\Utils\\Metadata')->disableOriginalConstructor()->getMock(); @@ -56,7 +56,7 @@ class LayoutTest extends \PHPUnit\Framework\TestCase ) ); } - protected function tearDown() + protected function tearDown() : void { $this->object = NULL; } diff --git a/tests/unit/Espo/Core/Utils/MetadataTest.php b/tests/unit/Espo/Core/Utils/MetadataTest.php index 0b33fe3fc1..bccd8c4b0a 100644 --- a/tests/unit/Espo/Core/Utils/MetadataTest.php +++ b/tests/unit/Espo/Core/Utils/MetadataTest.php @@ -45,7 +45,7 @@ class MetadataTest extends \PHPUnit\Framework\TestCase protected $cacheFile = 'tests/unit/testData/cache/metadata.php'; protected $objCacheFile = 'tests/unit/testData/cache/objMetadata.php'; - protected function setUp() + protected function setUp() : void { /*copy defaultCacheFile file to cache*/ if (!file_exists($this->cacheFile)) { @@ -68,7 +68,7 @@ class MetadataTest extends \PHPUnit\Framework\TestCase $this->reflection->setProperty('objCacheFile', $this->objCacheFile); } - protected function tearDown() + protected function tearDown() : void { $this->object->clearChanges(); $this->object = NULL; @@ -350,4 +350,4 @@ class MetadataTest extends \PHPUnit\Framework\TestCase $this->assertObjectHasAttribute('type', $this->object->getObjects('entityDefs.User.fields.name')); } -} \ No newline at end of file +} diff --git a/tests/unit/Espo/Core/Utils/PasswordHashTest.php b/tests/unit/Espo/Core/Utils/PasswordHashTest.php index 321b41732b..380dfbb22c 100644 --- a/tests/unit/Espo/Core/Utils/PasswordHashTest.php +++ b/tests/unit/Espo/Core/Utils/PasswordHashTest.php @@ -41,7 +41,7 @@ class PasswordHashTest extends \PHPUnit\Framework\TestCase protected $salt = 'bdaff81c7b8db54d'; - protected function setUp() + protected function setUp() : void { $this->objects['config'] = $this->getMockBuilder('\Espo\Core\Utils\Config')->disableOriginalConstructor()->getMock(); @@ -50,7 +50,7 @@ class PasswordHashTest extends \PHPUnit\Framework\TestCase $this->reflection = new ReflectionHelper($this->object); } - protected function tearDown() + protected function tearDown() : void { $this->object = NULL; } diff --git a/tests/unit/Espo/Core/Utils/RouteTest.php b/tests/unit/Espo/Core/Utils/RouteTest.php index 644df309cd..ca58eba145 100644 --- a/tests/unit/Espo/Core/Utils/RouteTest.php +++ b/tests/unit/Espo/Core/Utils/RouteTest.php @@ -39,7 +39,7 @@ class RouteTest extends \PHPUnit\Framework\TestCase protected $filesPath = 'tests/unit/testData/Routes'; - protected function setUp() + protected function setUp() : void { $this->objects['container'] = $this->getMockBuilder('\\Espo\\Core\\Container')->disableOriginalConstructor()->getMock(); @@ -62,7 +62,7 @@ class RouteTest extends \PHPUnit\Framework\TestCase $this->reflection = new ReflectionHelper($this->object); } - protected function tearDown() + protected function tearDown() : void { $this->object = NULL; $this->reflection = NULL; @@ -392,4 +392,4 @@ class RouteTest extends \PHPUnit\Framework\TestCase $this->assertEquals($result, $this->reflection->invokeMethod('unify')); } -} \ No newline at end of file +} diff --git a/tests/unit/Espo/Core/Utils/ScheduledJobTest.php b/tests/unit/Espo/Core/Utils/ScheduledJobTest.php index ed25a3563e..9a7abc0a59 100644 --- a/tests/unit/Espo/Core/Utils/ScheduledJobTest.php +++ b/tests/unit/Espo/Core/Utils/ScheduledJobTest.php @@ -46,7 +46,7 @@ class ScheduledJobTest extends \PHPUnit\Framework\TestCase 'default' => 'default command', ); - protected function setUp() + protected function setUp() : void { $this->objects['container'] = $this->getMockBuilder('\Espo\Core\Container')->disableOriginalConstructor()->getMock(); @@ -68,7 +68,7 @@ class ScheduledJobTest extends \PHPUnit\Framework\TestCase $this->reflection->setProperty('cronSetup', $this->cronSetup); } - protected function tearDown() + protected function tearDown() : void { $this->object = NULL; } diff --git a/tests/unit/Espo/Core/Utils/SystemTest.php b/tests/unit/Espo/Core/Utils/SystemTest.php index c48661e81a..59033aed28 100644 --- a/tests/unit/Espo/Core/Utils/SystemTest.php +++ b/tests/unit/Espo/Core/Utils/SystemTest.php @@ -39,12 +39,12 @@ class SystemTest extends \PHPUnit\Framework\TestCase protected $reflection; - protected function setUp() + protected function setUp() : void { $this->object = new \Espo\Core\Utils\System(); } - protected function tearDown() + protected function tearDown() : void { $this->object = NULL; } @@ -99,4 +99,4 @@ class SystemTest extends \PHPUnit\Framework\TestCase { $this->assertTrue( (bool) preg_match('/^[0-9\.]+$/', System::getPhpVersion()) ); } -} \ No newline at end of file +} diff --git a/tests/unit/Espo/Entities/EmailTest.php b/tests/unit/Espo/Entities/EmailTest.php index a50903d3a8..a1ef65fb90 100644 --- a/tests/unit/Espo/Entities/EmailTest.php +++ b/tests/unit/Espo/Entities/EmailTest.php @@ -413,7 +413,7 @@ class EmailTest extends \PHPUnit\Framework\TestCase ); - protected function setUp() + protected function setUp() : void { $this->entityManager = $this->getMockBuilder('\Espo\Core\ORM\EntityManager')->disableOriginalConstructor()->getMock(); @@ -429,7 +429,7 @@ class EmailTest extends \PHPUnit\Framework\TestCase } - protected function tearDown() + protected function tearDown() : void { $this->entityManager = null; $this->repository = null; diff --git a/tests/unit/Espo/ORM/DB/MapperTest.php b/tests/unit/Espo/ORM/DB/MapperTest.php index e2efa58a3c..c7a6a9f7ad 100644 --- a/tests/unit/Espo/ORM/DB/MapperTest.php +++ b/tests/unit/Espo/ORM/DB/MapperTest.php @@ -50,7 +50,7 @@ class DBMapperTest extends \PHPUnit\Framework\TestCase protected $comment; protected $entityFactory; - protected function setUp() + protected function setUp() : void { $this->pdo = $this->createMock('MockPDO'); $this->pdo @@ -98,7 +98,7 @@ class DBMapperTest extends \PHPUnit\Framework\TestCase } - protected function tearDown() + protected function tearDown() : void { unset($this->pdo, $this->db, $this->post, $this->comment); } diff --git a/tests/unit/Espo/ORM/DB/QueryTest.php b/tests/unit/Espo/ORM/DB/QueryTest.php index 00b15b6f25..8298824446 100644 --- a/tests/unit/Espo/ORM/DB/QueryTest.php +++ b/tests/unit/Espo/ORM/DB/QueryTest.php @@ -47,7 +47,7 @@ class QueryTest extends \PHPUnit\Framework\TestCase protected $entityFactory; - protected function setUp() + protected function setUp() : void { $this->pdo = $this->createMock('MockPDO'); $this->pdo @@ -81,7 +81,7 @@ class QueryTest extends \PHPUnit\Framework\TestCase $this->account = new \Espo\Entities\Account(); } - protected function tearDown() + protected function tearDown() : void { unset($this->query); unset($this->pdo); diff --git a/tests/unit/Espo/ORM/EntityTest.php b/tests/unit/Espo/ORM/EntityTest.php index 4c2215dfd7..4a87f4e5ba 100644 --- a/tests/unit/Espo/ORM/EntityTest.php +++ b/tests/unit/Espo/ORM/EntityTest.php @@ -36,11 +36,11 @@ require_once 'tests/unit/testData/DB/Entities.php'; class EntityTest extends \PHPUnit\Framework\TestCase { - protected function setUp() + protected function setUp() : void { } - protected function tearDown() + protected function tearDown() : void { } diff --git a/tests/unit/Espo/Services/ImportTest.php b/tests/unit/Espo/Services/ImportTest.php index 82e77e717e..46de7a2384 100644 --- a/tests/unit/Espo/Services/ImportTest.php +++ b/tests/unit/Espo/Services/ImportTest.php @@ -39,7 +39,7 @@ class ImportTest extends \PHPUnit\Framework\TestCase protected $importService; - protected function setUp() + protected function setUp() : void { $this->objects['serviceFactory'] = $this->getMockBuilder('\Espo\Core\ServiceFactory')->disableOriginalConstructor()->getMock(); @@ -61,7 +61,7 @@ class ImportTest extends \PHPUnit\Framework\TestCase } - protected function tearDown() + protected function tearDown() : void { $this->importService = NULL; } @@ -72,4 +72,3 @@ class ImportTest extends \PHPUnit\Framework\TestCase $this->assertTrue(true); } } -