/** * @covers \Pressbooks\Shortcodes\Footnotes\Footnotes::convertWordFootnotes */ public function test_convertWordFootnotes() { $this->_fakeAjax(); // Test invalid permissions ob_start(); \Pressbooks\Shortcodes\Footnotes\Footnotes::convertWordFootnotes(); $buffer = ob_get_clean(); $this->assertContains(__('Invalid permissions.', 'pressbooks'), $buffer); // Test is json $user_id = $this->factory->user->create(array('role' => 'administrator')); wp_set_current_user($user_id); $_REQUEST['_ajax_nonce'] = wp_create_nonce('pb-footnote-convert'); $_POST['content'] = 'Hello world!'; ob_start(); \Pressbooks\Shortcodes\Footnotes\Footnotes::convertWordFootnotes(); $buffer = ob_get_clean(); $this->assertJson($buffer); // TODO: Test regular expressions by passing Word and LibreOffice footnote HTML }