remove trailing .txt when getting the note
This commit is contained in:
parent
d258d96492
commit
961d780ed0
|
@ -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')
|
||||
));
|
||||
|
|
|
@ -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'];
|
||||
}
|
||||
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue