Skip to content

Commit

Permalink
Issue #69 - adjust tests for bwtrace shortcode
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbingwide committed Apr 11, 2019
1 parent e3b2f55 commit 5c9ee71
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 35 deletions.
18 changes: 8 additions & 10 deletions tests/data/bb_BB/test_bwtrace__example_bb_BB.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>$Title$</title>
</head>
<body>
$END$
</body>
</html>
<p>Dsilpay A lnik tO tarce otpoins.</p>
<p>
<code>[bwtrace]</code>
</p>
<p>
<a class="button" href="https://qw/src/wp-admin/options-general.php?page=bw_trace_options">Tarce otpoins</a>
</p>

21 changes: 11 additions & 10 deletions tests/data/bb_BB/test_bwtrace__syntax_bb_BB.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>$Title$</title>
</head>
<body>
$END$
</body>
</html>
Array
(
[text] => Array
(
[default] =>
[values] => txet
[notes] => txet fOr thE tarce btuotn
)

)

3 changes: 2 additions & 1 deletion tests/data/en_GB/test_bwtrace__example.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
</p>
<p>
<a class="button" href="https://qw/src/wp-admin/options-general.php?page=bw_trace_options">Trace options</a>
</p>
</p>

21 changes: 11 additions & 10 deletions tests/data/en_GB/test_bwtrace__syntax.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>$Title$</title>
</head>
<body>
$END$
</body>
</html>
Array
(
[text] => Array
(
[default] =>
[values] => text
[notes] => text for the trace button
)

)

25 changes: 21 additions & 4 deletions tests/test-shortcodes-oik-trace.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php // (C) Copyright Bobbing Wide 2017
<?php // (C) Copyright Bobbing Wide 2017-2019

/**
* @package
Expand All @@ -11,7 +11,7 @@ function setUp() {
parent::setUp();

oik_require_lib( "oik-sc-help" );
oik_require( "shortcodes/oik-trace.php" );
oik_require( "shortcodes/oik-trace.php", "oik-bwtrace" );
oik_require_lib( "oik_plugins" );
}

Expand All @@ -38,7 +38,7 @@ function test_bwtrace__syntax_bb_BB() {
* - We expect trace to be enabled
*/
function test_bwtrace__example() {
bw_update_option( "file", "bwtraces.loh", "bw_trace_options" );
//bw_update_option( "file", "bwtraces.loh", "bw_trace_options" );
$this->switch_to_locale( "en_GB" );
$html = bw_ret( bwtrace__example() );
$html = $this->replace_home_url( $html );
Expand All @@ -48,14 +48,31 @@ function test_bwtrace__example() {
}

function test_bwtrace__example_bb_BB() {
bw_update_option( "file", "bwtraces.loh", "bw_trace_options" );
//bw_update_option( "file", "bwtraces.loh", "bw_trace_options" );
$this->switch_to_locale( "bb_BB" );
$html = bw_ret( bwtrace__example() );
$html = $this->replace_home_url( $html );
//$this->generate_expected_file( $html );
$this->assertArrayEqualsFile( $html );
$this->switch_to_locale( "en_GB" );
}

/**
* Reloads the text domains
*
* - Loading the 'oik-libs' text domain from the oik-libs plugin invalidates tests where the plugin is delivered from WordPress.org so oik-libs won't exist.
* - but we do need to reload (oik's and?) oik-bwtrace's text domains
* - and cause the null domain to be rebuilt.
*/
function reload_domains() {
$domains = array( "oik", "oik-bwtrace" );
foreach ( $domains as $domain ) {
$loaded = bw_load_plugin_textdomain( $domain );
$this->assertTrue( $loaded, "$domain not loaded" );
}
oik_require_lib( "oik-l10n" );
oik_l10n_enable_jti();
}


}
Expand Down

0 comments on commit 5c9ee71

Please sign in to comment.