Skip to content

Commit ddf41bd

Browse files
committed
feat: fixes lint errors from latest phpcs config
1 parent bdc1edb commit ddf41bd

File tree

11 files changed

+1642
-584
lines changed

11 files changed

+1642
-584
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
Stable tag: 0.3.2
99
Requires at least: 6.2
10-
Tested up to: 6.6
10+
Tested up to: 6.8
1111
Requires PHP: 8.1
1212

1313
WordPress Feature flags plugin allow developers to configure features in plugins/themes behind the feature flags on both

composer.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88
},
99
"require-dev": {
1010
"brain/monkey": "^2.6",
11-
"newsuk/nuk-wp-phpcs-config": "^0.2.0",
12-
"newsuk/nuk-wp-phpmd-config": "^0.1.0",
13-
"newsuk/nuk-wp-phpstan-config": "^0.1.0",
1411
"phpunit/phpunit": "^9.4",
15-
"yoast/wp-test-utils": "^1.2"
12+
"yoast/wp-test-utils": "^1.2",
13+
"squizlabs/php_codesniffer": "^3.7",
14+
"newsuk/nuk-wp-phpcs-config": "0.5.0",
15+
"newsuk/nuk-wp-phpmd-config": "0.1.2",
16+
"newsuk/nuk-wp-phpstan-config": "0.1.1"
1617
},
1718
"autoload": {
1819
"psr-4": {
@@ -29,7 +30,8 @@
2930
"config": {
3031
"allow-plugins": {
3132
"dealerdirect/phpcodesniffer-composer-installer": true,
32-
"phpstan/extension-installer": true
33+
"phpstan/extension-installer": true,
34+
"ergebnis/composer-normalize": true
3335
},
3436
"platform": {
3537
"php": "8.1"

composer.lock

Lines changed: 1243 additions & 414 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/integration/FlagTest.php

Lines changed: 43 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,52 +2,70 @@
22
use CodeB\FeatureFlags\Flag;
33
use Yoast\WPTestUtils\WPIntegration\TestCase;
44

5-
class FlagTest extends TestCase{
5+
class FlagTest extends TestCase {
66

77
public function test_is_enabled_returns_true_if_flags_exists_and_enabled(): void {
88
// Set up test data
9-
$optionValue = [['id' => 1, 'name' => 'test', 'enabled' => true ]];
10-
update_option(Flag::$option_name, $optionValue);
11-
12-
$result = Flag::is_enabled('test');
13-
14-
$this->assertTrue($result);
9+
$option_value = [
10+
[
11+
'id' => 1,
12+
'name' => 'test',
13+
'enabled' => true,
14+
],
15+
];
16+
update_option( Flag::$option_name, $option_value );
17+
18+
$result = Flag::is_enabled( 'test' );
19+
20+
$this->assertTrue( $result );
1521
}
1622

1723
public function test_is_enabled_returns_false_if_flags_exists_and_disabled(): void {
1824
// Set up test data
19-
$optionValue = [['id' => 1, 'name' => 'test', 'enabled' => false ]];
20-
update_option(Flag::$option_name, $optionValue);
21-
22-
$result = Flag::is_enabled('test');
23-
24-
$this->assertFalse($result);
25+
$option_value = [
26+
[
27+
'id' => 1,
28+
'name' => 'test',
29+
'enabled' => false,
30+
],
31+
];
32+
update_option( Flag::$option_name, $option_value );
33+
34+
$result = Flag::is_enabled( 'test' );
35+
36+
$this->assertFalse( $result );
2537
}
2638

2739
public function test_is_enabled_returns_false_if_flags_not_exists(): void {
2840
// Set up test data
29-
$optionValue = [['id' => 1, 'name' => 'test2', 'enabled' => true ]];
30-
update_option(Flag::$option_name, $optionValue);
31-
32-
$result = Flag::is_enabled('test');
33-
34-
$this->assertFalse($result);
41+
$option_value = [
42+
[
43+
'id' => 1,
44+
'name' => 'test2',
45+
'enabled' => true,
46+
],
47+
];
48+
update_option( Flag::$option_name, $option_value );
49+
50+
$result = Flag::is_enabled( 'test' );
51+
52+
$this->assertFalse( $result );
3553
}
3654

3755
public function test_is_enabled_returns_false_if_option_is_empty(): void {
3856
// Set up test data
39-
$optionValue = [];
40-
update_option(Flag::$option_name, $optionValue);
57+
$option_value = [];
58+
update_option( Flag::$option_name, $option_value );
4159

42-
$result = Flag::is_enabled('test');
60+
$result = Flag::is_enabled( 'test' );
4361

44-
$this->assertFalse($result);
62+
$this->assertFalse( $result );
4563
}
4664

4765
public function test_is_enabled_returns_false_if_option_not_exists(): void {
4866

49-
$result = Flag::is_enabled('test');
67+
$result = Flag::is_enabled( 'test' );
5068

51-
$this->assertFalse($result);
69+
$this->assertFalse( $result );
5270
}
5371
}

0 commit comments

Comments
 (0)