function CDNOriginPullFarFutureTestCase::testUFIMapping in CDN 7.2
File
- tests/
cdn.test, line 398 - Test CDN.
Class
Code
function testUFIMapping() {
$default = CDN_BASIC_FARFUTURE_UNIQUE_IDENTIFIER_MAPPING_DEFAULT;
$parsed_mapping = _cdn_basic_farfuture_parse_raw_mapping($default);
$this
->assertUFIMapping(FALSE, $parsed_mapping, 'The default UFI mapping is set to sensible defaults.');
// Growing complexity for a single-directory UFI.
$this
->assertUFIMapping("sites/*|mtime", array(
'sites/*' => array(
'*' => array(
'ufi method' => 'mtime',
'specificity' => 20,
),
),
), 'Simple single-directory UFI mapping (step 1).');
$this
->assertUFIMethod('sites/foo', 'mtime');
$this
->assertUFIMapping("sites/*|mtime\nsites/*|.woff .ttf|md5_hash", array(
'sites/*' => array(
'*' => array(
'ufi method' => 'mtime',
'specificity' => 20,
),
'woff' => array(
'ufi method' => 'md5_hash',
'specificity' => 21,
),
'ttf' => array(
'ufi method' => 'md5_hash',
'specificity' => 21,
),
),
), 'Simple single-directory UFI mapping (step 2).');
$this
->assertUFIMethod('sites/foo', 'mtime');
$this
->assertUFIMethod('sites/foobambamb.woff', 'md5_hash');
$this
->assertUFIMethod('sites/foo/bar/baz.ttf', 'md5_hash');
$this
->assertUFIMapping("sites/*|mtime\nsites/*|.woff .ttf|md5_hash\nsites/*|.mov .mp4|perpetual", array(
'sites/*' => array(
'*' => array(
'ufi method' => 'mtime',
'specificity' => 20,
),
'woff' => array(
'ufi method' => 'md5_hash',
'specificity' => 21,
),
'ttf' => array(
'ufi method' => 'md5_hash',
'specificity' => 21,
),
'mov' => array(
'ufi method' => 'perpetual',
'specificity' => 21,
),
'mp4' => array(
'ufi method' => 'perpetual',
'specificity' => 21,
),
),
), 'Simple single-directory UFI mapping (step 2).');
$this
->assertUFIMethod('sites/foo', 'mtime');
$this
->assertUFIMethod('sites/foobambamb.woff', 'md5_hash');
$this
->assertUFIMethod('sites/foo/bar/baz.ttf', 'md5_hash');
$this
->assertUFIMethod('sites/movies/foo.mov', 'perpetual');
$this
->assertUFIMethod('sites/movies/bar.mp4', 'perpetual');
}