/** @test */ function it_fails_to_load_other_types() { $media = $this->getNewMedia(['extension' => 'jpg', 'mimetype' => 'image/jpeg', 'size' => 1000, 'name' => 'test', 'path' => 'root/test.jpg']); $this->assertEquals($media->getKey(), Image::find($media->getKey())->getKey()); $this->assertEquals($media->getKey(), Media::find($media->getKey())->getKey()); $this->assertNull(Audio::find($media->getKey())); }
/** @test */ function it_adds_child_media() { $image = Image::create(['extension' => 'jpg', 'mimetype' => 'image/jpeg', 'size' => 1000, 'name' => 'test', 'path' => 'root/test.jpg']); $media = Media::create(['extension' => 'tst', 'mimetype' => 'test/testy', 'size' => 1000, 'name' => 'test', 'path' => 'root/test.tst']); $directory = Directory::create(['name' => 'parent']); $directory->contain($image); $directory->contain($media); $this->assertNotNull($directory->getContainedMedia()->find($image->getKey())); $this->assertNotNull($directory->getContainedMedia()->find($media->getKey())); }