1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-27 10:32:58 +02:00
joplin/tests/Model/NoteTest.php
Laurent Cozic 8973668957 Clean up
2017-01-08 00:35:17 +01:00

42 lines
951 B
PHP
Executable File

<?php
require_once dirname(dirname(__FILE__)) . '/setup.php';
use AppBundle\Model\Note;
class NoteTest extends BaseTestCase {
public function setUp() {
parent::setUp();
}
public function testCanSaveAndLoad() {
$note = new Note();
$note->setDiffableField('title', 'the title');
$note->setDiffableField('body', 'the body');
$note->save();
$note = $note->find($note->id);
$this->assertNotNull($note);
$this->assertEquals('the title', $note->diffableField('title'));
$this->assertEquals('the body', $note->diffableField('body'));
}
public function testFromToPublicArray() {
$a = array(
'title' => 'the title',
'body' => 'the body',
);
$note = new Note();
$note->fromPublicArray($a);
$note->save();
$note = $note::find($note->id);
$b = $note->toPublicArray();
$this->assertEquals('the title', $b['title']);
$this->assertEquals('the body', $b['body']);
$this->assertArrayHasKey('rev_id', $b);
}
}