public function testCreateDocument()
 {
     $document = new Document(['title' => 'Doc 4']);
     $document->setScenario('insert');
     $this->assertTrue($document->save());
     $path = $document->getUploadPath('file');
     $this->assertTrue(is_file($path));
     $this->assertEquals(sha1_file($path), sha1_file(__DIR__ . '/data/test-file.txt'));
 }
 public function testSetInstanceManual()
 {
     $document = new Document(['title' => 'Doc 4']);
     $document->file = UploadedFile::getInstanceByName('Document[file-other]');
     $document->setScenario('insert');
     $this->assertTrue($document->save());
     $path = $document->getUploadPath('file');
     $this->assertTrue(is_file($path));
     $this->assertEquals(sha1_file($path), sha1_file(__DIR__ . '/data/test-file-other.txt'));
 }