Skip to content

Commit

Permalink
add markdownify and basic unit tests for YAML and Markdown output
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Kadis committed Dec 21, 2016
1 parent 66c35ae commit a432b13
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "Markdownify"]
path = Markdownify
url = [email protected]:Elephant418/Markdownify.git
1 change: 1 addition & 0 deletions Markdownify
Submodule Markdownify added at 016067
4 changes: 4 additions & 0 deletions command.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<?php

require_once( dirname( __FILE__ ) . '/Markdownify/src/Parser.php' );
require_once( dirname( __FILE__ ) . '/Markdownify/src/Converter.php' );
require_once( dirname( __FILE__ ) . '/Markdownify/src/ConverterExtra.php' );

if ( ! class_exists( 'WP_CLI' ) ) {
return;
}
Expand Down
18 changes: 18 additions & 0 deletions tests/test-dependencies.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
class HH_Hugo_Test_Dependencies extends WP_UnitTestCase {
function test_installed() {
$this->assertTrue( function_exists( 'yaml_emit' ) );
$this->assertTrue( class_exists( '\\Markdownify\\ConverterExtra' ) );
}

function test_basic() {
// Basic Markdownify functionality
$converter = new Markdownify\ConverterExtra;
$markdown = $converter->parseString('<h1>Test</h1>');
$this->assertEquals( '# Test', $markdown );

// Basic YAML output
$yaml = yaml_emit( array( 'test' => 'test output', 'foo' => array( 'bar' ) ) );
$this->assertEquals( $yaml, "---\ntest: test output\nfoo:\n- bar\n...\n" );
}
}

0 comments on commit a432b13

Please sign in to comment.