From eacfe280c1524ff12b61e3fe7665ecbbef8bf53e Mon Sep 17 00:00:00 2001 From: Matthias Schelling Date: Wed, 6 Sep 2017 09:28:33 +0200 Subject: [PATCH 01/20] TreeDropdownField: replace onadd by onmatch Makes TreeDropdownField work in situations where it's moved around in the DOM (e.g. when inside a drag'n'drop container) --- javascript/TreeDropdownField.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/javascript/TreeDropdownField.js b/javascript/TreeDropdownField.js index 782f697e0..32453695e 100644 --- a/javascript/TreeDropdownField.js +++ b/javascript/TreeDropdownField.js @@ -47,7 +47,7 @@ // XMLHttpRequest CurrentXhr: null, - onadd: function() { + onmatch: function() { this.append( '' + '' + @@ -334,7 +334,7 @@ }); $('.TreeDropdownField.searchable').entwine({ - onadd: function() { + onmatch: function() { this._super(); var title = ss.i18n._t('TreeDropdownField.ENTERTOSEARCH'); this.find('.treedropdownfield-panel').prepend( @@ -431,13 +431,13 @@ }); $('.TreeDropdownField input[type=hidden]').entwine({ - onadd: function() { + onmatch: function() { this._super(); this.bind('change.TreeDropdownField', function() { $(this).getField().updateTitle(); }); }, - onremove: function() { + onunmatch: function() { this._super(); this.unbind('.TreeDropdownField'); } From 264cec1239ee8d75e67c5402970a91cf58e50539 Mon Sep 17 00:00:00 2001 From: Daniel Hensby Date: Mon, 9 Oct 2017 10:13:39 +0100 Subject: [PATCH 02/20] FIX Dont use var_export for cache key generation as it fails on circular references --- model/DataObject.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/DataObject.php b/model/DataObject.php index bec04bb5b..5fff3f39a 100644 --- a/model/DataObject.php +++ b/model/DataObject.php @@ -3224,7 +3224,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity $SNG = singleton($callerClass); $cacheComponents = array($filter, $orderby, $SNG->extend('cacheKeyComponent')); - $cacheKey = md5(var_export($cacheComponents, true)); + $cacheKey = md5(serialize($cacheComponents)); // Flush destroyed items out of the cache if($cache && isset(DataObject::$_cache_get_one[$callerClass][$cacheKey]) From 2f579b64cb9cb8986489e312b253dba5061e304b Mon Sep 17 00:00:00 2001 From: Robbie Averill Date: Sun, 13 Aug 2017 21:46:47 +1200 Subject: [PATCH 03/20] FIX Files without extensions (folders) do not have a trailing period added --- filesystem/File.php | 7 +++++-- tests/filesystem/FileTest.php | 24 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/filesystem/File.php b/filesystem/File.php index 6b66319ac..ff6d71b6b 100644 --- a/filesystem/File.php +++ b/filesystem/File.php @@ -634,7 +634,7 @@ class File extends DataObject { * * Does not change the filesystem itself, please use {@link write()} for this. * - * @param String $name + * @param string $name */ public function setName($name) { $oldName = $this->Name; @@ -663,7 +663,10 @@ class File extends DataObject { ))->first() ) { $suffix++; - $name = "$base-$suffix.$ext"; + $name = "$base-$suffix"; + if (!empty($ext)) { + $name .= ".$ext"; + } } } diff --git a/tests/filesystem/FileTest.php b/tests/filesystem/FileTest.php index b2ecf5e83..8e9fd0730 100644 --- a/tests/filesystem/FileTest.php +++ b/tests/filesystem/FileTest.php @@ -187,6 +187,30 @@ class FileTest extends SapphireTest { } } + /** + * Uses fixtures Folder.folder1 and File.setfromname + * @dataProvider setNameFileProvider + */ + public function testSetNameAddsUniqueSuffixWhenFilenameAlreadyExists($name, $expected) + { + $duplicate = new Folder; + $duplicate->setName($name); + $duplicate->write(); + + $this->assertSame($expected, $duplicate->Name); + } + + /** + * @return array[] + */ + public function setNameFileProvider() + { + return array( + array('FileTest-folder1', 'FileTest-folder1-2'), + array('FileTest.png', 'FileTest-2.png'), + ); + } + public function testLinkAndRelativeLink() { $file = $this->objFromFixture('File', 'asdf'); $this->assertEquals(ASSETS_DIR . '/FileTest.txt', $file->RelativeLink()); From c4a50a3d10bd52b982e6f4f0d0267c394f3351e6 Mon Sep 17 00:00:00 2001 From: Andrew Aitken-Fincham Date: Fri, 20 Oct 2017 12:00:35 +0100 Subject: [PATCH 04/20] Spelling in DataQueryTest --- tests/model/DataQueryTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/model/DataQueryTest.php b/tests/model/DataQueryTest.php index 181132e8e..ac8a3ef69 100644 --- a/tests/model/DataQueryTest.php +++ b/tests/model/DataQueryTest.php @@ -63,7 +63,7 @@ class DataQueryTest extends SapphireTest { $this->assertContains('"DataQueryTest_C"."ID" = "DataQueryTest_B"."TestCTwoID"', $dq->sql()); } - public function testApplyReplationDeepInheretence() { + public function testApplyRelationDeepInheritance() { //test has_one relation $newDQ = new DataQuery('DataQueryTest_E'); //apply a relation to a relation from an ancestor class From 8aad080516c4cf848fe4d8f6111f5304ed945e91 Mon Sep 17 00:00:00 2001 From: Daniel Hensby Date: Wed, 25 Oct 2017 17:04:44 +0100 Subject: [PATCH 05/20] Add composer autoloading support to 3.x --- composer.json | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index bdbd63c6c..0c3105f1e 100644 --- a/composer.json +++ b/composer.json @@ -29,6 +29,16 @@ } }, "autoload": { - "classmap": ["tests/behat/features/bootstrap"] + "psr-0": { + "SilverStripe\\": "src/", + "Zend_": "thirdparty/Zend/" + }, + "classmap": [ + "tests/behat/features/bootstrap", + "admin/code", "api", "cache", "cli", "control", "core", "dev", "email", "filesystem", + "forms", "i18n", "model", "oembed", "parsers", "search", "security", "tasks", "view", + "thirdparty/php-peg", "thirdparty/simpletest", "thirdparty/zend_translate_railsyaml" + ], + "exclude-from-classmap": ["view/SSTemplateParser.php.inc", "dev/phpunit/PhpUnitWrapper.php"] } } From 32cef975ef6c816d8b5bc953cffbd18492686281 Mon Sep 17 00:00:00 2001 From: Daniel Hensby Date: Wed, 25 Oct 2017 17:45:14 +0100 Subject: [PATCH 06/20] FIX Use self::inst() for Injector/Config nest methods --- control/injector/Injector.php | 2 +- core/Config.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/control/injector/Injector.php b/control/injector/Injector.php index c96ddb6f4..1c247b35e 100644 --- a/control/injector/Injector.php +++ b/control/injector/Injector.php @@ -260,7 +260,7 @@ class Injector { * @return Injector Reference to new active Injector instance */ public static function nest() { - $current = self::$instance; + $current = self::inst(); $new = clone $current; $new->nestedFrom = $current; diff --git a/core/Config.php b/core/Config.php index 414350995..9232f1ce8 100644 --- a/core/Config.php +++ b/core/Config.php @@ -223,7 +223,7 @@ class Config { * @return Config Reference to new active Config instance */ public static function nest() { - $current = self::$instance; + $current = self::inst(); $new = clone $current; $new->nestedFrom = $current; From cbac3755909bc5d72d923b07747fd6a98e2215dc Mon Sep 17 00:00:00 2001 From: Daniel Hensby Date: Wed, 25 Oct 2017 17:45:38 +0100 Subject: [PATCH 07/20] FIX Helpful warning when phpunit bootstrap appears misconfigured --- dev/SapphireTest.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dev/SapphireTest.php b/dev/SapphireTest.php index 21df46c13..951d619f1 100644 --- a/dev/SapphireTest.php +++ b/dev/SapphireTest.php @@ -171,6 +171,13 @@ class SapphireTest extends PHPUnit_Framework_TestCase { public function setUp() { + if (!defined('FRAMEWORK_PATH')) { + trigger_error( + 'Missing constants, did you remember to include the test bootstrap in your phpunit.xml file?', + E_USER_WARNING + ); + } + //nest config and injector for each test so they are effectively sandboxed per test Config::nest(); Injector::nest(); From 00f1ad5d692f0a44b58bb216e5378e51dc96243d Mon Sep 17 00:00:00 2001 From: Russell Michell Date: Tue, 4 Jul 2017 14:03:36 +1200 Subject: [PATCH 08/20] FIX: Fixes #7116 Improves server requirements docs viz: OpCaches. --- docs/en/00_Getting_Started/00_Server_Requirements.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/en/00_Getting_Started/00_Server_Requirements.md b/docs/en/00_Getting_Started/00_Server_Requirements.md index 24d162b22..cf0f85600 100644 --- a/docs/en/00_Getting_Started/00_Server_Requirements.md +++ b/docs/en/00_Getting_Started/00_Server_Requirements.md @@ -10,6 +10,7 @@ Our web-based [PHP installer](installation/) can check if you meet the requireme * PHP 5.3.3+, <7 * We recommend using a PHP accelerator or opcode cache, such as [xcache](http://xcache.lighttpd.net/) or [WinCache](http://www.iis.net/download/wincacheforphp). + * Note: Some PHP 5.5+ packages already have [Zend OpCache](http://php.net/manual/en/book.opcache.php) installed by default. If this is the case on your system, do not try and run additional opcaches alongside Zend OpCache without first disabling it, as it will likely have unexpected consequences. * Allocate at least 48MB of memory to each PHP process. (SilverStripe can be resource hungry for some intensive operations.) * Required modules: dom, gd2, fileinfo, hash, iconv, mbstring, mysqli (or other database driver), session, simplexml, tokenizer, xml. * Recommended configuration From dda14e89596a0de0b70eace27f7015bc0bb40669 Mon Sep 17 00:00:00 2001 From: Roman Schmid Date: Thu, 16 Nov 2017 11:07:20 +0100 Subject: [PATCH 09/20] Fix HTTP::get_mime_type with uppercase filenames. The fallback of `HTTP::get_mime_type` (that uses a lookup instead of `finfo`) doesn't ensure the extension is converted to lowercase before the lookup. A file named `Image.JPG` will return `'application/unknown'`. This change fixes this issue. --- control/HTTP.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/control/HTTP.php b/control/HTTP.php index 3b9cdf2e5..1f0d088c6 100644 --- a/control/HTTP.php +++ b/control/HTTP.php @@ -271,7 +271,7 @@ class HTTP { // Fallback to use the list from the HTTP.yml configuration and rely on the file extension // to get the file mime-type - $ext = File::get_file_extension($filename); + $ext = strtolower(File::get_file_extension($filename)); // Get the mime-types $mimeTypes = Config::inst()->get('HTTP', 'MimeTypes'); From 3d3096485b176c61bebf8e3f80dc99e2cfe9326d Mon Sep 17 00:00:00 2001 From: Daniel Hensby Date: Thu, 16 Nov 2017 11:00:35 +0000 Subject: [PATCH 10/20] TEST Uppercase file extensions return correct mime type --- tests/control/HTTPTest.php | 1 + tests/control/files/upperfile.JPG | Bin 0 -> 331 bytes 2 files changed, 1 insertion(+) create mode 100644 tests/control/files/upperfile.JPG diff --git a/tests/control/HTTPTest.php b/tests/control/HTTPTest.php index d15bc3655..b208f44ae 100644 --- a/tests/control/HTTPTest.php +++ b/tests/control/HTTPTest.php @@ -179,6 +179,7 @@ class HTTPTest extends FunctionalTest { $this->assertEquals('image/gif', HTTP::get_mime_type(FRAMEWORK_DIR.'/tests/control/files/file.gif')); $this->assertEquals('text/html', HTTP::get_mime_type(FRAMEWORK_DIR.'/tests/control/files/file.html')); $this->assertEquals('image/jpeg', HTTP::get_mime_type(FRAMEWORK_DIR.'/tests/control/files/file.jpg')); + $this->assertEquals('image/jpeg', HTTP::get_mime_type(FRAMEWORK_DIR.'/tests/control/files/upperfile.JPG')); $this->assertEquals('image/png', HTTP::get_mime_type(FRAMEWORK_DIR.'/tests/control/files/file.png')); $this->assertEquals('image/vnd.adobe.photoshop', HTTP::get_mime_type(FRAMEWORK_DIR.'/tests/control/files/file.psd')); diff --git a/tests/control/files/upperfile.JPG b/tests/control/files/upperfile.JPG new file mode 100644 index 0000000000000000000000000000000000000000..3aad05d8fadd75f8d9e02866f695b486f0b46343 GIT binary patch literal 331 zcmex=iF;o{=v;^GnD0RsUZK7IjyJ|1CV5fNcw z8EI*08F@HhWM^mR<>8eO5Ri}(6%>_%OAyQWe}F-dgF%IXk(p7Dfk}{&S&;Gn5r#;h zvzdX8L;}n#9E^ Date: Wed, 15 Nov 2017 19:04:45 -0800 Subject: [PATCH 11/20] FIX for #7606: Ensure the object we're handling is actually an Image instance before calling methods specific to that class (e.g. in case of using SVG's in tag which may be File instances). --- forms/HtmlEditorField.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/forms/HtmlEditorField.php b/forms/HtmlEditorField.php index e088b8401..a43b1cee4 100644 --- a/forms/HtmlEditorField.php +++ b/forms/HtmlEditorField.php @@ -87,13 +87,14 @@ class HtmlEditorField extends TextareaField { $img->setAttribute('src', preg_replace('/([^\?]*)\?r=[0-9]+$/i', '$1', $img->getAttribute('src'))); // Resample the images if the width & height have changed. - if($image = File::find(urldecode(Director::makeRelative($img->getAttribute('src'))))){ + $image = File::find(urldecode(Director::makeRelative($img->getAttribute('src')))); + if($image instanceof Image){ $width = (int)$img->getAttribute('width'); $height = (int)$img->getAttribute('height'); if($width && $height && ($width != $image->getWidth() || $height != $image->getHeight())) { //Make sure that the resized image actually returns an image: - $resized=$image->ResizedImage($width, $height); + $resized = $image->ResizedImage($width, $height); if($resized) $img->setAttribute('src', $resized->getRelativePath()); } } From 4f3deb13e00df74915ecae3f0d9e010708c5d244 Mon Sep 17 00:00:00 2001 From: Daniel Hensby Date: Thu, 16 Nov 2017 11:09:57 +0000 Subject: [PATCH 12/20] TEST filterAny on many_many relations return correct items --- tests/model/DataListTest.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/model/DataListTest.php b/tests/model/DataListTest.php index ffcc94d63..945c172d5 100755 --- a/tests/model/DataListTest.php +++ b/tests/model/DataListTest.php @@ -774,6 +774,15 @@ class DataListTest extends SapphireTest { $this->assertEquals(1, $list->count()); } + public function testFilterAnyWithRelation() { + $list = DataObjectTest_Player::get(); + $list = $list->filterAny(array( + 'Teams.Title:StartsWith' => 'Team', + 'ID:GreaterThan' => 0, + )); + $this->assertCount(4, $list); + } + public function testFilterAnyMultipleArray() { $list = DataObjectTest_TeamComment::get(); $list = $list->filterAny(array('Name'=>'Bob', 'Comment'=>'This is a team comment by Bob')); From ce3fd370fb07ffc18742323b0dd99f30cf28cf14 Mon Sep 17 00:00:00 2001 From: Daniel Hensby Date: Wed, 15 Nov 2017 17:34:41 +0000 Subject: [PATCH 13/20] FIX ManyMany link table joined with LEFT JOIN --- model/DataQuery.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/DataQuery.php b/model/DataQuery.php index 9ccb5912b..733576526 100644 --- a/model/DataQuery.php +++ b/model/DataQuery.php @@ -726,7 +726,7 @@ class DataQuery { list($parentClass, $componentClass, $parentField, $componentField, $relationTable) = $component; $parentBaseClass = ClassInfo::baseDataClass($parentClass); $componentBaseClass = ClassInfo::baseDataClass($componentClass); - $this->query->addInnerJoin($relationTable, + $this->query->addLeftJoin($relationTable, "\"$relationTable\".\"$parentField\" = \"$parentBaseClass\".\"ID\""); if (!$this->query->isJoinedTo($componentBaseClass)) { $this->query->addLeftJoin($componentBaseClass, From 36bb28a41dacd76c7737e239fda90038e11d72b8 Mon Sep 17 00:00:00 2001 From: Daniel Hensby Date: Fri, 17 Nov 2017 11:48:24 +0000 Subject: [PATCH 14/20] Loosen PHPUnit constraints --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 0c3105f1e..dbc389d59 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "mustangostang/spyc": "^0.6.2" }, "require-dev": { - "phpunit/PHPUnit": "~3.7" + "phpunit/phpunit": "^3 || ^4 || ^5" }, "extra": { "branch-alias": { From d39e9b0bb03b9014ef2cbfa3488e505faab6146f Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Mon, 20 Nov 2017 13:48:18 +1300 Subject: [PATCH 15/20] Make DataDifferencer injectable Requested by Steve Boyd --- model/Versioned.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/Versioned.php b/model/Versioned.php index 4dc191628..6c976007f 100644 --- a/model/Versioned.php +++ b/model/Versioned.php @@ -1100,7 +1100,7 @@ class Versioned extends DataExtension implements TemplateGlobalProvider { $fromRecord = Versioned::get_version($this->owner->class, $this->owner->ID, $from); $toRecord = Versioned::get_version($this->owner->class, $this->owner->ID, $to); - $diff = new DataDifferencer($fromRecord, $toRecord); + $diff = DataDifferencer::create($fromRecord, $toRecord); return $diff->diffedData(); } From a63bb12d92a2a3f23f711ba6ac99e684c4957ad5 Mon Sep 17 00:00:00 2001 From: Daniel Hensby Date: Wed, 22 Nov 2017 13:18:57 +0000 Subject: [PATCH 16/20] Travis retry on imagick install --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index b4aa49730..eeff7c468 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,8 +28,8 @@ matrix: before_script: - export CORE_RELEASE=$TRAVIS_BRANCH - - if ! [ $(phpenv version-name) = "5.3" ]; then printf "\n" | pecl install imagick; fi - - if [ $(phpenv version-name) = "5.3" ]; then printf "\n" | pecl install imagick-3.3.0; fi + - if ! [ $(phpenv version-name) = "5.3" ]; then printf "\n" | travis_retry pecl install imagick; fi + - if [ $(phpenv version-name) = "5.3" ]; then printf "\n" | travis_retry pecl install imagick-3.3.0; fi - composer self-update || true - phpenv rehash - phpenv config-rm xdebug.ini From ef6d86f2c695d319f9c07ccd9f4d93e83263e356 Mon Sep 17 00:00:00 2001 From: Daniel Hensby Date: Wed, 22 Nov 2017 16:34:42 +0000 Subject: [PATCH 17/20] FIX Allow lowercase and uppercase delcaration of legacy Int class --- _config/database.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/_config/database.yml b/_config/database.yml index 2bb8e1c85..313ea3113 100644 --- a/_config/database.yml +++ b/_config/database.yml @@ -22,5 +22,13 @@ Injector: type: prototype Int: class: DBInt + int: + class: DBInt + INT: + class: DBInt Float: class: DBFloat + float: + class: DBFloat + FLOAT: + class: DBFloat From 1053de7ec39d1a2ce6826ea2db8f55114755098d Mon Sep 17 00:00:00 2001 From: Damian Mooyman Date: Thu, 9 Nov 2017 14:15:32 +1300 Subject: [PATCH 18/20] BUG Don't redirect in force_redirect() in CLI Replaces #4025 --- control/Director.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/control/Director.php b/control/Director.php index 46565d7b5..1e8fd439b 100644 --- a/control/Director.php +++ b/control/Director.php @@ -810,9 +810,13 @@ class Director implements TemplateGlobalProvider { /** * Skip any further processing and immediately respond with a redirect to the passed URL. * - * @param string $destURL - The URL to redirect to + * @param string $destURL The URL to redirect to + * @return string URL redirected to if on CLI */ protected static function force_redirect($destURL) { + if (static::is_cli()) { + return $destURL; + } $response = new SS_HTTPResponse(); $response->redirect($destURL, 301); @@ -859,9 +863,6 @@ class Director implements TemplateGlobalProvider { $matched = false; if($patterns) { - // Calling from the command-line? - if(!isset($_SERVER['REQUEST_URI'])) return; - $relativeURL = self::makeRelative(Director::absoluteURL($_SERVER['REQUEST_URI'])); // protect portions of the site based on the pattern @@ -887,12 +888,7 @@ class Director implements TemplateGlobalProvider { $destURL = str_replace('http:', 'https:', Director::absoluteURL($url)); - // This coupling to SapphireTest is necessary to test the destination URL and to not interfere with tests - if(class_exists('SapphireTest', false) && SapphireTest::is_running_test()) { - return $destURL; - } else { - self::force_redirect($destURL); - } + return self::force_redirect($destURL); } else { return false; } From 09a003bc13390359fa717a4256f9278303d59544 Mon Sep 17 00:00:00 2001 From: Daniel Hensby Date: Fri, 24 Nov 2017 14:30:47 +0000 Subject: [PATCH 19/20] Fix deprecated usage of getMock in unit tests --- tests/core/manifest/ConfigManifestTest.php | 22 ++++++++-------------- tests/injector/InjectorTest.php | 2 +- tests/model/PaginatedListTest.php | 2 +- tests/parsers/ShortcodeParserTest.php | 4 +++- tests/view/SSViewerTest.php | 4 +++- 5 files changed, 16 insertions(+), 18 deletions(-) diff --git a/tests/core/manifest/ConfigManifestTest.php b/tests/core/manifest/ConfigManifestTest.php index 5b14df254..337894101 100644 --- a/tests/core/manifest/ConfigManifestTest.php +++ b/tests/core/manifest/ConfigManifestTest.php @@ -30,13 +30,10 @@ class ConfigManifestTest extends SapphireTest { * @return Zend_Cache_Core */ protected function getCacheMock() { - return $this->getMock( - 'Zend_Cache_Core', - array('load', 'save'), - array(), - '', - false - ); + return $this->getMockBuilder('Zend_Cache_Core') + ->setMethods(array('load', 'save')) + ->disableOriginalConstructor() + ->getMock(); } /** @@ -45,13 +42,10 @@ class ConfigManifestTest extends SapphireTest { * @return SS_ConfigManifest */ protected function getManifestMock($methods) { - return $this->getMock( - 'SS_ConfigManifest', - $methods, - array(), // no constructor arguments - '', // default - false // don't call the constructor - ); + return $this->getMockBuilder('SS_ConfigManifest') + ->setMethods($methods) + ->disableOriginalConstructor() + ->getMock(); } /** diff --git a/tests/injector/InjectorTest.php b/tests/injector/InjectorTest.php index de7173523..2fb577ef8 100644 --- a/tests/injector/InjectorTest.php +++ b/tests/injector/InjectorTest.php @@ -605,7 +605,7 @@ class InjectorTest extends SapphireTest { 'service' => array('factory' => 'factory', 'constructor' => array(1, 2, 3)) )); - $factory = $this->getMock('SilverStripe\\Framework\\Injector\\Factory'); + $factory = $this->getMockBuilder('SilverStripe\\Framework\\Injector\\Factory')->getMock(); $factory ->expects($this->once()) ->method('create') diff --git a/tests/model/PaginatedListTest.php b/tests/model/PaginatedListTest.php index 73dc5f879..3447467cc 100644 --- a/tests/model/PaginatedListTest.php +++ b/tests/model/PaginatedListTest.php @@ -43,7 +43,7 @@ class PaginatedListTest extends SapphireTest { } public function testSetPaginationFromQuery() { - $query = $this->getMock('SQLQuery'); + $query = $this->getMockBuilder('SQLQuery')->getMock(); $query->expects($this->once()) ->method('getLimit') ->will($this->returnValue(array('limit' => 15, 'start' => 30))); diff --git a/tests/parsers/ShortcodeParserTest.php b/tests/parsers/ShortcodeParserTest.php index 796d06478..06ec059a5 100644 --- a/tests/parsers/ShortcodeParserTest.php +++ b/tests/parsers/ShortcodeParserTest.php @@ -277,7 +277,9 @@ class ShortcodeParserTest extends SapphireTest { } public function testNoParseAttemptIfNoCode() { - $stub = $this->getMock('ShortcodeParser', array('replaceElementTagsWithMarkers')); + $stub = $this->getMockBuilder('ShortcodeParser') + ->setMethods(array('replaceElementTagsWithMarkers')) + ->getMock(); $stub->register('test', function() { return ''; }); diff --git a/tests/view/SSViewerTest.php b/tests/view/SSViewerTest.php index 440e3fdc0..5f7e0e337 100644 --- a/tests/view/SSViewerTest.php +++ b/tests/view/SSViewerTest.php @@ -138,7 +138,9 @@ class SSViewerTest extends SapphireTest { } public function testRequirements() { - $requirements = $this->getMock("Requirements_Backend", array("javascript", "css")); + $requirements = $this->getMockBuilder("Requirements_Backend") + ->setMethods(array("javascript", "css")) + ->getMock(); $jsFile = FRAMEWORK_DIR . '/tests/forms/a.js'; $cssFile = FRAMEWORK_DIR . '/tests/forms/a.js'; From 7b719d7b9d2a034f7396297fd98d85a89cfa4f72 Mon Sep 17 00:00:00 2001 From: Loz Calver Date: Fri, 24 Nov 2017 21:16:36 +0000 Subject: [PATCH 20/20] Specify Firefox 31 for Travis Behat builds --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index eeff7c468..3cb849f4a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,7 @@ addons: apt: packages: - tidy + firefox: "31.0" matrix: include: