File attachments should support creation by string

Refs https://github.com/octobercms/docs/pull/227
This commit is contained in:
Samuel Georges 2017-02-28 17:15:25 +11:00
parent 19d2801c05
commit aa0fd163fd
1 changed files with 13 additions and 0 deletions

View File

@ -15,6 +15,19 @@ class AttachOneModelTest extends PluginTestCase
$this->runPluginRefreshCommand('Database.Tester');
}
public function testSetRelationValue()
{
Model::unguard();
$user = User::create(['name' => 'Stevie', 'email' => 'stevie@email.tld']);
Model::reguard();
// Set by string
$user->avatar = base_path().'/tests/fixtures/plugins/database/tester/assets/images/avatar.png';
$user->save();
$this->assertNotNull($user->avatar);
$this->assertEquals('avatar.png', $user->avatar->file_name);
}
public function testDeleteFlagDestroyRelationship()
{
Model::unguard();