mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Fix deprecated usage of getMock in unit tests
This commit is contained in:
parent
79bba8bfd1
commit
09a003bc13
@ -30,13 +30,10 @@ class ConfigManifestTest extends SapphireTest {
|
|||||||
* @return Zend_Cache_Core
|
* @return Zend_Cache_Core
|
||||||
*/
|
*/
|
||||||
protected function getCacheMock() {
|
protected function getCacheMock() {
|
||||||
return $this->getMock(
|
return $this->getMockBuilder('Zend_Cache_Core')
|
||||||
'Zend_Cache_Core',
|
->setMethods(array('load', 'save'))
|
||||||
array('load', 'save'),
|
->disableOriginalConstructor()
|
||||||
array(),
|
->getMock();
|
||||||
'',
|
|
||||||
false
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -45,13 +42,10 @@ class ConfigManifestTest extends SapphireTest {
|
|||||||
* @return SS_ConfigManifest
|
* @return SS_ConfigManifest
|
||||||
*/
|
*/
|
||||||
protected function getManifestMock($methods) {
|
protected function getManifestMock($methods) {
|
||||||
return $this->getMock(
|
return $this->getMockBuilder('SS_ConfigManifest')
|
||||||
'SS_ConfigManifest',
|
->setMethods($methods)
|
||||||
$methods,
|
->disableOriginalConstructor()
|
||||||
array(), // no constructor arguments
|
->getMock();
|
||||||
'', // default
|
|
||||||
false // don't call the constructor
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -605,7 +605,7 @@ class InjectorTest extends SapphireTest {
|
|||||||
'service' => array('factory' => 'factory', 'constructor' => array(1, 2, 3))
|
'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
|
$factory
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('create')
|
->method('create')
|
||||||
|
@ -43,7 +43,7 @@ class PaginatedListTest extends SapphireTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function testSetPaginationFromQuery() {
|
public function testSetPaginationFromQuery() {
|
||||||
$query = $this->getMock('SQLQuery');
|
$query = $this->getMockBuilder('SQLQuery')->getMock();
|
||||||
$query->expects($this->once())
|
$query->expects($this->once())
|
||||||
->method('getLimit')
|
->method('getLimit')
|
||||||
->will($this->returnValue(array('limit' => 15, 'start' => 30)));
|
->will($this->returnValue(array('limit' => 15, 'start' => 30)));
|
||||||
|
@ -277,7 +277,9 @@ class ShortcodeParserTest extends SapphireTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function testNoParseAttemptIfNoCode() {
|
public function testNoParseAttemptIfNoCode() {
|
||||||
$stub = $this->getMock('ShortcodeParser', array('replaceElementTagsWithMarkers'));
|
$stub = $this->getMockBuilder('ShortcodeParser')
|
||||||
|
->setMethods(array('replaceElementTagsWithMarkers'))
|
||||||
|
->getMock();
|
||||||
$stub->register('test', function() {
|
$stub->register('test', function() {
|
||||||
return '';
|
return '';
|
||||||
});
|
});
|
||||||
|
@ -138,7 +138,9 @@ class SSViewerTest extends SapphireTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function testRequirements() {
|
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';
|
$jsFile = FRAMEWORK_DIR . '/tests/forms/a.js';
|
||||||
$cssFile = FRAMEWORK_DIR . '/tests/forms/a.js';
|
$cssFile = FRAMEWORK_DIR . '/tests/forms/a.js';
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user