SnippetFinder example

use Shopware\Core\Kernel;

/** * @internal * * @covers \Shopware\Administration\Snippet\SnippetFinder */
class SnippetFinderTest extends TestCase
{
    public function testFindSnippetsFromAppNoSnippetsAdded(): void
    {
        $snippetFinder = new SnippetFinder(
            $this->getKernelWithNoPlugins(),
            $this->getConnectionMock('en-GB', [])
        );

        $snippets = $snippetFinder->findSnippets('en-GB');
        static::assertArrayNotHasKey('my-custom-snippet-key', $snippets);
    }

    public function testFindSnippetsFromApp(): void
    {
        $snippetFinder = new SnippetFinder(
            
/** * @internal */
class SnippetFinderTest extends TestCase
{
    use IntegrationTestBehaviour;

    private SnippetFinder $snippetFinder;

    protected function setUp(): void
    {
        $this->snippetFinder = new SnippetFinder(
            $this->getKernel(),
            $this->getContainer()->get(Connection::class)
        );
    }

    public function testGetPluginPath(): void
    {
        $kernelMock = $this->createMock(Kernel::class);

        $loader = $this->createMock(ClassLoader::class);
        $loader->method('findFile')->willReturn(__DIR__);

        
Home | Imprint | This part of the site doesn't use cookies.