fix test
This commit is contained in:
parent
7e01f32c27
commit
7ba715d144
|
@ -103,7 +103,6 @@ class UserGlobalStoragesController extends StoragesController {
|
||||||
* @param int $id storage id
|
* @param int $id storage id
|
||||||
* @return DataResponse
|
* @return DataResponse
|
||||||
*
|
*
|
||||||
* @NoCSRFRequired
|
|
||||||
* @NoAdminRequired
|
* @NoAdminRequired
|
||||||
*/
|
*/
|
||||||
public function show($id) {
|
public function show($id) {
|
||||||
|
|
|
@ -53,6 +53,7 @@ class UserStoragesController extends StoragesController {
|
||||||
* @param IRequest $request request object
|
* @param IRequest $request request object
|
||||||
* @param IL10N $l10n l10n service
|
* @param IL10N $l10n l10n service
|
||||||
* @param UserStoragesService $userStoragesService storage service
|
* @param UserStoragesService $userStoragesService storage service
|
||||||
|
* @param IUserSession $userSession
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
$AppName,
|
$AppName,
|
||||||
|
|
|
@ -48,7 +48,8 @@ class UserStoragesControllerTest extends StoragesControllerTest {
|
||||||
'files_external',
|
'files_external',
|
||||||
$this->getMock('\OCP\IRequest'),
|
$this->getMock('\OCP\IRequest'),
|
||||||
$this->getMock('\OCP\IL10N'),
|
$this->getMock('\OCP\IL10N'),
|
||||||
$this->service
|
$this->service,
|
||||||
|
$this->getMock('\OCP\IUserSession')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,8 @@ class Connection extends \Test\TestCase {
|
||||||
$this->connection->setValues('table', [
|
$this->connection->setValues('table', [
|
||||||
'integerfield' => 1
|
'integerfield' => 1
|
||||||
], [
|
], [
|
||||||
'textfield' => 'foo'
|
'textfield' => 'foo',
|
||||||
|
'clobfield' => 'not_null'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->assertEquals('foo', $this->getTextValueByIntergerField(1));
|
$this->assertEquals('foo', $this->getTextValueByIntergerField(1));
|
||||||
|
@ -118,7 +119,8 @@ class Connection extends \Test\TestCase {
|
||||||
$this->connection->setValues('table', [
|
$this->connection->setValues('table', [
|
||||||
'integerfield' => 1
|
'integerfield' => 1
|
||||||
], [
|
], [
|
||||||
'textfield' => 'foo'
|
'textfield' => 'foo',
|
||||||
|
'clobfield' => 'not_null'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->connection->setValues('table', [
|
$this->connection->setValues('table', [
|
||||||
|
@ -138,7 +140,8 @@ class Connection extends \Test\TestCase {
|
||||||
'integerfield' => 1
|
'integerfield' => 1
|
||||||
], [
|
], [
|
||||||
'textfield' => 'foo',
|
'textfield' => 'foo',
|
||||||
'booleanfield' => true
|
'booleanfield' => true,
|
||||||
|
'clobfield' => 'not_null'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->connection->setValues('table', [
|
$this->connection->setValues('table', [
|
||||||
|
@ -163,7 +166,8 @@ class Connection extends \Test\TestCase {
|
||||||
'integerfield' => 1
|
'integerfield' => 1
|
||||||
], [
|
], [
|
||||||
'textfield' => 'foo',
|
'textfield' => 'foo',
|
||||||
'booleanfield' => true
|
'booleanfield' => true,
|
||||||
|
'clobfield' => 'not_null'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->connection->setValues('table', [
|
$this->connection->setValues('table', [
|
||||||
|
|
|
@ -43,6 +43,18 @@ class CredentialsManagerTest extends \Test\TestCase {
|
||||||
$this->manager = new CredentialsManager($this->crypto, $this->dbConnection);
|
$this->manager = new CredentialsManager($this->crypto, $this->dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getQeuryResult($row) {
|
||||||
|
$result = $this->getMockBuilder('\Doctrine\DBAL\Driver\Statement')
|
||||||
|
->disableOriginalConstructor()
|
||||||
|
->getMock();
|
||||||
|
|
||||||
|
$result->expects($this->any())
|
||||||
|
->method('fetch')
|
||||||
|
->will($this->returnValue($row));
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
public function testStore() {
|
public function testStore() {
|
||||||
$userId = 'abc';
|
$userId = 'abc';
|
||||||
$identifier = 'foo';
|
$identifier = 'foo';
|
||||||
|
@ -78,7 +90,7 @@ class CredentialsManagerTest extends \Test\TestCase {
|
||||||
->getMock();
|
->getMock();
|
||||||
$qb->expects($this->once())
|
$qb->expects($this->once())
|
||||||
->method('execute')
|
->method('execute')
|
||||||
->willReturn(['credentials' => 'baz']);
|
->willReturn($this->getQeuryResult(['credentials' => 'baz']));
|
||||||
|
|
||||||
$this->dbConnection->expects($this->once())
|
$this->dbConnection->expects($this->once())
|
||||||
->method('getQueryBuilder')
|
->method('getQueryBuilder')
|
||||||
|
|
Loading…
Reference in New Issue