1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

mod change

This commit is contained in:
Laurent Cozic 2016-12-10 22:35:53 +00:00
parent 4dfb8d0c39
commit 198fc4e85c
74 changed files with 46 additions and 15 deletions

0
.gitignore vendored Normal file → Executable file
View File

0
README.md Normal file → Executable file
View File

0
app/.htaccess Normal file → Executable file
View File

0
app/AppCache.php Normal file → Executable file
View File

0
app/AppKernel.php Normal file → Executable file
View File

0
app/Resources/views/base.html.twig Normal file → Executable file
View File

0
app/Resources/views/default/index.html.twig Normal file → Executable file
View File

0
app/autoload.php Normal file → Executable file
View File

0
app/config/config.yml Normal file → Executable file
View File

0
app/config/config_dev.yml Normal file → Executable file
View File

0
app/config/config_prod.yml Normal file → Executable file
View File

0
app/config/config_test.yml Normal file → Executable file
View File

0
app/config/parameters.yml.dist Normal file → Executable file
View File

0
app/config/routing.yml Normal file → Executable file
View File

0
app/config/routing_dev.yml Normal file → Executable file
View File

0
app/config/security.yml Normal file → Executable file
View File

0
app/config/services.yml Normal file → Executable file
View File

0
cli-client/.config1/config.json Normal file → Executable file
View File

0
cli-client/.config2/config.json Normal file → Executable file
View File

0
cli-client/main.go Normal file → Executable file
View File

0
cli-client/main.php Normal file → Executable file
View File

View File

View File

View File

View File

View File

View File

0
composer.json Normal file → Executable file
View File

0
composer.lock generated Normal file → Executable file
View File

View File

@ -1,11 +0,0 @@
{
"folders":
[
{
"path": ".",
"folder_exclude_patterns": [
"var"
]
}
]
}

0
phpunit.xml.dist Normal file → Executable file
View File

0
src/.htaccess Normal file → Executable file
View File

0
src/AppBundle/AppBundle.php Normal file → Executable file
View File

0
src/AppBundle/Controller/ApiController.php Normal file → Executable file
View File

0
src/AppBundle/Controller/FoldersController.php Normal file → Executable file
View File

0
src/AppBundle/Controller/NotesController.php Normal file → Executable file
View File

0
src/AppBundle/Controller/SessionsController.php Normal file → Executable file
View File

0
src/AppBundle/Controller/SynchronizerController.php Normal file → Executable file
View File

0
src/AppBundle/Controller/UsersController.php Normal file → Executable file
View File

0
src/AppBundle/Diff.php Normal file → Executable file
View File

0
src/AppBundle/Eloquent.php Normal file → Executable file
View File

0
src/AppBundle/Exception/AuthException.php Normal file → Executable file
View File

0
src/AppBundle/Exception/BaseException.php Normal file → Executable file
View File

0
src/AppBundle/Exception/ForbiddenException.php Normal file → Executable file
View File

0
src/AppBundle/Exception/MethodNotAllowedException.php Normal file → Executable file
View File

0
src/AppBundle/Exception/NotFoundException.php Normal file → Executable file
View File

0
src/AppBundle/Exception/UnauthorizedException.php Normal file → Executable file
View File

0
src/AppBundle/Exception/ValidationException.php Normal file → Executable file
View File

0
src/AppBundle/Model/Action.php Normal file → Executable file
View File

0
src/AppBundle/Model/BaseModel.php Normal file → Executable file
View File

0
src/AppBundle/Model/Change.php Normal file → Executable file
View File

0
src/AppBundle/Model/Folder.php Normal file → Executable file
View File

0
src/AppBundle/Model/FolderItem.php Normal file → Executable file
View File

0
src/AppBundle/Model/Note.php Normal file → Executable file
View File

0
src/AppBundle/Model/Session.php Normal file → Executable file
View File

0
src/AppBundle/Model/User.php Normal file → Executable file
View File

0
structure.sql Normal file → Executable file
View File

0
tests/BaseTestCase.php Normal file → Executable file
View File

50
tests/Model/ChangeTest.php Normal file → Executable file
View File

@ -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);
}
}
}

0
tests/Model/NoteTest.php Normal file → Executable file
View File

0
tests/setup.php Normal file → Executable file
View File

0
var/SymfonyRequirements.php Normal file → Executable file
View File

0
var/cache/.gitkeep vendored Normal file → Executable file
View File

0
var/logs/.gitkeep Normal file → Executable file
View File

0
var/sessions/.gitkeep Normal file → Executable file
View File

0
web/.htaccess Normal file → Executable file
View File

0
web/app.php Normal file → Executable file
View File

0
web/app_dev.php Normal file → Executable file
View File

0
web/apple-touch-icon.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

0
web/config.php Normal file → Executable file
View File

0
web/favicon.ico Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

0
web/robots.txt Normal file → Executable file
View File