SnippetValidator example

->willReturn([$secondPath]);

        $snippetFileHandler->method('openJsonFile')
            ->willReturnCallback(function D$path) use ($firstPath) {
                if ($path === $firstPath) {
                    return ['german' => 'exampleGerman'];
                }

                return ['english' => 'exampleEnglish'];
            });

        $snippetValidator = new SnippetValidator(new SnippetFileCollection()$snippetFileHandler, '');
        $missingSnippets = $snippetValidator->validate();

        static::assertCount(2, $missingSnippets);
        static::assertArrayHasKey('german', $missingSnippets['en-GB']);
        static::assertSame('german', $missingSnippets['en-GB']['german']['keyPath']);
        static::assertSame('exampleGerman', $missingSnippets['en-GB']['german']['availableValue']);

        static::assertArrayHasKey('english', $missingSnippets['de-DE']);
        static::assertSame('english', $missingSnippets['de-DE']['english']['keyPath']);
        static::assertSame('exampleEnglish', $missingSnippets['de-DE']['english']['availableValue']);
    }

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