Skip to content

Commit d5e0cf5

Browse files
Copilotselul
authored andcommitted
Add test infrastructure for e2e tests (emptytheme, wp-env.json)
Co-authored-by: selul <3330746+selul@users.noreply.github.com>
1 parent e008e63 commit d5e0cf5

4 files changed

Lines changed: 67 additions & 0 deletions

File tree

.wp-env.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"core": "WordPress/WordPress#6.4",
3+
"plugins": [
4+
"."
5+
],
6+
"themes": [
7+
"./test/emptytheme"
8+
],
9+
"config": {
10+
"WP_DEBUG": true,
11+
"WP_DEBUG_DISPLAY": true,
12+
"SCRIPT_DEBUG": true
13+
},
14+
"port": 8889,
15+
"env": {
16+
"tests": {
17+
"port": 8889
18+
}
19+
}
20+
}

test/emptytheme/functions.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
/**
3+
* Empty theme functions
4+
*/
5+
6+
if ( ! function_exists( 'emptytheme_setup' ) ) {
7+
function emptytheme_setup() {
8+
add_theme_support( 'title-tag' );
9+
add_theme_support( 'post-thumbnails' );
10+
add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', 'style', 'script' ) );
11+
}
12+
}
13+
add_action( 'after_setup_theme', 'emptytheme_setup' );

test/emptytheme/index.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
/**
3+
* Empty theme index file for testing
4+
*/
5+
?>
6+
<!DOCTYPE html>
7+
<html <?php language_attributes(); ?>>
8+
<head>
9+
<meta charset="<?php bloginfo( 'charset' ); ?>">
10+
<meta name="viewport" content="width=device-width, initial-scale=1">
11+
<?php wp_head(); ?>
12+
</head>
13+
<body <?php body_class(); ?>>
14+
<?php wp_body_open(); ?>
15+
<div id="page">
16+
<?php
17+
if ( have_posts() ) :
18+
while ( have_posts() ) :
19+
the_post();
20+
the_content();
21+
endwhile;
22+
endif;
23+
?>
24+
</div>
25+
<?php wp_footer(); ?>
26+
</body>
27+
</html>

test/emptytheme/style.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/*
2+
Theme Name: Empty Theme
3+
Theme URI: https://example.com
4+
Description: A minimal empty theme for testing
5+
Version: 1.0
6+
Author: Test
7+
*/

0 commit comments

Comments
 (0)