-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
100 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ | |
|
||
# Generated files | ||
.tmp | ||
composer.lock | ||
composer.lock | ||
.phpunit.result.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit backupGlobals="false" | ||
backupStaticAttributes="false" | ||
bootstrap="vendor/autoload.php" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
stopOnFailure="true"> | ||
<testsuites> | ||
<testsuite name="WPMVC Addon Customizer"> | ||
<directory>./tests/cases/</directory> | ||
</testsuite> | ||
</testsuites> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
use WPMVC\Addons\PHPUnit\TestCase; | ||
use WPMVC\Addons\Customizer\CustomizerAddon; | ||
|
||
/** | ||
* Test addon class. | ||
* | ||
* @author 10 Quality <info@10quality.com> | ||
* @package wpmvc-addon-customizer | ||
* @license MIT | ||
* @version 1.0.8 | ||
*/ | ||
class CustomizerAddonTest extends TestCase | ||
{ | ||
/** | ||
* Tear down. | ||
* @since 1.0.8 | ||
*/ | ||
public function tearDown(): void | ||
{ | ||
wpmvc_addon_phpunit_reset(); | ||
} | ||
/** | ||
* Test init. | ||
* @since 1.0.8 | ||
* @group addon | ||
*/ | ||
public function testInit() | ||
{ | ||
// Prepare | ||
$bridge = $this->getBridgeMock(); | ||
$addon = new CustomizerAddon($bridge); | ||
// Run | ||
$addon->init(); | ||
// Assert | ||
$this->assertAddedAction( 'admin_enqueue_scripts' ); | ||
$this->assertAddedAction( 'customize_register' ); | ||
$this->assertAddedAction( 'wp_head' ); | ||
$this->assertAddedFilter( 'wpmvc_addon_customizer_controls' ); | ||
$this->assertAddedFilter( 'init' ); | ||
} | ||
/** | ||
* Test init. | ||
* @since 1.0.8 | ||
* @group addon | ||
*/ | ||
public function testCustomizerControls() | ||
{ | ||
// Prepare | ||
$bridge = $this->getBridgeMock(); | ||
$addon = new CustomizerAddon($bridge); | ||
// Run | ||
$controls = $addon->customizer_controls( [] ); | ||
// Assert | ||
$this->assertNotEmpty( $controls ); | ||
$this->assertCount( 6, $controls ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
/** | ||
* Mocked WordPress core class. | ||
* | ||
* @author 10 Quality <info@10quality.com> | ||
* @package wpmvc-addon-customizer | ||
* @license MIT | ||
* @version 1.0.8 | ||
*/ | ||
class WP_Customize_Control | ||
{ | ||
/** | ||
* @todo just mock | ||
*/ | ||
} |