Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianHenryIE committed Nov 27, 2023
1 parent 97186a1 commit 7eaa118
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 13 deletions.
14 changes: 14 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,17 @@ parameters:
- '/does not accept default value of type array.{3}$/'
# Sometimes seems to not find the test parent class's methods.
# - '/Call to an undefined method.*(make|assert).*/'
# WC_Data::add_meta_data works fine with non-string/array values
- '/Parameter #2 \$value of method WC_Data::add_meta_data\(\) expects array\|string/'
- #
message: '#Parameter \#2 \$callback of static method WP_Mock::expect(Action|Filter)Added\(\) expects \(callable\(\): mixed\)\|Mockery\\Matcher\\Type, array{WP_Mock\\Matcher\\AnyInstance, .*} given.#'
path: tests/unit
- # Where we use Exceptions for control flow in tests, the return statements are absent.
message: '#Filter callback return statement is missing.#'
path: tests
- # Let's not check for null|false in tests.
message: '#\|(false|null) given#'
path: tests
- # Let's not check for null|false in tests.
message: '#does not accept .*\|null.#'
path: tests
2 changes: 0 additions & 2 deletions src/admin/class-plugins-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@

namespace BrianHenryIE\WP_Bitcoin_Gateway\Admin;

use BrianHenryIE\WP_Bitcoin_Gateway\API_Interface;
use BrianHenryIE\WP_Bitcoin_Gateway\Settings_Interface;
use BrianHenryIE\WP_Bitcoin_Gateway\WooCommerce\Bitcoin_Gateway;
use WC_Payment_Gateway;

/**
* Adds items to the plugin's row on plugins.php.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function get_bitcoin_apis(): array {

$logger = new ColorLogger();

$result[] = array( new Blockchain_Info_API( $logger ) );
$result[] = array( new Blockchain_Info_Api( $logger ) );
$result[] = array( new Blockstream_Info_API( $logger ) );

return $result;
Expand Down
10 changes: 3 additions & 7 deletions tests/unit/admin/class-plugins-page-unit-Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace BrianHenryIE\WP_Bitcoin_Gateway\Admin;

use BrianHenryIE\WP_Bitcoin_Gateway\API_Interface;
use Codeception\Stub\Expected;
use BrianHenryIE\WP_Bitcoin_Gateway\Settings_Interface;

Expand All @@ -26,9 +25,8 @@ protected function tearDown(): void {
*/
public function test_add_settings_action_link(): void {

$api = $this->makeEmpty( API_Interface::class );
$settings = $this->makeEmpty( Settings_Interface::class );
$sut = new Plugins_Page( $api, $settings );
$sut = new Plugins_Page( $settings );

\WP_Mock::userFunction(
'is_plugin_active',
Expand Down Expand Up @@ -68,8 +66,7 @@ public function test_add_settings_action_link(): void {
public function test_add_settings_action_link_woocommerce_inactive(): void {

$settings = $this->makeEmpty( Settings_Interface::class );
$api = $this->makeEmpty( API_Interface::class );
$sut = new Plugins_Page( $api, $settings );
$sut = new Plugins_Page( $settings );

\WP_Mock::userFunction(
'is_plugin_active',
Expand Down Expand Up @@ -110,8 +107,7 @@ public function test_split_author_link_into_two_links(): void {
'get_plugin_basename' => Expected::once( 'bh-wp-bitcoin-gateway/bh-wp-bitcoin-gateway.php' ),
)
);
$api = $this->makeEmpty( API_Interface::class );
$sut = new Plugins_Page( $api, $settings );
$sut = new Plugins_Page( $settings );

$plugin_meta = array(
0 => 'Version 1.3.3',
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/api/addresses/class-nimq-api-unit-Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use BrianHenryIE\ColorLogger\ColorLogger;

/**
* @coversDefaultClass \BrianHenryIE\WP_Bitcoin_Gateway\API\Addresses\BitWasp_API
* @coversDefaultClass \BrianHenryIE\WP_Bitcoin_Gateway\API\Addresses\Nimq_API
*/
class Nimq_API_Unit_Test extends \Codeception\Test\Unit {

Expand Down
2 changes: 0 additions & 2 deletions tests/wpunit/frontend/class-ajax-wpunit-Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ public function test_omit_data(): void {
'wp_doing_ajax',
function (): bool {
throw new Exception();
// phpcs:disable Squiz.PHP.NonExecutableCode.Unreachable
return false;
}
);

Expand Down

0 comments on commit 7eaa118

Please sign in to comment.