-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MOOSE-114]: Add extra tests and stub for acceptance tests
- Loading branch information
1 parent
d1c7e1c
commit b4dc43e
Showing
3 changed files
with
48 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?php | ||
return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-element', 'wp-hooks', 'wp-i18n'), 'version' => '024bef6fb3a0bc82cb17'); |
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,8 @@ | ||
<?php declare(strict_types=1); | ||
|
||
class ExampleCest { | ||
public function test_it_works( AcceptanceTester $I ): void { | ||
$I->amOnPage('/'); | ||
} | ||
|
||
} |
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,38 @@ | ||
<?php declare(strict_types=1); | ||
|
||
class BlockBaseWpUnitTest extends \Codeception\TestCase\WPTestCase { | ||
|
||
use \Tribe\Plugin\Assets\Traits\Assets; | ||
|
||
public function setUp(): void { | ||
parent::setUp(); | ||
|
||
$block_dir = get_template_directory() . '/dist/blocks/core/button'; | ||
$editor_asset = $block_dir . '/editor.asset.php'; | ||
mkdir( $block_dir, 0777, true ); | ||
|
||
$editor_asset_content = file_get_contents( __DIR__ . '/../_data/editor_asset_test.php' ); | ||
$file_handler = fopen( $editor_asset, 'w' ); | ||
fwrite( $file_handler, $editor_asset_content ); | ||
fclose( $file_handler ); | ||
} | ||
|
||
public function test_editor_styles_can_get_version_from_asset_php() | ||
{ | ||
$args = $this->get_asset_file_args( get_theme_file_path( "dist/blocks/core/button/editor.asset.php" ) ); | ||
self::assertArrayHasKey( 'version', $args ); | ||
$version = $args['version'] ?? false; | ||
self::assertEquals( '024bef6fb3a0bc82cb17', $version ); | ||
} | ||
|
||
protected function tearDown(): void { | ||
parent::tearDown(); | ||
|
||
$block_dir = get_template_directory() . '/dist/blocks/core/button'; | ||
$editor_asset = $block_dir . '/editor.asset.php'; | ||
|
||
unlink( $editor_asset ); | ||
rmdir( $block_dir ); | ||
} | ||
|
||
} |