<?php

/*
 * This file is part of MediaVorus.
 *
 * (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace MediaVorus;

use Symfony\Component\Mime\MimeTypes;
use MediaVorus\Utils\RawImageMimeTypeGuesser;
use MediaVorus\Utils\PostScriptMimeTypeGuesser;
use MediaVorus\Utils\AudioMimeTypeGuesser;
use MediaVorus\Utils\VideoMimeTypeGuesser;
use PHPUnit\Framework\TestCase as BaseTestCase;

class TestCase extends BaseTestCase
{
    public static $registered = false;

    public function setUp(): void
    {
        if (! static::$registered) {
            $customGuessers = [
                new RawImageMimeTypeGuesser(),
                new PostScriptMimeTypeGuesser(),
                new AudioMimeTypeGuesser(),
                new VideoMimeTypeGuesser(),
            ];

            $mimeTypes = new MimeTypes();

            foreach ($customGuessers as $guesser) {
                $mimeTypes->registerGuesser($guesser);
            }

            MimeTypes::setDefault($mimeTypes);
            static::$registered = true;
        }
    }
}
