Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/phpunit/tests/secrets/capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function test_upgrade_720_grants_manage_secrets_below_its_db_version( $db
*
* @return array<string, array{0: int, 1: bool}>
*/
public function data_upgrade_720_gate() {
public static function data_upgrade_720_gate() {
return array(
'upgrading from 7.0' => array( 61644, true ),
'upgrading from just below 7.2' => array( 64336, true ),
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/tests/secrets/errorCodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function test_error_code_values_match_the_published_contract( $constant,
/**
* @return array<string, array{0: string, 1: string}>
*/
public function data_published_error_codes() {
public static function data_published_error_codes() {
return array(
'decryption failed' => array( 'WP_SECRETS_ERROR_DECRYPTION_FAILED', 'secret_decryption_failed' ),
'key unavailable' => array( 'WP_SECRETS_ERROR_KEY_UNAVAILABLE', 'secret_key_unavailable' ),
Expand Down
4 changes: 2 additions & 2 deletions tests/phpunit/tests/secrets/wpSecret.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function test_masking_surfaces_never_contain_the_plaintext( $callback ):
/**
* @return array<string, array{0: callable( WP_Secret ): ( string|false )}>
*/
public function data_masking_surfaces() {
public static function data_masking_surfaces() {
return array(
'(string) cast' => array(
function ( WP_Secret $secret ) {
Expand Down Expand Up @@ -205,7 +205,7 @@ public function test_serialization_magic_methods_throw_directly( $method, $args
/**
* @return array<string, array{0: string, 1: array<int, mixed>}>
*/
public function data_refusing_magic_methods() {
public static function data_refusing_magic_methods() {
return array(
'__sleep' => array( '__sleep', array() ),
'__wakeup' => array( '__wakeup', array() ),
Expand Down
8 changes: 4 additions & 4 deletions tests/phpunit/tests/secrets/wpSecretsCipher.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function test_encrypt_rejects_a_bad_master_key( $bad_key ): void {
/**
* @return array<string, array{0: string}>
*/
public function data_bad_master_keys() {
public static function data_bad_master_keys() {
return array(
'too short' => array( str_repeat( 'a', 31 ) ),
'too long' => array( str_repeat( 'a', 33 ) ),
Expand Down Expand Up @@ -167,7 +167,7 @@ public function test_decrypt_fails_when_context_does_not_match( $scope, $site_id
/**
* @return array<string, array{0: string, 1: int, 2: string, 3: string}>
*/
public function data_mismatched_context() {
public static function data_mismatched_context() {
return array(
'different scope' => array( 'network', 1, self::NAME, WP_Secret_Version::CURRENT ),
'different site id' => array( 'site', 2, self::NAME, WP_Secret_Version::CURRENT ),
Expand Down Expand Up @@ -214,7 +214,7 @@ public function test_decrypt_fails_when_a_field_is_tampered( $field ): void {
/**
* @return array<string, array{0: string}>
*/
public function data_tamperable_fields() {
public static function data_tamperable_fields() {
return array(
'ciphertext' => array( 'ct' ),
'value nonce' => array( 'nonce' ),
Expand All @@ -240,7 +240,7 @@ public function test_decrypt_rejects_a_malformed_record( $record ): void {
/**
* @return array<string, array{0: mixed}>
*/
public function data_malformed_records() {
public static function data_malformed_records() {
return array(
'not an array' => array( 'just a string' ),
'missing ct' => array(
Expand Down
4 changes: 2 additions & 2 deletions tests/phpunit/tests/secrets/wpSecretsConfigKeyProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public function test_is_canonical_base64_32( $value, $expected ): void {
/**
* @return array<string, array{0: string|int, 1: bool}>
*/
public function data_canonical_base64_32(): array {
public static function data_canonical_base64_32(): array {
return array(
'exactly 32 bytes, canonical encoding' => array( base64_encode( str_repeat( 'A', 32 ) ), true ),
'31 bytes' => array( base64_encode( str_repeat( 'A', 31 ) ), false ),
Expand Down Expand Up @@ -159,7 +159,7 @@ public function test_are_usable_salt_values( $key, $salt, $expected ): void {
/**
* @return array<string, array{0: string|int|null, 1: string, 2: bool}>
*/
public function data_usable_salt_values(): array {
public static function data_usable_salt_values(): array {
return array(
'both usable' => array( 'a real key', 'a real salt', true ),
'key is the placeholder' => array( 'put your unique phrase here', 'a real salt', false ),
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/tests/secrets/wpSecretsKeyManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function test_get_master_key_reports_an_invalid_site_id_as_a_wp_error( $s
/**
* @return array<string, array{0: int}>
*/
public function data_invalid_site_ids(): array {
public static function data_invalid_site_ids(): array {
return array(
'zero' => array( 0 ),
'negative' => array( -1 ),
Expand Down
6 changes: 3 additions & 3 deletions tests/phpunit/tests/secrets/wpSecretsValidateName.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function test_accepts_valid_names( $name ): void {
/**
* @return array<string, array{0: string}>
*/
public function data_valid_names(): array {
public static function data_valid_names(): array {
return array(
'simple' => array( 'myplugin/api-key' ),
'single character segments' => array( 'a/b' ),
Expand Down Expand Up @@ -60,7 +60,7 @@ public function test_accepts_an_unnamespaced_name_but_reports_it( $name ): void
/**
* @return array<string, array{0: string}>
*/
public function data_unnamespaced_names(): array {
public static function data_unnamespaced_names(): array {
return array(
'simple' => array( 'api_key' ),
'with hyphen' => array( 'api-key' ),
Expand All @@ -84,7 +84,7 @@ public function test_an_unnamespaced_name_still_obeys_the_character_rules(): voi
/**
* @return array<string, array{0: string}>
*/
public function data_invalid_names(): array {
public static function data_invalid_names(): array {
return array(
'empty string' => array( '' ),
'two slashes' => array( 'too/many/slashes' ),
Expand Down
Loading