-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: update test frameworks and restore unit tests in CI
Behat dependencies have been updated, but it is not expected that the tests will work.
- Loading branch information
Showing
7 changed files
with
98 additions
and
103 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
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 |
---|---|---|
@@ -1,25 +1,24 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.8/phpunit.xsd" | ||
backupGlobals="false" | ||
backupStaticAttributes="false" | ||
bootstrap="vendor/autoload.php" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnFailure="false"> | ||
<testsuites> | ||
<testsuite name="unit"> | ||
<directory suffix=".php">tests/Unit</directory> | ||
</testsuite> | ||
<testsuite name="integration"> | ||
<directory suffix=".php">tests/Integration</directory> | ||
</testsuite> | ||
</testsuites> | ||
<listeners> | ||
<listener class="TestListener" file="tests/TestListener.php"/> | ||
</listeners> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/9.2/phpunit.xsd" | ||
backupGlobals="false" | ||
bootstrap="./vendor/autoload.php" | ||
colors="true" | ||
beStrictAboutTestsThatDoNotTestAnything="true" | ||
beStrictAboutOutputDuringTests="true" | ||
convertErrorsToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertDeprecationsToExceptions="true"> | ||
<testsuites> | ||
<testsuite name="unit"> | ||
<directory suffix=".php">tests/Unit</directory> | ||
<exclude>tests/Unit/AntispamBeeTest.php</exclude> | ||
</testsuite> | ||
<testsuite name="integration"> | ||
<directory suffix=".php">tests/Integration</directory> | ||
</testsuite> | ||
</testsuites> | ||
<listeners> | ||
<listener class="TestListener" file="tests/TestListener.php"/> | ||
</listeners> | ||
</phpunit> |
This file was deleted.
Oops, something went wrong.
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
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,33 @@ | ||
<?php | ||
|
||
namespace AntispamBee\Tests\Rules; | ||
|
||
use AntispamBee\Helpers\ContentTypeHelper; | ||
use AntispamBee\Rules\EmptyData; | ||
use Yoast\WPTestUtils\BrainMonkey\TestCase; | ||
|
||
use function Brain\Monkey\Functions\when; | ||
|
||
class EmptyDataTest extends TestCase { | ||
|
||
public function test_verify_comment() { | ||
$item = array( 'reaction_type' => ContentTypeHelper::COMMENT_TYPE ); | ||
self::assertSame( 999, EmptyData::verify( $item ), 'unexpected result for empty comment' ); | ||
|
||
$item['comment_content'] = 'This is a test.'; | ||
self::assertSame( 999, EmptyData::verify( $item ), 'unexpected result for empty author IP' ); | ||
|
||
$item['comment_author_IP'] = '192.0.2.91'; | ||
when( 'get_option' )->justReturn( false ); | ||
self::assertSame( 0, EmptyData::verify( $item ), 'unexpected result with no name required' ); | ||
|
||
when( 'get_option' )->justReturn( true ); | ||
self::assertSame( 999, EmptyData::verify( $item ), 'unexpected result without name and mail' ); | ||
|
||
$item['comment_author_email'] = 'comments@example.com'; | ||
self::assertSame( 999, EmptyData::verify( $item ), 'unexpected result without author name' ); | ||
|
||
$item['comment_author'] = 'A. Tester'; | ||
self::assertSame( 0, EmptyData::verify( $item ), 'unexpected result with name and mail' ); | ||
} | ||
} |