mirror of https://github.com/laurent22/joplin.git
tweaks
parent
9612327fb2
commit
7c43f38be5
|
@ -1,6 +1,7 @@
|
|||
#!/bin/bash
|
||||
# php phpunit-5.7.20.phar --bootstrap vendor/autoload.php tests/Model/
|
||||
# php phpunit-5.7.20.phar --filter testConflict ChangeTest tests/Model/ChangeTest.php --bootstrap vendor/autoload.php tests/Model/
|
||||
# php phpunit-5.7.20.phar --filter SynchronizerControllerTest tests/Controller/SynchronizerControllerTest.php --bootstrap vendor/autoload.php tests/Controller/
|
||||
|
||||
php phpunit-5.7.20.phar --bootstrap vendor/autoload.php tests/Controller/
|
||||
# Example to test just one method of a test unit:
|
||||
# php phpunit-5.7.20.phar --filter testConflict ChangeTest tests/Model/ChangeTest.php --bootstrap vendor/autoload.php tests/Model/
|
||||
|
||||
php5.6 phpunit-5.7.20.phar --bootstrap vendor/autoload.php tests/Controller/
|
||||
php5.6 phpunit-5.7.20.phar --bootstrap vendor/autoload.php tests/Model/
|
|
@ -42,6 +42,9 @@ class FoldersController extends ApiController {
|
|||
return static::successResponse($folder);
|
||||
}
|
||||
|
||||
$query = $request->query->all();
|
||||
if ($folder) $folder->revId = $query['rev_id'];
|
||||
|
||||
if ($request->isMethod('PUT')) {
|
||||
$isNew = !$folder;
|
||||
if ($isNew) $folder = new Folder();
|
||||
|
|
|
@ -38,6 +38,9 @@ class NotesController extends ApiController {
|
|||
return static::successResponse($note);
|
||||
}
|
||||
|
||||
$query = $request->query->all();
|
||||
if ($note) $note->revId = $query['rev_id'];
|
||||
|
||||
if ($request->isMethod('PUT')) {
|
||||
$isNew = !$note;
|
||||
if ($isNew) $note = new Note();
|
||||
|
@ -51,10 +54,6 @@ class NotesController extends ApiController {
|
|||
}
|
||||
|
||||
if ($request->isMethod('PATCH')) {
|
||||
$query = $request->query->all();
|
||||
|
||||
$note->id = Note::unhex($id);
|
||||
$note->revId = $query['rev_id'];
|
||||
$note->fromPublicArray($this->patchParameters());
|
||||
$note->save();
|
||||
return static::successResponse($note);
|
||||
|
|
|
@ -95,8 +95,8 @@ class SynchronizerControllerTest extends BaseControllerTestCase {
|
|||
$this->loadSession(1, 2);
|
||||
$syncResult2 = $this->request('GET', '/synchronizer', array('rev_id' => $client2_revId));
|
||||
|
||||
// In case of conflict, the string should be set to the last PATCH operation
|
||||
$this->assertEquals('YYYYYYYYYY', $syncResult1['items'][0]['item']['title']);
|
||||
// In case of conflict, the last non-conflicted version is returned
|
||||
$this->assertEquals('XXXXXXXXXX', $syncResult1['items'][0]['item']['title']);
|
||||
|
||||
// TODO: handle conflict
|
||||
}
|
||||
|
|
|
@ -196,7 +196,7 @@ class ChangeTest extends BaseTestCase {
|
|||
|
||||
$r = Change::changesDoneAfterId($this->userId(), $this->clientId(1), 0);
|
||||
|
||||
$this->assertCount(2, $r);
|
||||
$this->assertCount(3, $r);
|
||||
$this->assertFalse($r['has_more']);
|
||||
$this->assertCount(0, $r['items']); // Since client 1 is the one that made the changes, no sync data needs to be returned
|
||||
|
||||
|
|
Loading…
Reference in New Issue