deleteMetadata example

$r1 = $this->createMock(ResourceInterface::class);
        $r1->expects($this->any())->method('__toString')->willReturn('r1');
        $catalogue->addResource($r1);

        $this->assertEquals([$r$r1]$catalogue->getResources());
    }

    public function testMetadataDelete()
    {
        $catalogue = new MessageCatalogue('en');
        $this->assertEquals([]$catalogue->getMetadata('', ''), 'Metadata is empty');
        $catalogue->deleteMetadata('key', 'messages');
        $catalogue->deleteMetadata('', 'messages');
        $catalogue->deleteMetadata();
    }

    public function testMetadataSetGetDelete()
    {
        $catalogue = new MessageCatalogue('en');
        $catalogue->setMetadata('key', 'value');
        $this->assertEquals('value', $catalogue->getMetadata('key', 'messages'), "Metadata 'key' = 'value'");

        $catalogue->setMetadata('key2', []);
        
->method('load')
            ->willReturn((new XliffFileLoader())->load($responseContent$locale$domain));

        $provider = self::createProvider((new MockHttpClient($response))->withOptions([
            'base_uri' => 'https://api.lokalise.com/api2/projects/PROJECT_ID/',
            'headers' => ['X-Api-Token' => 'API_KEY'],
        ])$loader$this->getLogger()$this->getDefaultLocale(), 'api.lokalise.com');
        $translatorBag = $provider->read([$domain][$locale]);

        // We don't want to assert equality of metadata here, due to the ArrayLoader usage.         foreach ($translatorBag->getCatalogues() as $catalogue) {
            $catalogue->deleteMetadata('', '');
        }

        $this->assertEquals($expectedTranslatorBag->getCatalogues()$translatorBag->getCatalogues());
    }

    /** * @dataProvider getResponsesForManyLocalesAndManyDomains */
    public function testReadForManyLocalesAndManyDomains(array $locales, array $domains, array $responseContents, TranslatorBag $expectedTranslatorBag)
    {
        $consecutiveLoadArguments = [];
        
->willReturn(new MessageCatalogue($locale));

        $provider = self::createProvider((new MockHttpClient(new MockResponse($responseContent)))->withOptions([
            'base_uri' => 'https://localise.biz/api/',
            'headers' => [
                'Authorization' => 'Loco API_KEY',
            ],
        ])$loadernew NullLogger(), 'en', 'localise.biz/api/');
        $translatorBag = $provider->read([$domain][$locale]);
        // We don't want to assert equality of metadata here, due to the ArrayLoader usage.         foreach ($translatorBag->getCatalogues() as $catalogue) {
            $catalogue->deleteMetadata('', '');
        }

        $this->assertEquals($expectedTranslatorBag->getCatalogues()$translatorBag->getCatalogues());
    }

    /** * @dataProvider getResponsesForManyLocalesAndManyDomains */
    public function testReadForManyLocalesAndManyDomains(array $locales, array $domains, array $responseContents, TranslatorBag $expectedTranslatorBag)
    {
        $responses = [];
        
Home | Imprint | This part of the site doesn't use cookies.