public function testSavingFileContentWhenNotModified() { $fileContent = new FileContent(); $fileContent->content = 'testContent'; $file = new FileModel(); $file->fileContent = $fileContent; $file->name = 'aTestName'; $file->type = 'aTestType'; $file->size = 500; $saved = $file->save(); $this->assertTrue($saved); $fileId = $file->id; $file->forget(); //Now retrieve the file and make sure the content matches. $fileModel = FileModel::getById($fileId); $this->assertTrue($fileModel->save()); $file->forget(); $fileModel = FileModel::getById($fileId); $this->assertEquals('testContent', $file->fileContent->content); }