Fixes unit tests

This commit is contained in:
Samuel Georges 2015-07-25 11:49:26 +10:00
parent 4344a5a245
commit 04248c72ed
2 changed files with 21 additions and 12 deletions

View File

@ -127,19 +127,28 @@ class ControllerTest extends TestCase
protected function configAjaxRequestMock($handler, $partials = false)
{
$requestMock = $this->getMock('Illuminate\Http\Request', array('header'));
$requestMock = $this
->getMockBuilder('Illuminate\Http\Request')
->disableOriginalConstructor()
->setMethods(array('ajax', 'method', 'header'))
->getMock();
$requestMock->expects($this->at(0))
$map = array(
array('X_OCTOBER_REQUEST_HANDLER', null, $handler),
array('X_OCTOBER_REQUEST_PARTIALS', null, $partials),
);
$requestMock->expects($this->any())
->method('ajax')
->will($this->returnValue(true));
$requestMock->expects($this->any())
->method('method')
->will($this->returnValue('POST'));
$requestMock->expects($this->any())
->method('header')
->with($this->stringContains('X_OCTOBER_REQUEST_HANDLER'), $this->anything())
->will($this->returnValue($handler));
if ($partials !== false) {
$requestMock->expects($this->at(1))
->method('header')
->with($this->stringContains('X_OCTOBER_REQUEST_PARTIALS'), $this->anything())
->will($this->returnValue($partials));
}
->will($this->returnValueMap($map));
return $requestMock;
}

View File

@ -93,7 +93,7 @@ class VersionManagerTest extends TestCase
* Test empty file
*/
$result = self::callProtectedMethod($manager, 'getFileVersions', ['\October\\NoUpdates']);
$this->assertNull($result);
$this->assertEmpty($result);
}
public function testGetNewFileVersions()