Skip to content
This repository has been archived by the owner on Jan 8, 2021. It is now read-only.

Commit

Permalink
Additional tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
BigWhale authored and dz0ny committed Nov 23, 2016
1 parent a037d30 commit eeff24f
Showing 1 changed file with 53 additions and 2 deletions.
55 changes: 53 additions & 2 deletions tests/TestFooterLinks.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function test_customizer()
public function test_customizeCSS()
{
\WP_Mock::wpFunction('get_option', array(
'return' => ['hide-selector'=>true, 'hide-enabled'=>true, 'use-important'=>true],
'return' => ['hide-selector'=>true, 'hide-enabled'=>true, 'use-important'=>false],
)
);

Expand All @@ -115,15 +115,64 @@ public function test_customizeCSS()

$plugin = new FooterLinks;
$plugin->customizeCSS();

$this->expectOutputRegex('/(.*)#site-generator(.*)/');
}

public function test_customizeCSSNotFoundTheme()
public function test_customizeCSSImportantFlag()
{
\WP_Mock::wpFunction('get_option', array(
'return' => ['hide-selector'=>true, 'hide-enabled'=>true, 'use-important'=>true],
)
);

$wp_theme = \Mockery::mock();
$wp_theme->shouldReceive('get_template')
->once()
->andReturn('contango');
\WP_Mock::wpFunction('wp_get_theme', array(
'return' => $wp_theme,
)
);


$plugin = new FooterLinks;
$plugin->customizeCSS();

$this->expectOutputRegex('/(.*)\#colophon \.copyright(.*)!important(.*)/');
}


public function test_customizeCSSNotFoundTheme()
{
\WP_Mock::wpFunction('get_option', array(
'return' => ['hide-selector'=>'.not-found-theme', 'hide-enabled'=>true, 'use-important'=>false],
)
);

$wp_theme = \Mockery::mock();
$wp_theme->shouldReceive('get_template')
->once()
->andReturn('theme_does_not_exists');
\WP_Mock::wpFunction('wp_get_theme', array(
'return' => $wp_theme,
)
);


$plugin = new FooterLinks;
$plugin->customizeCSS();

$this->expectOutputRegex('/(.*)\.not-found-theme(.*)/');
}

public function test_customizeCSSNotFoundThemeImportantFlag()
{
\WP_Mock::wpFunction('get_option', array(
'return' => ['hide-selector'=>'.not-found-theme', 'hide-enabled'=>true, 'use-important'=>true],
)
);

$wp_theme = \Mockery::mock();
$wp_theme->shouldReceive('get_template')
->once()
Expand All @@ -136,6 +185,8 @@ public function test_customizeCSSNotFoundTheme()

$plugin = new FooterLinks;
$plugin->customizeCSS();

$this->expectOutputRegex('/(.*)\.not-found-theme(.*)!important(.*)/');
}

}

0 comments on commit eeff24f

Please sign in to comment.