-
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.
Add PHPUnit tests for PHP 8.1, 8.2 and 8.3 #6
- Loading branch information
1 parent
efdc311
commit 40f7b9b
Showing
4 changed files
with
89 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 |
---|---|---|
|
@@ -25,3 +25,5 @@ node_modules/ | |
|
||
# dotenv environment variables file | ||
.env | ||
|
||
.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<testsuites> | ||
<testsuite name="" tests="1" assertions="1" errors="0" warnings="0" failures="0" skipped="0" time="0.318031"> | ||
<testsuite name="sb-post-edit-block" tests="1" assertions="1" errors="0" warnings="0" failures="0" skipped="0" time="0.318031"> | ||
<testsuite name="Tests_load_libs" file="C:\apache\htdocs\wordpress\wp-content\plugins\sb-post-edit-block\tests\test-a-load-php.php" tests="1" assertions="1" errors="0" warnings="0" failures="0" skipped="0" time="0.318031"> | ||
<testcase name="test_load_plugin" class="Tests_load_libs" classname="Tests_load_libs" file="C:\apache\htdocs\wordpress\wp-content\plugins\sb-post-edit-block\tests\test-a-load-php.php" line="57" assertions="1" time="0.318031"/> | ||
</testsuite> | ||
</testsuite> | ||
</testsuite> | ||
</testsuites> |
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 @@ | ||
<phpunit | ||
bootstrap="../oik-batch/oik-wp.php" | ||
backupGlobals="false" | ||
colors="false" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
> | ||
<!-- for PHPUnit 9.6 --> | ||
<testsuites> | ||
<testsuite name="sb-post-edit-block"> | ||
<directory prefix="test-" suffix=".php">tests/</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,62 @@ | ||
<?php | ||
|
||
/** | ||
* @package sb-post-edit-block | ||
* @copyright (C) Copyright Bobbing Wide 2023 | ||
* | ||
* Unit tests to load all the files for PHP 8.2, except batch ones | ||
*/ | ||
|
||
class Tests_load_libs extends BW_UnitTestCase | ||
{ | ||
|
||
/** | ||
* set up logic | ||
* | ||
* - ensure any database updates are rolled back | ||
* - we need oik-googlemap to load the functions we're testing | ||
*/ | ||
function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
} | ||
|
||
/* | ||
function test_load_admin() { | ||
$this->load_dir_files( 'admin' ); | ||
$this->assertTrue( true ); | ||
} | ||
function test_load_includes() { | ||
//$this->load_dir_files( 'shortcodes' ); | ||
oik_require( 'includes/oikp-lazy-nav.inc', 'sb-post-edit-block'); | ||
$this->assertTrue( true ); | ||
} | ||
function load_dir_files( $dir, $excludes=[] ) { | ||
$files = glob( "$dir/*.php"); | ||
//print_r( $files ); | ||
foreach ( $files as $file ) { | ||
if ( !in_array( $file, $excludes ) ) { | ||
//echo "Loading $file"; | ||
oik_require( $file, 'sb-post-edit-block'); | ||
} | ||
} | ||
} | ||
*/ | ||
|
||
/** | ||
* Test that the plugin is loaded | ||
*/ | ||
function test_load_plugin() { | ||
oik_require( 'sb-post-edit-block.php', 'sb-post-edit-block'); | ||
$this->assertTrue( true ); | ||
} | ||
|
||
} |