diff --git a/src/Util/GNUsocialTestCase.php b/src/Util/GNUsocialTestCase.php new file mode 100644 index 0000000000..b76d418d84 --- /dev/null +++ b/src/Util/GNUsocialTestCase.php @@ -0,0 +1,55 @@ +. +// }}} + +/** + * String formatting utilities + * + * @package GNUsocial + * @category Util + * + * @author Hugo Sales + * @copyright 2020-2021 Free Software Foundation, Inc http://www.fsf.org + * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later + */ + +namespace App\Util; + +use App\Core\GNUsocial; +use Functional as F; +use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; + +class GNUsocialTestCase extends WebTestCase +{ + private static GNUsocial $social; + + /** + * Provide our own initialization for testing + */ + public static function bootKernel(array $options = []) + { + $kernel = parent::bootKernel($options); + $container = self::$kernel->getContainer()->get('test.service_container'); + $services = F\map( + (new \ReflectionClass(GNUsocial::class))->getMethod('__construct')->getParameters(), + function ($p) use ($container) { return $container->get((string) $p->getType()); } + ); + self::$social = new GNUsocial(...$services); + return $kernel; + } +}