mirror of https://github.com/laurent22/joplin.git
mod change
parent
4dfb8d0c39
commit
198fc4e85c
0
cli-client/test_11111111111111111111111111111111/folder1/my_note1.md
Normal file → Executable file
0
cli-client/test_11111111111111111111111111111111/folder1/my_note1.md
Normal file → Executable file
0
cli-client/test_11111111111111111111111111111111/folder2/my_note1.md
Normal file → Executable file
0
cli-client/test_11111111111111111111111111111111/folder2/my_note1.md
Normal file → Executable file
0
cli-client/test_11111111111111111111111111111111/folder2/my_note2.md
Normal file → Executable file
0
cli-client/test_11111111111111111111111111111111/folder2/my_note2.md
Normal file → Executable file
0
cli-client/test_11111111111111111111111111111111/folder2/sub/subnote.md
Normal file → Executable file
0
cli-client/test_11111111111111111111111111111111/folder2/sub/subnote.md
Normal file → Executable file
0
cli-client/test_22222222222222222222222222222222/folder1/my_note1.md
Normal file → Executable file
0
cli-client/test_22222222222222222222222222222222/folder1/my_note1.md
Normal file → Executable file
0
cli-client/test_22222222222222222222222222222222/folder2/my_note1.md
Normal file → Executable file
0
cli-client/test_22222222222222222222222222222222/folder2/my_note1.md
Normal file → Executable file
0
cli-client/test_22222222222222222222222222222222/folder2/my_note2.md
Normal file → Executable file
0
cli-client/test_22222222222222222222222222222222/folder2/my_note2.md
Normal file → Executable file
0
cli-client/test_22222222222222222222222222222222/folder2/sub/subnote.md
Normal file → Executable file
0
cli-client/test_22222222222222222222222222222222/folder2/sub/subnote.md
Normal file → Executable file
|
@ -1,11 +0,0 @@
|
|||
{
|
||||
"folders":
|
||||
[
|
||||
{
|
||||
"path": ".",
|
||||
"folder_exclude_patterns": [
|
||||
"var"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -16,10 +16,6 @@ class ChangeTest extends BaseTestCase {
|
|||
Note::truncate();
|
||||
}
|
||||
|
||||
public function tearDown() {
|
||||
|
||||
}
|
||||
|
||||
public function testDiff() {
|
||||
$text1 = 'abcd efgh ijkl';
|
||||
|
||||
|
@ -168,4 +164,50 @@ class ChangeTest extends BaseTestCase {
|
|||
$this->assertCount(1, $r['items']);
|
||||
}
|
||||
|
||||
public function testMultiClients() {
|
||||
// Simulates synchronization with multiple clients:
|
||||
// - One client creates two notes.
|
||||
// - Another client (but same user) creates three notes.
|
||||
// - Check that sets of notes is the same for both clients.
|
||||
|
||||
$clientNotes = array(1 => array(), 2 => array());
|
||||
|
||||
for ($clientId = 1; $clientId <= 2; $clientId++) {
|
||||
BaseModel::setClientId($this->clientId($clientId));
|
||||
|
||||
$noteCount = $clientId == 1 ? 2 : 3;
|
||||
for ($i = 1; $i <= $noteCount; $i++) {
|
||||
$n = new Note();
|
||||
$n->fromPublicArray(array('body' => 'note C' . $clientId . ' - ' . $i));
|
||||
$n->owner_id = $this->userId();
|
||||
$n->save();
|
||||
|
||||
$clientNotes[$clientId][] = $n->toPublicArray();
|
||||
}
|
||||
}
|
||||
|
||||
for ($clientId = 1; $clientId <= 2; $clientId++) {
|
||||
$r = Change::changesDoneAfterId($this->userId(), $this->clientId($clientId), 0);
|
||||
$this->assertCount($clientId == 1 ? 3 : 2, $r['items']);
|
||||
|
||||
foreach ($r['items'] as $item) {
|
||||
$item = $item->toPublicArray();
|
||||
$this->assertEquals('create', $item['type']);
|
||||
|
||||
$n = Note::find(BaseModel::unhex($item['item_id']));
|
||||
$clientNotes[$clientId][] = $n->toPublicArray();
|
||||
}
|
||||
}
|
||||
|
||||
$this->assertEquals(count($clientNotes[1]), count($clientNotes[2]));
|
||||
|
||||
foreach ($clientNotes[1] as $n1) {
|
||||
$foundCount = 0;
|
||||
foreach ($clientNotes[2] as $n2) {
|
||||
if ($n1['body'] === $n2['body']) $foundCount++;
|
||||
}
|
||||
$this->assertEquals(1, $foundCount);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.4 KiB |
Loading…
Reference in New Issue