remove trailing .txt when getting the note

This commit is contained in:
Bernhard Posselt 2013-04-03 17:55:48 +02:00
parent d258d96492
commit 961d780ed0
3 changed files with 3 additions and 3 deletions

View File

@ -44,7 +44,7 @@ class NotesBusinessLayer {
$note = new Note();
$note->fromFile(array(
'name' => $title,
'name' => $title . '.txt',
'content' => $this->fileSystem->file_get_contents('/' . $title . '.txt'),
'mtime' => $this->fileSystem->filemtime('/' . $title . '.txt')
));

View File

@ -16,7 +16,7 @@ class Note {
public function fromFile($file){
$this->modified = (int) $file['mtime'];
$this->title = $file['name'];
$this->title = substr($file['name'], 0, -4); // remove trailing .txt
$this->content = $file['content'];
}

View File

@ -30,7 +30,7 @@ class NoteTest extends TestUtility {
$note->fromFile($file);
$this->assertEquals($file['mtime'], $note->getModified());
$this->assertEquals($file['name'], $note->getTitle());
$this->assertEquals('hi', $note->getTitle());
$this->assertEquals($file['content'], $note->getContent());
}