Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updated autop/format tests for habari/habari#110

  • Loading branch information...
commit 1a4d9e84eab351510acc163022f4a63e271b7dbe 1 parent 76d2fc4
@ringmaster ringmaster authored
View
1  data/autop/text16.input.txt
@@ -0,0 +1 @@
+<h1>test</h1>
View
1  data/autop/text16.wanted.txt
@@ -0,0 +1 @@
+<h1>test</h1>
View
1  data/autop/text17.input.txt
@@ -0,0 +1 @@
+<div><img>&nbsp;<img>&nbsp;<img>&nbsp;<img></div>
View
1  data/autop/text17.wanted.txt
@@ -0,0 +1 @@
+<div><p>&nbsp;<img>&nbsp;<img>&nbsp;<img>&nbsp;<img></p></div>
View
9 units/test_format.php
@@ -16,19 +16,20 @@ public function test_autop()
$result = ( trim( $datum['want'] ) === trim( Format::autop( $datum['in'] ) ) ? true : false );
if( ! $result ) {
- $this->output( htmlspecialchars( sprintf( 'Test %d<br><strong>Expected:</strong><br>%s<br><strong>Got:</strong><br> %s',
+ $this->output( ( sprintf( '<h2>Test %s</h2><strong>Input:</strong><textarea>%s</textarea><strong>Expected:</strong><textarea>%s</textarea><strong>Got:</strong><br><textarea>%s</textarea>',
$index,
+ nl2br( Utils::htmlspecialchars( $datum['in'] ) ),
nl2br( Utils::htmlspecialchars( $datum['want'] ) ),
nl2br( Utils::htmlspecialchars( Format::autop( $datum['in'] ) ) )
) ) );
}
- $this->assert_true( $result, "Output does not match desired output" );
+ $this->assert_true( $result, sprintf("Output does not match desired output in %s", $index) );
}
}
public function autop_data_provider()
{
- $autop_data_path = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'autop';
+ $autop_data_path = dirname(dirname( __FILE__ )) . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'autop';
$data = array();
for ( $n = 1; $n <= 99; $n++ ) {
$suff = str_pad( $n, 2, '0', STR_PAD_LEFT );
@@ -37,7 +38,7 @@ public function autop_data_provider()
if ( !is_readable( $inputFile ) ) {
break; // no need to keep looping
}
- $data[] = array( 'in' => file_get_contents( $inputFile ), 'want' => file_get_contents( $wantedFile ) );
+ $data[basename($wantedFile)] = array( 'in' => file_get_contents( $inputFile ), 'want' => file_get_contents( $wantedFile ) );
}
return $data;

0 comments on commit 1a4d9e8

Please sign in to comment.
Something went wrong with that request. Please try again.