Output of the "Using an application constant as a service container parameter" Symfony snippet

Environment:

  • Strangebuzz Snippet VM: 2.2.1
  • PHP: 7.4
  • Symfony: 5.1.3

Code execution output:

article_types: 1,2
article_requirements: 1|2

 Back to the code  ≪ this.showUnitTest ? this.trans.hide_unit_test : this.trans.show_unit_test ≫  More on Stackoverflow   Read the doc  Random snippet

<?php declare(strict_types=1);

namespace App\Tests\Controller\Snippets;

use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;

/**
 * @covers Snippet49Trait
 */
final class Snippet49Test extends KernelTestCase
{
    protected function setUp(): void
    {
        self::bootKernel();
    }

    /**
     * @covers Snippet49Trait::snippet49
     */
    public function testSnippet49(): void
    {
        $articleTypes = self::$kernel->getContainer()->getParameter('article_types');
        $articleRequirements = self::$kernel->getContainer()->getParameter('article_requirements');
        self::assertSame('1,2', $articleTypes);
        self::assertSame('1|2', $articleRequirements);
    }
}