-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Behat test for experimental checks from addon
- Loading branch information
1 parent
c334a5f
commit ec56a26
Showing
3 changed files
with
66 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
41 changes: 41 additions & 0 deletions
41
tests/behat/testdata/pcp-addon/Example_Experimental_Check.php
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,41 @@ | ||
<?php | ||
|
||
use WordPress\Plugin_Check\Checker\Check_Result; | ||
use WordPress\Plugin_Check\Checker\Checks\Abstract_File_Check; | ||
use WordPress\Plugin_Check\Traits\Amend_Check_Result; | ||
use WordPress\Plugin_Check\Traits\Experimental_Check; | ||
|
||
class Example_Experimental_Check extends Abstract_File_Check { | ||
|
||
use Amend_Check_Result; | ||
use Experimental_Check; | ||
|
||
public function get_categories() { | ||
return array( 'new_category' ); | ||
} | ||
|
||
protected function check_files( Check_Result $result, array $files ) { | ||
$php_files = self::filter_files_by_extension( $files, 'php' ); | ||
$file = self::file_preg_match( '#experimental#', $php_files ); | ||
if ( $file ) { | ||
$this->add_result_error_for_file( | ||
$result, | ||
__( 'Experimental text found.', 'pcp-addon' ), | ||
'experimental_text_detected', | ||
$file, | ||
0, | ||
0, | ||
'', | ||
7 | ||
); | ||
} | ||
} | ||
|
||
public function get_description(): string { | ||
return ''; | ||
} | ||
|
||
public function get_documentation_url(): string { | ||
return ''; | ||
} | ||
} |
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