Skip to content

Commit

Permalink
add unit test for otf file installation
Browse files Browse the repository at this point in the history
  • Loading branch information
madhusudhand committed Sep 28, 2023
1 parent d8c23e3 commit dc0d2f1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
Binary file added phpunit/tests/data/fonts/gilbert-color.otf
Binary file not shown.
28 changes: 28 additions & 0 deletions phpunit/tests/fonts/font-library/wpFontFamily/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ public function test_should_move_local_fontfaces( $font_data, array $files_data,
copy( __DIR__ . '/../../../data/fonts/cooper-hewitt.woff', $file['tmp_name'] );
} elseif ( 'font/woff2' === $file['type'] ) {
copy( __DIR__ . '/../../../data/fonts/DMSans.woff2', $file['tmp_name'] );
} elseif ( 'application/vnd.ms-opentype' === $file['type'] ) {
copy( __DIR__ . '/../../../data/fonts/gilbert-color.otf', $file['tmp_name'] );
}
}

Expand Down Expand Up @@ -302,6 +304,32 @@ public function data_should_move_local_fontfaces() {
),
'expected' => array( 'dm-sans_regular_500.woff2' ),
),
// otf font type.
'otf local font' => array(
'font_data' => array(
'name' => 'Gilbert Color',
'slug' => 'gilbert-color',
'fontFamily' => 'Gilbert Color',
'fontFace' => array(
array(
'fontFamily' => 'Gilbert Color',
'fontStyle' => 'regular',
'fontWeight' => '500',
'uploadedFile' => 'files0',
),
),
),
'files_data' => array(
'files0' => array(
'name' => 'gilbert-color.otf',
'type' => 'application/vnd.ms-opentype',
'tmp_name' => wp_tempnam( 'Gilbert-' ),
'error' => 0,
'size' => 123,
),
),
'expected' => array( 'gilbert-color_regular_500.otf' ),
),
);
}

Expand Down

0 comments on commit dc0d2f1

Please sign in to comment.