From bb7da7cffd30d87b27924d592d8a9a84373cd2a6 Mon Sep 17 00:00:00 2001 From: Daniel Hensby Date: Fri, 24 Mar 2017 14:02:20 +1300 Subject: [PATCH 1/4] Bump PHPUnit version --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 922651344..67c6c1404 100644 --- a/composer.json +++ b/composer.json @@ -32,7 +32,7 @@ "vlucas/phpdotenv": "^2.4" }, "require-dev": { - "phpunit/PHPUnit": "~4.8", + "phpunit/PHPUnit": "^5.7", "silverstripe/behat-extension": "^2.1.0", "silverstripe/serve": "dev-master", "silverstripe/testsession": "^2.0.0-alpha3", From 6b4a72dee83deed73c39d9b9edc52fd1babd42fe Mon Sep 17 00:00:00 2001 From: Daniel Hensby Date: Fri, 24 Mar 2017 15:50:39 +1300 Subject: [PATCH 2/4] Fixing deprecated PHPUnit APIs --- tests/php/Control/Email/SwiftMailerTest.php | 4 +++- tests/php/Core/Injector/InjectorTest.php | 3 ++- tests/php/ORM/PaginatedListTest.php | 3 ++- tests/php/View/Parsers/ShortcodeParserTest.php | 3 ++- tests/php/View/SSViewerTest.php | 3 ++- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/tests/php/Control/Email/SwiftMailerTest.php b/tests/php/Control/Email/SwiftMailerTest.php index 22b20537d..40a727ba5 100644 --- a/tests/php/Control/Email/SwiftMailerTest.php +++ b/tests/php/Control/Email/SwiftMailerTest.php @@ -51,7 +51,9 @@ class SwiftMailerTest extends SapphireTest $email->setFrom('from@example.com'); $email->setSubject('Subject'); - $mailer = $this->getMock(SwiftMailer::class, array('sendSwift')); + $mailer = $this->getMockBuilder(SwiftMailer::class) + ->setMethods(array('sendSwift')) + ->getMock(); $mailer->expects($this->once())->method('sendSwift')->willReturnCallback(function ($message) { $this->assertInstanceOf(Swift_Message::class, $message); }); diff --git a/tests/php/Core/Injector/InjectorTest.php b/tests/php/Core/Injector/InjectorTest.php index 6bbaf1fcd..5f4877597 100644 --- a/tests/php/Core/Injector/InjectorTest.php +++ b/tests/php/Core/Injector/InjectorTest.php @@ -4,6 +4,7 @@ namespace SilverStripe\Core\Tests\Injector; use InvalidArgumentException; use SilverStripe\Core\Config\Config; +use SilverStripe\Core\Injector\Factory; use SilverStripe\Core\Injector\Injector; use SilverStripe\Core\Injector\SilverStripeServiceConfigurationLocator; use SilverStripe\Core\Tests\Injector\AopProxyServiceTest\AnotherService; @@ -813,7 +814,7 @@ class InjectorTest extends SapphireTest ) ); - $factory = $this->getMock('SilverStripe\\Core\\Injector\\Factory'); + $factory = $this->getMockBuilder(Factory::class)->getMock(); $factory ->expects($this->once()) ->method('create') diff --git a/tests/php/ORM/PaginatedListTest.php b/tests/php/ORM/PaginatedListTest.php index a688eb619..401335b4a 100644 --- a/tests/php/ORM/PaginatedListTest.php +++ b/tests/php/ORM/PaginatedListTest.php @@ -6,6 +6,7 @@ use SilverStripe\ORM\ArrayList; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\PaginatedList; use SilverStripe\Dev\SapphireTest; +use SilverStripe\ORM\Queries\SQLSelect; use SilverStripe\ORM\Tests\DataObjectTest\Player; use SilverStripe\View\ArrayData; @@ -58,7 +59,7 @@ class PaginatedListTest extends SapphireTest public function testSetPaginationFromQuery() { - $query = $this->getMock('SilverStripe\\ORM\\Queries\\SQLSelect'); + $query = $this->getMockBuilder(SQLSelect::class)->getMock(); $query->expects($this->once()) ->method('getLimit') ->will($this->returnValue(array('limit' => 15, 'start' => 30))); diff --git a/tests/php/View/Parsers/ShortcodeParserTest.php b/tests/php/View/Parsers/ShortcodeParserTest.php index f3c88d37f..ba4eb6040 100644 --- a/tests/php/View/Parsers/ShortcodeParserTest.php +++ b/tests/php/View/Parsers/ShortcodeParserTest.php @@ -314,7 +314,8 @@ class ShortcodeParserTest extends SapphireTest public function testNoParseAttemptIfNoCode() { - $stub = $this->getMock('SilverStripe\\View\\Parsers\\ShortcodeParser', array('replaceElementTagsWithMarkers')); + $stub = $this->getMockBuilder(ShortcodeParser::class)->setMethods(array('replaceElementTagsWithMarkers')) + ->getMock(); $stub->register( 'test', function () { diff --git a/tests/php/View/SSViewerTest.php b/tests/php/View/SSViewerTest.php index 5c7d32617..44264e34d 100644 --- a/tests/php/View/SSViewerTest.php +++ b/tests/php/View/SSViewerTest.php @@ -201,7 +201,8 @@ class SSViewerTest extends SapphireTest public function testRequirements() { - $requirements = $this->getMock("SilverStripe\\View\\Requirements_Backend", array("javascript", "css")); + $requirements = $this->getMockBuilder(Requirements_Backend::class)->setMethods(array("javascript", "css")) + ->getMock(); $jsFile = FRAMEWORK_DIR . '/tests/forms/a.js'; $cssFile = FRAMEWORK_DIR . '/tests/forms/a.js'; From 0410b4c35eafc6184ac765ecfe29d2bd384f3594 Mon Sep 17 00:00:00 2001 From: Daniel Hensby Date: Fri, 24 Mar 2017 16:00:54 +1300 Subject: [PATCH 3/4] Respect PHPUnit method visibility --- src/Dev/FunctionalTest.php | 4 ++-- src/Dev/SapphireTest.php | 4 ++-- tests/php/Control/ControllerTest.php | 4 ++-- tests/php/Control/CookieTest.php | 4 ++-- tests/php/Control/DirectorTest.php | 4 ++-- tests/php/Control/Email/SwiftPluginTest.php | 2 +- tests/php/Control/RSS/RSSFeedTest.php | 4 ++-- tests/php/Core/ClassInfoTest.php | 2 +- tests/php/Core/CoreTest.php | 4 ++-- tests/php/Core/Injector/InjectorTest.php | 4 ++-- tests/php/Core/Manifest/ClassLoaderTest.php | 2 +- tests/php/Core/Manifest/ClassManifestTest.php | 2 +- tests/php/Core/Manifest/ConfigManifestTest.php | 4 ++-- tests/php/Core/Manifest/ModuleManifestTest.php | 2 +- tests/php/Core/Manifest/NamespacedClassManifestTest.php | 4 ++-- tests/php/Core/Manifest/ThemeResourceLoaderTest.php | 2 +- tests/php/Core/MemoryLimitTest.php | 4 ++-- tests/php/Core/ObjectTest.php | 2 +- tests/php/Core/PhpSyntaxTest.php | 2 +- tests/php/Core/Startup/ErrorControlChainTest.php | 2 +- tests/php/Core/Startup/ParameterConfirmationTokenTest.php | 4 ++-- tests/php/Dev/BulkLoaderResultTest.php | 2 +- tests/php/Dev/CSVParserTest.php | 2 +- tests/php/Dev/CsvBulkLoaderTest.php | 2 +- tests/php/Dev/DeprecationTest.php | 4 ++-- tests/php/Dev/DevAdminControllerTest.php | 2 +- tests/php/Forms/DateFieldTest.php | 2 +- tests/php/Forms/DatetimeFieldTest.php | 4 ++-- tests/php/Forms/FormTest.php | 2 +- tests/php/Forms/GridField/GridFieldDeleteActionTest.php | 2 +- tests/php/Forms/GridField/GridFieldEditButtonTest.php | 2 +- tests/php/Forms/GridField/GridFieldExportButtonTest.php | 2 +- tests/php/Forms/GridField/GridFieldPaginatorTest.php | 2 +- tests/php/Forms/GridField/GridFieldPrintButtonTest.php | 2 +- tests/php/Forms/HTMLEditor/HTMLEditorFieldTest.php | 4 ++-- tests/php/Forms/HTMLEditor/HTMLEditorFieldToolbarTest.php | 2 +- tests/php/Forms/SeparatedDateFieldTest.php | 2 +- tests/php/Forms/TimeFieldTest.php | 2 +- tests/php/ORM/DBDateTest.php | 4 ++-- tests/php/ORM/DBDatetimeTest.php | 2 +- tests/php/ORM/DBHTMLTextTest.php | 4 ++-- tests/php/ORM/DBTimeTest.php | 2 +- tests/php/ORM/DataDifferencerTest.php | 4 ++-- tests/php/ORM/DecimalTest.php | 2 +- tests/php/ORM/ManyManyThroughListTest.php | 4 ++-- tests/php/ORM/SQLSelectTest.php | 4 ++-- tests/php/ORM/Search/FulltextSearchableTest.php | 4 ++-- tests/php/ORM/VersionedOwnershipTest.php | 2 +- tests/php/Security/BasicAuthTest.php | 2 +- tests/php/Security/MemberAuthenticatorTest.php | 4 ++-- tests/php/Security/MemberTest.php | 4 ++-- tests/php/Security/PasswordEncryptorTest.php | 2 +- tests/php/Security/SecurityDefaultAdminTest.php | 4 ++-- tests/php/Security/SecurityTest.php | 4 ++-- tests/php/View/Parsers/ShortcodeParserTest.php | 4 ++-- tests/php/View/RequirementsTest.php | 4 ++-- tests/php/View/SSViewerTest.php | 4 ++-- tests/php/i18n/i18nTest.php | 4 ++-- tests/php/i18n/i18nTextCollectorTest.php | 4 ++-- 59 files changed, 89 insertions(+), 89 deletions(-) diff --git a/src/Dev/FunctionalTest.php b/src/Dev/FunctionalTest.php index d96f716de..99ecfba9f 100644 --- a/src/Dev/FunctionalTest.php +++ b/src/Dev/FunctionalTest.php @@ -80,7 +80,7 @@ class FunctionalTest extends SapphireTest return $this->mainSession->session(); } - public function setUp() + protected function setUp() { // Skip calling FunctionalTest directly. if (get_class($this) == __CLASS__) { @@ -107,7 +107,7 @@ class FunctionalTest extends SapphireTest SecurityToken::disable(); } - public function tearDown() + protected function tearDown() { SecurityToken::enable(); diff --git a/src/Dev/SapphireTest.php b/src/Dev/SapphireTest.php index ddd9cd74c..f22dda13b 100644 --- a/src/Dev/SapphireTest.php +++ b/src/Dev/SapphireTest.php @@ -228,7 +228,7 @@ class SapphireTest extends PHPUnit_Framework_TestCase protected $originalEnv = null; - public function setUp() + protected function setUp() { //nest config and injector for each test so they are effectively sandboxed per test Config::nest(); @@ -562,7 +562,7 @@ class SapphireTest extends PHPUnit_Framework_TestCase return $path; } - public function tearDown() + protected function tearDown() { // Preserve memory settings ini_set('memory_limit', ($this->originalMemoryLimit) ? $this->originalMemoryLimit : -1); diff --git a/tests/php/Control/ControllerTest.php b/tests/php/Control/ControllerTest.php index 87f272cd6..a2f9ba6d1 100644 --- a/tests/php/Control/ControllerTest.php +++ b/tests/php/Control/ControllerTest.php @@ -47,7 +47,7 @@ class ControllerTest extends FunctionalTest UnsecuredController::class, ]; - public function setUp() + protected function setUp() { parent::setUp(); Director::config()->update('alternate_base_url', '/'); @@ -62,7 +62,7 @@ class ControllerTest extends FunctionalTest SSViewer::set_themes($themes); } - public function tearDown() + protected function tearDown() { Deprecation::restore_settings($this->depSettings); parent::tearDown(); diff --git a/tests/php/Control/CookieTest.php b/tests/php/Control/CookieTest.php index 533a1506c..072fa2c76 100644 --- a/tests/php/Control/CookieTest.php +++ b/tests/php/Control/CookieTest.php @@ -12,14 +12,14 @@ class CookieTest extends SapphireTest private $cookieInst; - public function setUp() + protected function setUp() { parent::setUp(); Injector::nest(); Injector::inst()->registerService(new CookieJar($_COOKIE), 'SilverStripe\\Control\\Cookie_Backend'); } - public function tearDown() + protected function tearDown() { //restore the cookie_backend Injector::unnest(); diff --git a/tests/php/Control/DirectorTest.php b/tests/php/Control/DirectorTest.php index c2bc3a5ea..218d0e698 100644 --- a/tests/php/Control/DirectorTest.php +++ b/tests/php/Control/DirectorTest.php @@ -32,7 +32,7 @@ class DirectorTest extends SapphireTest TestController::class ]; - public function setUp() + protected function setUp() { parent::setUp(); @@ -77,7 +77,7 @@ class DirectorTest extends SapphireTest Director::config()->set('rules', $this->getExtraRoutes()); } - public function tearDown() + protected function tearDown() { $_GET = $this->originalGet; $_SESSION = $this->originalSession; diff --git a/tests/php/Control/Email/SwiftPluginTest.php b/tests/php/Control/Email/SwiftPluginTest.php index 348b742e7..da809552d 100644 --- a/tests/php/Control/Email/SwiftPluginTest.php +++ b/tests/php/Control/Email/SwiftPluginTest.php @@ -9,7 +9,7 @@ use SilverStripe\Dev\SapphireTest; class SwiftPluginTest extends SapphireTest { - public function setUp() + protected function setUp() { parent::setUp(); diff --git a/tests/php/Control/RSS/RSSFeedTest.php b/tests/php/Control/RSS/RSSFeedTest.php index b90ea2c1a..d1a76cce1 100644 --- a/tests/php/Control/RSS/RSSFeedTest.php +++ b/tests/php/Control/RSS/RSSFeedTest.php @@ -96,7 +96,7 @@ class RSSFeedTest extends SapphireTest $this->assertNotContains('Test Custom Template', $content); } - public function setUp() + protected function setUp() { parent::setUp(); Config::inst()->update(Director::class, 'alternate_base_url', '/'); @@ -113,7 +113,7 @@ class RSSFeedTest extends SapphireTest ); } - public function tearDown() + protected function tearDown() { parent::tearDown(); $_SERVER['HTTP_HOST'] = self::$original_host; diff --git a/tests/php/Core/ClassInfoTest.php b/tests/php/Core/ClassInfoTest.php index a8e96929c..329f8b442 100644 --- a/tests/php/Core/ClassInfoTest.php +++ b/tests/php/Core/ClassInfoTest.php @@ -31,7 +31,7 @@ class ClassInfoTest extends SapphireTest WithRelation::class, ); - public function setUp() + protected function setUp() { parent::setUp(); ClassInfo::reset_db_cache(); diff --git a/tests/php/Core/CoreTest.php b/tests/php/Core/CoreTest.php index 4011206e1..3d6700764 100644 --- a/tests/php/Core/CoreTest.php +++ b/tests/php/Core/CoreTest.php @@ -14,7 +14,7 @@ class CoreTest extends SapphireTest protected $tempPath; - public function setUp() + protected function setUp() { parent::setUp(); $this->tempPath = Director::baseFolder() . DIRECTORY_SEPARATOR . 'silverstripe-cache'; @@ -51,7 +51,7 @@ class CoreTest extends SapphireTest } } - public function tearDown() + protected function tearDown() { parent::tearDown(); $user = getTempFolderUsername(); diff --git a/tests/php/Core/Injector/InjectorTest.php b/tests/php/Core/Injector/InjectorTest.php index 5f4877597..4fa6627da 100644 --- a/tests/php/Core/Injector/InjectorTest.php +++ b/tests/php/Core/Injector/InjectorTest.php @@ -41,14 +41,14 @@ class InjectorTest extends SapphireTest protected $nestingLevel = 0; - public function setUp() + protected function setUp() { parent::setUp(); $this->nestingLevel = 0; } - public function tearDown() + protected function tearDown() { while ($this->nestingLevel > 0) { diff --git a/tests/php/Core/Manifest/ClassLoaderTest.php b/tests/php/Core/Manifest/ClassLoaderTest.php index 7a2306f5c..cb82edbf9 100644 --- a/tests/php/Core/Manifest/ClassLoaderTest.php +++ b/tests/php/Core/Manifest/ClassLoaderTest.php @@ -32,7 +32,7 @@ class ClassLoaderTest extends SapphireTest */ protected $testManifest2; - public function setUp() + protected function setUp() { parent::setUp(); diff --git a/tests/php/Core/Manifest/ClassManifestTest.php b/tests/php/Core/Manifest/ClassManifestTest.php index 58918f164..378a0780e 100644 --- a/tests/php/Core/Manifest/ClassManifestTest.php +++ b/tests/php/Core/Manifest/ClassManifestTest.php @@ -27,7 +27,7 @@ class ClassManifestTest extends SapphireTest */ protected $manifestTests; - public function setUp() + protected function setUp() { parent::setUp(); diff --git a/tests/php/Core/Manifest/ConfigManifestTest.php b/tests/php/Core/Manifest/ConfigManifestTest.php index 0c73c2a94..602795d2c 100644 --- a/tests/php/Core/Manifest/ConfigManifestTest.php +++ b/tests/php/Core/Manifest/ConfigManifestTest.php @@ -12,7 +12,7 @@ use SilverStripe\Dev\SapphireTest; class ConfigManifestTest extends SapphireTest { - public function setUp() + protected function setUp() { parent::setUp(); @@ -20,7 +20,7 @@ class ConfigManifestTest extends SapphireTest ModuleLoader::instance()->pushManifest($moduleManifest); } - public function tearDown() + protected function tearDown() { ModuleLoader::instance()->popManifest(); parent::tearDown(); diff --git a/tests/php/Core/Manifest/ModuleManifestTest.php b/tests/php/Core/Manifest/ModuleManifestTest.php index cf58c2686..001159509 100644 --- a/tests/php/Core/Manifest/ModuleManifestTest.php +++ b/tests/php/Core/Manifest/ModuleManifestTest.php @@ -18,7 +18,7 @@ class ModuleManifestTest extends SapphireTest */ protected $manifest; - public function setUp() + protected function setUp() { parent::setUp(); diff --git a/tests/php/Core/Manifest/NamespacedClassManifestTest.php b/tests/php/Core/Manifest/NamespacedClassManifestTest.php index f7dcff190..b5f69108e 100644 --- a/tests/php/Core/Manifest/NamespacedClassManifestTest.php +++ b/tests/php/Core/Manifest/NamespacedClassManifestTest.php @@ -23,7 +23,7 @@ class NamespacedClassManifestTest extends SapphireTest */ protected $manifest; - public function setUp() + protected function setUp() { parent::setUp(); @@ -32,7 +32,7 @@ class NamespacedClassManifestTest extends SapphireTest ClassLoader::instance()->pushManifest($this->manifest, false); } - public function tearDown() + protected function tearDown() { parent::tearDown(); ClassLoader::instance()->popManifest(); diff --git a/tests/php/Core/Manifest/ThemeResourceLoaderTest.php b/tests/php/Core/Manifest/ThemeResourceLoaderTest.php index d89102d42..41e974b81 100644 --- a/tests/php/Core/Manifest/ThemeResourceLoaderTest.php +++ b/tests/php/Core/Manifest/ThemeResourceLoaderTest.php @@ -29,7 +29,7 @@ class ThemeResourceLoaderTest extends SapphireTest /** * Set up manifest before each test */ - public function setUp() + protected function setUp() { parent::setUp(); diff --git a/tests/php/Core/MemoryLimitTest.php b/tests/php/Core/MemoryLimitTest.php index c407fb5f1..f5717fd58 100644 --- a/tests/php/Core/MemoryLimitTest.php +++ b/tests/php/Core/MemoryLimitTest.php @@ -76,7 +76,7 @@ class MemoryLimitTest extends SapphireTest private $origMemLimit, $origTimeLimit; - public function setUp() + protected function setUp() { $this->origMemLimit = ini_get('memory_limit'); $this->origTimeLimit = ini_get('max_execution_time'); @@ -86,7 +86,7 @@ class MemoryLimitTest extends SapphireTest set_increase_time_limit_max(-1); } - public function tearDown() + protected function tearDown() { ini_set('memory_limit', $this->origMemLimit); set_time_limit($this->origTimeLimit); diff --git a/tests/php/Core/ObjectTest.php b/tests/php/Core/ObjectTest.php index 5b8645f06..aa9c49f69 100644 --- a/tests/php/Core/ObjectTest.php +++ b/tests/php/Core/ObjectTest.php @@ -26,7 +26,7 @@ use SilverStripe\Control\Controller; class ObjectTest extends SapphireTest { - public function setUp() + protected function setUp() { parent::setUp(); Injector::inst()->unregisterAllObjects(); diff --git a/tests/php/Core/PhpSyntaxTest.php b/tests/php/Core/PhpSyntaxTest.php index 60500371f..e7da91bad 100644 --- a/tests/php/Core/PhpSyntaxTest.php +++ b/tests/php/Core/PhpSyntaxTest.php @@ -9,7 +9,7 @@ use SilverStripe\Dev\SapphireTest; */ class PhpSyntaxTest extends SapphireTest { - public function setUp() + protected function setUp() { parent::setUp(); $this->markTestSkipped('This needs to be written to include only core php files, not test/thirdparty files'); diff --git a/tests/php/Core/Startup/ErrorControlChainTest.php b/tests/php/Core/Startup/ErrorControlChainTest.php index bf6fdc8b5..f04de6ef7 100644 --- a/tests/php/Core/Startup/ErrorControlChainTest.php +++ b/tests/php/Core/Startup/ErrorControlChainTest.php @@ -10,7 +10,7 @@ use Exception; class ErrorControlChainTest extends SapphireTest { - public function setUp() + protected function setUp() { // Check we can run PHP at all diff --git a/tests/php/Core/Startup/ParameterConfirmationTokenTest.php b/tests/php/Core/Startup/ParameterConfirmationTokenTest.php index 2799b79cb..d4af7eade 100644 --- a/tests/php/Core/Startup/ParameterConfirmationTokenTest.php +++ b/tests/php/Core/Startup/ParameterConfirmationTokenTest.php @@ -26,7 +26,7 @@ class ParameterConfirmationTokenTest extends SapphireTest protected $oldHost = null; - public function setUp() + protected function setUp() { parent::setUp(); $this->oldHost = $_SERVER['HTTP_HOST']; @@ -40,7 +40,7 @@ class ParameterConfirmationTokenTest extends SapphireTest $_GET['parameterconfirmationtokentest_emptytokentoken'] = ''; } - public function tearDown() + protected function tearDown() { foreach ($_GET as $param => $value) { if (stripos($param, 'parameterconfirmationtokentest_') === 0) { diff --git a/tests/php/Dev/BulkLoaderResultTest.php b/tests/php/Dev/BulkLoaderResultTest.php index f98df93bd..c4a8c8d5d 100644 --- a/tests/php/Dev/BulkLoaderResultTest.php +++ b/tests/php/Dev/BulkLoaderResultTest.php @@ -10,7 +10,7 @@ class BulkLoaderResultTest extends SapphireTest { protected $extraDataObjects = array(Player::class); - public function setUp() + protected function setUp() { parent::setUp(); Player::create(array('Name' => 'Vincent', 'Status' => 'Available'))->write(); diff --git a/tests/php/Dev/CSVParserTest.php b/tests/php/Dev/CSVParserTest.php index 70af399ae..0e06b0363 100644 --- a/tests/php/Dev/CSVParserTest.php +++ b/tests/php/Dev/CSVParserTest.php @@ -15,7 +15,7 @@ class CSVParserTest extends SapphireTest */ protected $csvPath = null; - public function setUp() + protected function setUp() { parent::setUp(); $this->csvPath = __DIR__ . '/CsvBulkLoaderTest/csv/'; diff --git a/tests/php/Dev/CsvBulkLoaderTest.php b/tests/php/Dev/CsvBulkLoaderTest.php index 6dcd50a57..20966a7d2 100644 --- a/tests/php/Dev/CsvBulkLoaderTest.php +++ b/tests/php/Dev/CsvBulkLoaderTest.php @@ -30,7 +30,7 @@ class CsvBulkLoaderTest extends SapphireTest */ protected $csvPath = null; - public function setUp() + protected function setUp() { parent::setUp(); $this->csvPath = __DIR__ . '/CsvBulkLoaderTest/csv/'; diff --git a/tests/php/Dev/DeprecationTest.php b/tests/php/Dev/DeprecationTest.php index ab9b4396c..5c30e8e31 100644 --- a/tests/php/Dev/DeprecationTest.php +++ b/tests/php/Dev/DeprecationTest.php @@ -12,7 +12,7 @@ class DeprecationTest extends SapphireTest static $originalVersionInfo; - public function setUp() + protected function setUp() { parent::setUp(); @@ -21,7 +21,7 @@ class DeprecationTest extends SapphireTest Deprecation::set_enabled(true); } - public function tearDown() + protected function tearDown() { Deprecation::restore_settings(self::$originalVersionInfo); parent::tearDown(); diff --git a/tests/php/Dev/DevAdminControllerTest.php b/tests/php/Dev/DevAdminControllerTest.php index ab8210ff9..a27a118f9 100644 --- a/tests/php/Dev/DevAdminControllerTest.php +++ b/tests/php/Dev/DevAdminControllerTest.php @@ -14,7 +14,7 @@ use SilverStripe\Dev\Tests\DevAdminControllerTest\Controller1; class DevAdminControllerTest extends FunctionalTest { - public function setUp() + protected function setUp() { parent::setUp(); diff --git a/tests/php/Forms/DateFieldTest.php b/tests/php/Forms/DateFieldTest.php index 8cceffef1..fbfe18e89 100644 --- a/tests/php/Forms/DateFieldTest.php +++ b/tests/php/Forms/DateFieldTest.php @@ -11,7 +11,7 @@ use SilverStripe\ORM\FieldType\DBDatetime; class DateFieldTest extends SapphireTest { - public function setUp() + protected function setUp() { parent::setUp(); i18n::set_locale('en_NZ'); diff --git a/tests/php/Forms/DatetimeFieldTest.php b/tests/php/Forms/DatetimeFieldTest.php index eb5e03b35..9969bb24f 100644 --- a/tests/php/Forms/DatetimeFieldTest.php +++ b/tests/php/Forms/DatetimeFieldTest.php @@ -19,14 +19,14 @@ class DatetimeFieldTest extends SapphireTest { protected $timezone = null; - public function setUp() + protected function setUp() { parent::setUp(); i18n::set_locale('en_NZ'); $this->timezone = date_default_timezone_get(); } - public function tearDown() + protected function tearDown() { date_default_timezone_set($this->timezone); parent::tearDown(); // TODO: Change the autogenerated stub diff --git a/tests/php/Forms/FormTest.php b/tests/php/Forms/FormTest.php index ac6db41ad..d1c1b1b0b 100644 --- a/tests/php/Forms/FormTest.php +++ b/tests/php/Forms/FormTest.php @@ -46,7 +46,7 @@ class FormTest extends FunctionalTest ControllerWithStrictPostCheck::class, ]; - public function setUp() + protected function setUp() { parent::setUp(); diff --git a/tests/php/Forms/GridField/GridFieldDeleteActionTest.php b/tests/php/Forms/GridField/GridFieldDeleteActionTest.php index 603f00707..c6d200c39 100644 --- a/tests/php/Forms/GridField/GridFieldDeleteActionTest.php +++ b/tests/php/Forms/GridField/GridFieldDeleteActionTest.php @@ -56,7 +56,7 @@ class GridFieldDeleteActionTest extends SapphireTest Permissions::class ]; - public function setUp() + protected function setUp() { parent::setUp(); $this->list = new DataList(Team::class); diff --git a/tests/php/Forms/GridField/GridFieldEditButtonTest.php b/tests/php/Forms/GridField/GridFieldEditButtonTest.php index b434738fb..c3eaeced1 100644 --- a/tests/php/Forms/GridField/GridFieldEditButtonTest.php +++ b/tests/php/Forms/GridField/GridFieldEditButtonTest.php @@ -51,7 +51,7 @@ class GridFieldEditButtonTest extends SapphireTest Permissions::class ); - public function setUp() + protected function setUp() { parent::setUp(); $this->list = new DataList(Team::class); diff --git a/tests/php/Forms/GridField/GridFieldExportButtonTest.php b/tests/php/Forms/GridField/GridFieldExportButtonTest.php index cee1378df..08b7b1b94 100644 --- a/tests/php/Forms/GridField/GridFieldExportButtonTest.php +++ b/tests/php/Forms/GridField/GridFieldExportButtonTest.php @@ -29,7 +29,7 @@ class GridFieldExportButtonTest extends SapphireTest NoView::class ); - public function setUp() + protected function setUp() { parent::setUp(); diff --git a/tests/php/Forms/GridField/GridFieldPaginatorTest.php b/tests/php/Forms/GridField/GridFieldPaginatorTest.php index f88558946..47c436e1f 100644 --- a/tests/php/Forms/GridField/GridFieldPaginatorTest.php +++ b/tests/php/Forms/GridField/GridFieldPaginatorTest.php @@ -49,7 +49,7 @@ class GridFieldPaginatorTest extends FunctionalTest Cheerleader::class, ); - public function setUp() + protected function setUp() { parent::setUp(); $this->list = new DataList(Team::class); diff --git a/tests/php/Forms/GridField/GridFieldPrintButtonTest.php b/tests/php/Forms/GridField/GridFieldPrintButtonTest.php index 0ddd59582..26a1119ec 100644 --- a/tests/php/Forms/GridField/GridFieldPrintButtonTest.php +++ b/tests/php/Forms/GridField/GridFieldPrintButtonTest.php @@ -19,7 +19,7 @@ class GridFieldPrintButtonTest extends SapphireTest TestObject::class ); - public function setUp() + protected function setUp() { parent::setUp(); diff --git a/tests/php/Forms/HTMLEditor/HTMLEditorFieldTest.php b/tests/php/Forms/HTMLEditor/HTMLEditorFieldTest.php index 275a85bd3..72f0cd058 100644 --- a/tests/php/Forms/HTMLEditor/HTMLEditorFieldTest.php +++ b/tests/php/Forms/HTMLEditor/HTMLEditorFieldTest.php @@ -37,7 +37,7 @@ class HTMLEditorFieldTest extends FunctionalTest protected $extraDataObjects = array(TestObject::class); - public function setUp() + protected function setUp() { parent::setUp(); @@ -67,7 +67,7 @@ class HTMLEditorFieldTest extends FunctionalTest } } - public function tearDown() + protected function tearDown() { TestAssetStore::reset(); parent::tearDown(); diff --git a/tests/php/Forms/HTMLEditor/HTMLEditorFieldToolbarTest.php b/tests/php/Forms/HTMLEditor/HTMLEditorFieldToolbarTest.php index 2f265ade8..05b4bb77d 100644 --- a/tests/php/Forms/HTMLEditor/HTMLEditorFieldToolbarTest.php +++ b/tests/php/Forms/HTMLEditor/HTMLEditorFieldToolbarTest.php @@ -24,7 +24,7 @@ class HTMLEditorFieldToolbarTest extends SapphireTest return new Toolbar(null, '/'); } - public function setUp() + protected function setUp() { parent::setUp(); diff --git a/tests/php/Forms/SeparatedDateFieldTest.php b/tests/php/Forms/SeparatedDateFieldTest.php index 1312a5efe..096503f8e 100644 --- a/tests/php/Forms/SeparatedDateFieldTest.php +++ b/tests/php/Forms/SeparatedDateFieldTest.php @@ -11,7 +11,7 @@ use SilverStripe\ORM\FieldType\DBDatetime; class SeparatedDateFieldTest extends SapphireTest { - public function setUp() + protected function setUp() { parent::setUp(); i18n::set_locale('en_NZ'); diff --git a/tests/php/Forms/TimeFieldTest.php b/tests/php/Forms/TimeFieldTest.php index 285c440be..58d2e31dc 100644 --- a/tests/php/Forms/TimeFieldTest.php +++ b/tests/php/Forms/TimeFieldTest.php @@ -10,7 +10,7 @@ use SilverStripe\i18n\i18n; class TimeFieldTest extends SapphireTest { - public function setUp() + protected function setUp() { parent::setUp(); i18n::set_locale('en_NZ'); diff --git a/tests/php/ORM/DBDateTest.php b/tests/php/ORM/DBDateTest.php index fd38a96ac..cb550e765 100644 --- a/tests/php/ORM/DBDateTest.php +++ b/tests/php/ORM/DBDateTest.php @@ -15,7 +15,7 @@ class DBDateTest extends SapphireTest { protected $oldError = null; - public function setUp() + protected function setUp() { parent::setUp(); $this->oldError = error_reporting(); @@ -24,7 +24,7 @@ class DBDateTest extends SapphireTest i18n::set_locale('en_NZ'); } - public function tearDown() + protected function tearDown() { $this->restoreNotices(); parent::tearDown(); diff --git a/tests/php/ORM/DBDatetimeTest.php b/tests/php/ORM/DBDatetimeTest.php index 11422c157..9f3cb8e02 100644 --- a/tests/php/ORM/DBDatetimeTest.php +++ b/tests/php/ORM/DBDatetimeTest.php @@ -12,7 +12,7 @@ use SilverStripe\Security\Member; */ class DBDatetimeTest extends SapphireTest { - public function setUp() + protected function setUp() { parent::setUp(); i18n::set_locale('en_NZ'); diff --git a/tests/php/ORM/DBHTMLTextTest.php b/tests/php/ORM/DBHTMLTextTest.php index 976b8edd8..1958b0b08 100644 --- a/tests/php/ORM/DBHTMLTextTest.php +++ b/tests/php/ORM/DBHTMLTextTest.php @@ -14,7 +14,7 @@ use SilverStripe\View\Parsers\ShortcodeParser; class DBHTMLTextTest extends SapphireTest { - public function setUp() + protected function setUp() { parent::setUp(); @@ -24,7 +24,7 @@ class DBHTMLTextTest extends SapphireTest ShortcodeParser::set_active('htmltest'); } - public function tearDown() + protected function tearDown() { ShortcodeParser::set_active('default'); parent::tearDown(); diff --git a/tests/php/ORM/DBTimeTest.php b/tests/php/ORM/DBTimeTest.php index d43293baa..64f0640ae 100644 --- a/tests/php/ORM/DBTimeTest.php +++ b/tests/php/ORM/DBTimeTest.php @@ -10,7 +10,7 @@ use SilverStripe\Security\Member; class DBTimeTest extends SapphireTest { - public function setUp() + protected function setUp() { parent::setUp(); i18n::set_locale('en_NZ'); diff --git a/tests/php/ORM/DataDifferencerTest.php b/tests/php/ORM/DataDifferencerTest.php index 3601317c0..352c2fe8b 100644 --- a/tests/php/ORM/DataDifferencerTest.php +++ b/tests/php/ORM/DataDifferencerTest.php @@ -20,7 +20,7 @@ class DataDifferencerTest extends SapphireTest DataDifferencerTest\HasOneRelationObject::class ); - public function setUp() + protected function setUp() { parent::setUp(); @@ -39,7 +39,7 @@ class DataDifferencerTest extends SapphireTest } } - public function tearDown() + protected function tearDown() { TestAssetStore::reset(); parent::tearDown(); diff --git a/tests/php/ORM/DecimalTest.php b/tests/php/ORM/DecimalTest.php index 33c322ea3..c402a6ccd 100644 --- a/tests/php/ORM/DecimalTest.php +++ b/tests/php/ORM/DecimalTest.php @@ -15,7 +15,7 @@ class DecimalTest extends SapphireTest DecimalTest\TestObject::class ); - public function setUp() + protected function setUp() { parent::setUp(); $this->testDataObject = $this->objFromFixture(DecimalTest\TestObject::class, 'test-dataobject'); diff --git a/tests/php/ORM/ManyManyThroughListTest.php b/tests/php/ORM/ManyManyThroughListTest.php index b130a913f..6c33b04c1 100644 --- a/tests/php/ORM/ManyManyThroughListTest.php +++ b/tests/php/ORM/ManyManyThroughListTest.php @@ -21,13 +21,13 @@ class ManyManyThroughListTest extends SapphireTest ManyManyThroughListTest\VersionedObject::class, ]; - public function setUp() + protected function setUp() { parent::setUp(); DataObject::reset(); } - public function tearDown() + protected function tearDown() { DataObject::reset(); parent::tearDown(); diff --git a/tests/php/ORM/SQLSelectTest.php b/tests/php/ORM/SQLSelectTest.php index 4ce183c08..b2cfd14bc 100755 --- a/tests/php/ORM/SQLSelectTest.php +++ b/tests/php/ORM/SQLSelectTest.php @@ -23,13 +23,13 @@ class SQLSelectTest extends SapphireTest protected $oldDeprecation = null; - public function setUp() + protected function setUp() { parent::setUp(); $this->oldDeprecation = Deprecation::dump_settings(); } - public function tearDown() + protected function tearDown() { Deprecation::restore_settings($this->oldDeprecation); parent::tearDown(); diff --git a/tests/php/ORM/Search/FulltextSearchableTest.php b/tests/php/ORM/Search/FulltextSearchableTest.php index 97145b965..020e62896 100644 --- a/tests/php/ORM/Search/FulltextSearchableTest.php +++ b/tests/php/ORM/Search/FulltextSearchableTest.php @@ -11,7 +11,7 @@ use SilverStripe\ORM\Search\FulltextSearchable; class FulltextSearchableTest extends SapphireTest { - public function setUp() + protected function setUp() { parent::setUp(); @@ -23,7 +23,7 @@ class FulltextSearchableTest extends SapphireTest * properly at the end of the test. This becomes apparent when a later test tries to * ALTER TABLE File and add fulltext indexes with the InnoDB table type. */ - public function tearDown() + protected function tearDown() { parent::tearDown(); diff --git a/tests/php/ORM/VersionedOwnershipTest.php b/tests/php/ORM/VersionedOwnershipTest.php index 591901d21..1eea5d069 100644 --- a/tests/php/ORM/VersionedOwnershipTest.php +++ b/tests/php/ORM/VersionedOwnershipTest.php @@ -30,7 +30,7 @@ class VersionedOwnershipTest extends SapphireTest protected static $fixture_file = 'VersionedOwnershipTest.yml'; - public function setUp() + protected function setUp() { parent::setUp(); diff --git a/tests/php/Security/BasicAuthTest.php b/tests/php/Security/BasicAuthTest.php index 1b4514d03..f80019e6f 100644 --- a/tests/php/Security/BasicAuthTest.php +++ b/tests/php/Security/BasicAuthTest.php @@ -24,7 +24,7 @@ class BasicAuthTest extends FunctionalTest ControllerSecuredWithoutPermission::class, ]; - public function setUp() + protected function setUp() { parent::setUp(); diff --git a/tests/php/Security/MemberAuthenticatorTest.php b/tests/php/Security/MemberAuthenticatorTest.php index f107d6f27..99c9d214c 100644 --- a/tests/php/Security/MemberAuthenticatorTest.php +++ b/tests/php/Security/MemberAuthenticatorTest.php @@ -25,7 +25,7 @@ class MemberAuthenticatorTest extends SapphireTest protected $defaultUsername = null; protected $defaultPassword = null; - public function setUp() + protected function setUp() { parent::setUp(); @@ -35,7 +35,7 @@ class MemberAuthenticatorTest extends SapphireTest Security::setDefaultAdmin('admin', 'password'); } - public function tearDown() + protected function tearDown() { Security::setDefaultAdmin($this->defaultUsername, $this->defaultPassword); parent::tearDown(); diff --git a/tests/php/Security/MemberTest.php b/tests/php/Security/MemberTest.php index 210ef1ccd..157f69f7c 100644 --- a/tests/php/Security/MemberTest.php +++ b/tests/php/Security/MemberTest.php @@ -49,7 +49,7 @@ class MemberTest extends FunctionalTest /** * @skipUpgrade */ - public function setUp() + protected function setUp() { parent::setUp(); @@ -58,7 +58,7 @@ class MemberTest extends FunctionalTest Member::set_password_validator(null); } - public function tearDown() + protected function tearDown() { Member::config()->unique_identifier_field = $this->orig['Member_unique_identifier_field']; parent::tearDown(); diff --git a/tests/php/Security/PasswordEncryptorTest.php b/tests/php/Security/PasswordEncryptorTest.php index bbdd3ce4d..7f8fa81f1 100644 --- a/tests/php/Security/PasswordEncryptorTest.php +++ b/tests/php/Security/PasswordEncryptorTest.php @@ -12,7 +12,7 @@ use SilverStripe\Security\Tests\PasswordEncryptorTest\TestEncryptor; class PasswordEncryptorTest extends SapphireTest { - public function tearDown() + protected function tearDown() { parent::tearDown(); PasswordEncryptor_Blowfish::set_cost(10); diff --git a/tests/php/Security/SecurityDefaultAdminTest.php b/tests/php/Security/SecurityDefaultAdminTest.php index da6680e14..cd18de98c 100644 --- a/tests/php/Security/SecurityDefaultAdminTest.php +++ b/tests/php/Security/SecurityDefaultAdminTest.php @@ -15,7 +15,7 @@ class SecurityDefaultAdminTest extends SapphireTest protected $defaultUsername = null; protected $defaultPassword = null; - public function setUp() + protected function setUp() { parent::setUp(); @@ -33,7 +33,7 @@ class SecurityDefaultAdminTest extends SapphireTest Permission::flush_permission_cache(); } - public function tearDown() + protected function tearDown() { Security::setDefaultAdmin($this->defaultUsername, $this->defaultPassword); Permission::flush_permission_cache(); diff --git a/tests/php/Security/SecurityTest.php b/tests/php/Security/SecurityTest.php index 6fd5ad3f0..15455085b 100644 --- a/tests/php/Security/SecurityTest.php +++ b/tests/php/Security/SecurityTest.php @@ -45,7 +45,7 @@ class SecurityTest extends FunctionalTest SecurityTest\SecuredController::class, ]; - public function setUp() + protected function setUp() { // This test assumes that MemberAuthenticator is present and the default $this->priorAuthenticators = Authenticator::get_authenticators(); @@ -70,7 +70,7 @@ class SecurityTest extends FunctionalTest Config::inst()->update('SilverStripe\\Control\\Director', 'alternate_base_url', '/'); } - public function tearDown() + protected function tearDown() { // Restore selected authenticator diff --git a/tests/php/View/Parsers/ShortcodeParserTest.php b/tests/php/View/Parsers/ShortcodeParserTest.php index ba4eb6040..b9471317d 100644 --- a/tests/php/View/Parsers/ShortcodeParserTest.php +++ b/tests/php/View/Parsers/ShortcodeParserTest.php @@ -11,7 +11,7 @@ class ShortcodeParserTest extends SapphireTest protected $arguments, $contents, $tagName, $parser; protected $extra = array(); - public function setUp() + protected function setUp() { ShortcodeParser::get('test')->register('test_shortcode', array($this, 'shortcodeSaver')); $this->parser = ShortcodeParser::get('test'); @@ -19,7 +19,7 @@ class ShortcodeParserTest extends SapphireTest parent::setUp(); } - public function tearDown() + protected function tearDown() { ShortcodeParser::get('test')->unregister('test_shortcode'); diff --git a/tests/php/View/RequirementsTest.php b/tests/php/View/RequirementsTest.php index 10cb0c05b..6208fa3e4 100644 --- a/tests/php/View/RequirementsTest.php +++ b/tests/php/View/RequirementsTest.php @@ -20,13 +20,13 @@ class RequirementsTest extends SapphireTest static $html_template = ''; - public function setUp() + protected function setUp() { parent::setUp(); TestAssetStore::activate('RequirementsTest'); // Set backend root to /RequirementsTest } - public function tearDown() + protected function tearDown() { TestAssetStore::reset(); parent::tearDown(); diff --git a/tests/php/View/SSViewerTest.php b/tests/php/View/SSViewerTest.php index 44264e34d..856e86512 100644 --- a/tests/php/View/SSViewerTest.php +++ b/tests/php/View/SSViewerTest.php @@ -45,7 +45,7 @@ class SSViewerTest extends SapphireTest SSViewerTest\TestObject::class, ); - public function setUp() + protected function setUp() { parent::setUp(); SSViewer::config()->update('source_file_comments', false); @@ -54,7 +54,7 @@ class SSViewerTest extends SapphireTest $this->oldServer = $_SERVER; } - public function tearDown() + protected function tearDown() { $_SERVER = $this->oldServer; TestAssetStore::reset(); diff --git a/tests/php/i18n/i18nTest.php b/tests/php/i18n/i18nTest.php index d131e0ba9..0cd2c9703 100644 --- a/tests/php/i18n/i18nTest.php +++ b/tests/php/i18n/i18nTest.php @@ -17,13 +17,13 @@ class i18nTest extends SapphireTest { use i18nTestManifest; - public function setUp() + protected function setUp() { parent::setUp(); $this->setupManifest(); } - public function tearDown() + protected function tearDown() { $this->tearDownManifest(); parent::tearDown(); diff --git a/tests/php/i18n/i18nTextCollectorTest.php b/tests/php/i18n/i18nTextCollectorTest.php index d2a2ba3a3..5478260d1 100644 --- a/tests/php/i18n/i18nTextCollectorTest.php +++ b/tests/php/i18n/i18nTextCollectorTest.php @@ -20,7 +20,7 @@ class i18nTextCollectorTest extends SapphireTest */ protected $alternateBaseSavePath = null; - public function setUp() + protected function setUp() { parent::setUp(); $this->setupManifest(); @@ -29,7 +29,7 @@ class i18nTextCollectorTest extends SapphireTest Filesystem::makeFolder($this->alternateBaseSavePath); } - public function tearDown() + protected function tearDown() { if (is_dir($this->alternateBaseSavePath)) { Filesystem::removeFolder($this->alternateBaseSavePath); From bcb9a99e541d35186e90596d79890feb5b509314 Mon Sep 17 00:00:00 2001 From: Daniel Hensby Date: Fri, 24 Mar 2017 17:05:53 +1300 Subject: [PATCH 4/4] increase memory in a hope to get code coverage working --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index f76747ef9..f217d0676 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,6 +35,7 @@ before_script: - "if [ \"$PHPCS_TEST\" = \"1\" ]; then pyrus install pear/PHP_CodeSniffer; fi" - phpenv rehash - phpenv config-rm xdebug.ini + - echo 'memory_limit = 2048M' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini - "export DISPLAY=\":99\"" - "export XVFBARGS=\":99 -ac -screen 0 1024x768x16\"" - composer install --prefer-dist