1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-02-19 20:00:20 +02:00
joplin/tests/Model/NoteTest.php
2017-01-10 18:06:08 +01:00

41 lines
909 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']);
}
}