/** * @covers \PressBooks\GlobalTypography::fixWebFonts */ public function test_fixWebFonts() { $css = '@font-face { font-family: "Bergamot Ornaments"; src: url(themes-book/pressbooks-book/fonts/Bergamot-Ornaments.ttf) format("truetype"); font-weight: normal; font-style: normal; }'; $css = $this->gt->fixWebFonts($css); $this->assertContains('url(' . PB_PLUGIN_URL . 'themes-book/pressbooks-book/fonts/Bergamot-Ornaments.ttf', $css); $css = 'url(themes-book/pressbooks-book/fonts/foo.garbage)'; $css = $this->gt->fixWebFonts($css); $this->assertNotContains('url(' . PB_PLUGIN_URL . 'themes-book/pressbooks-book/fonts/foo.garbage', $css); }
/** * @covers \Pressbooks\GlobalTypography::getFonts */ public function test_getFonts() { $result = $this->gt->getFonts(array('ko')); $this->assertTrue($result); $this->assertFileExists(WP_CONTENT_DIR . '/uploads/assets/fonts/NotoSansCJKkr-Regular.otf'); $this->assertFileExists(WP_CONTENT_DIR . '/uploads/assets/fonts/NotoSansCJKkr-Bold.otf'); }