You are here

public function CdnSettingsTest::testComplexDomainWithNegatedConditions in CDN 8.3

@covers ::getLookupTable

File

tests/src/Unit/CdnSettingsTest.php, line 308

Class

CdnSettingsTest
@coversDefaultClass \Drupal\cdn\CdnSettings @group cdn

Namespace

Drupal\Tests\cdn\Unit

Code

public function testComplexDomainWithNegatedConditions() {
  $this
    ->expectException(\AssertionError::class);
  $this
    ->expectExceptionMessage("The nested mapping 1 includes negated conditions, which is not allowed for complex mappings: the fallback_domain already serves this purpose.");
  $this
    ->createCdnSettings([
    'status' => TRUE,
    'mapping' => [
      'type' => 'complex',
      'fallback_domain' => 'cdn.example.com',
      'domains' => [
        0 => [
          'type' => 'simple',
          'domain' => 'foo.example.com',
          'conditions' => [
            'extensions' => [
              'png',
            ],
          ],
        ],
        1 => [
          'type' => 'simple',
          'domain' => 'bar.example.com',
          'conditions' => [
            'not' => [
              'extensions' => [
                'png',
              ],
            ],
          ],
        ],
      ],
    ],
  ])
    ->getLookupTable();
}