[TESTS] Add a sample image to the test dataset
This commit is contained in:
parent
647e4c03b3
commit
29d77b446f
|
@ -2,15 +2,19 @@
|
|||
|
||||
namespace App\DataFixtures;
|
||||
|
||||
use App\Core\DB\DB;
|
||||
use App\Core\GSFile;
|
||||
use App\Core\VisibilityScope;
|
||||
use App\Entity\GroupInbox;
|
||||
use App\Entity\GSActor;
|
||||
use App\Entity\LocalGroup;
|
||||
use App\Entity\LocalUser;
|
||||
use App\Entity\Note;
|
||||
use App\Util\Common;
|
||||
use App\Util\Nickname;
|
||||
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
use Symfony\Component\HttpFoundation\File\File;
|
||||
|
||||
class CoreFixtures extends Fixture
|
||||
{
|
||||
|
@ -39,5 +43,13 @@ class CoreFixtures extends Fixture
|
|||
|
||||
$manager->persist(GroupInbox::create(['group_id' => $local_entities['taken_group']->getGroupId(), 'activity_id' => $note->getId()]));
|
||||
$manager->flush();
|
||||
|
||||
DB::setManager($manager);
|
||||
$filepath = INSTALLDIR . '/tests/Media/sample-uploads/image.jpeg';
|
||||
$copy_filepath = $filepath . '.copy';
|
||||
copy($filepath, $copy_filepath);
|
||||
$file = new File($copy_filepath, checkPath: true);
|
||||
GSFile::validateAndStoreFileAsAttachment($file, dest_dir: Common::config('attachments', 'dir') . 'test/', title: '1x1 JPEG image title', actor_id: $actors['taken_user']->getId());
|
||||
$manager->flush();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user