Merge branch '3.5' into 3.6

This commit is contained in:
Daniel Hensby 2017-11-25 16:17:36 +00:00
commit badeb0cc8c
No known key found for this signature in database
GPG Key ID: B00D1E9767F0B06E
15 changed files with 45 additions and 39 deletions

View File

@ -8,6 +8,7 @@ addons:
apt:
packages:
- tidy
firefox: "31.0"
matrix:
include:
@ -32,8 +33,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

View File

@ -21,7 +21,7 @@
"mustangostang/spyc": "^0.6.2"
},
"require-dev": {
"phpunit/PHPUnit": "~3.7"
"phpunit/phpunit": "^3 || ^4 || ^5"
},
"extra": {
"branch-alias": {

View File

@ -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;
}

View File

@ -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');

View File

@ -93,13 +93,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());
}
}

View File

@ -47,7 +47,7 @@
// XMLHttpRequest
CurrentXhr: null,
onadd: function() {
onmatch: function() {
this.append(
'<span class="treedropdownfield-title"></span>' +
'<div class="treedropdownfield-toggle-panel-link"><a href="#" class="ui-icon ui-icon-triangle-1-s"></a></div>' +
@ -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');
}

View File

@ -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,

View File

@ -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'));

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 B

View File

@ -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();
}
/**

View File

@ -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')

View File

@ -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'));

View File

@ -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)));

View File

@ -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 '';
});

View File

@ -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';