Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
bepsvpt committed Dec 16, 2024
1 parent ba986f9 commit c055675
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 44 deletions.
2 changes: 1 addition & 1 deletion tests/Builders/ClearSiteDataBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

final class ClearSiteDataBuilderTest extends TestCase
{
public function testClearSiteData()
public function test_clear_site_data()
{
$config = [];

Expand Down
30 changes: 15 additions & 15 deletions tests/Builders/ContentSecurityPolicyBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

final class ContentSecurityPolicyBuilderTest extends TestCase
{
public function testEmptyDirective()
public function test_empty_directive()
{
$config = [
'img-src' => [],
Expand Down Expand Up @@ -47,7 +47,7 @@ public function testEmptyDirective()
);
}

public function testSeldomUsedDirectives()
public function test_seldom_used_directives()
{
// sandbox
$config = [
Expand Down Expand Up @@ -173,7 +173,7 @@ public function testSeldomUsedDirectives()
);
}

public function testSchemeAutoAppendColon()
public function test_scheme_auto_append_colon()
{
$config = [
'img-src' => [
Expand All @@ -191,7 +191,7 @@ public function testSchemeAutoAppendColon()
);
}

public function testInvalidNonce()
public function test_invalid_nonce()
{
$config = [
'img-src' => [
Expand All @@ -208,7 +208,7 @@ public function testInvalidNonce()
);
}

public function testInvalidHash()
public function test_invalid_hash()
{
$config = [
'font-src' => [
Expand Down Expand Up @@ -239,7 +239,7 @@ public function testInvalidHash()
/*
* https://signin.104.com.tw
*/
public function testUsing104ContentSecurityPolicy()
public function test_using_104_content_security_policy()
{
$csp = "default-src api.rollbar.com 'self'; font-src 'self' fonts.gstatic.com heapanalytics.com data:; style-src 'self' 'unsafe-inline' tagmanager.google.com fonts.googleapis.com heapanalytics.com; script-src 'self' 'unsafe-inline' 'unsafe-eval' tagmanager.google.com www.googletagmanager.com www.google-analytics.com ssl.google-analytics.com cdn.heapanalytics.com heapanalytics.com www.google.com.tw certify-js.alexametrics.com cdnjs.cloudflare.com static.104.com.tw data:; img-src 'self' ssl.gstatic.com www.gstatic.com www.googletagmanager.com www.google-analytics.com heapanalytics.com certify.alexametrics.com tls-detect.support.104.com.tw www.google.com.tw stats.g.doubleclick.net www.google.com ac.clazzrooms.com ac.beagiver.com signin.104dc.com signin.104.com.tw graphicwb.104.com.tw static.104.com.tw data:; frame-src 'self' www.google.com; connect-src 'self' www.google-analytics.com heapanalytics.com";

Expand Down Expand Up @@ -357,7 +357,7 @@ public function testUsing104ContentSecurityPolicy()
/*
* https://user.gamer.com.tw/login.php
*/
public function testUsingGamerContentSecurityPolicy()
public function test_using_gamer_content_security_policy()
{
$csp = "frame-ancestors 'self' https://*.gamer.com.tw";

Expand All @@ -381,7 +381,7 @@ public function testUsingGamerContentSecurityPolicy()
/*
* https://secure2.store.apple.com/shop/sign_in
*/
public function testUsingAppleContentSecurityPolicy()
public function test_using_apple_content_security_policy()
{
$csp = "frame-ancestors 'self'";

Expand All @@ -401,7 +401,7 @@ public function testUsingAppleContentSecurityPolicy()
/*
* https://dash.cloudflare.com/login
*/
public function testUsingCloudflareContentSecurityPolicy()
public function test_using_cloudflare_content_security_policy()
{
$csp = "object-src 'none'; script-src 'nonce-Mzk3Nzg4MTcwMiw2MjQ3MTQ3OTk=' 'unsafe-eval' 'strict-dynamic' 'report-sample' https:; base-uri 'self'";

Expand Down Expand Up @@ -441,7 +441,7 @@ public function testUsingCloudflareContentSecurityPolicy()
/*
* https://www.facebook.com
*/
public function testUsingFacebookContentSecurityPolicy()
public function test_using_facebook_content_security_policy()
{
$csp = "default-src * data: blob: 'self'; script-src *.facebook.com *.fbcdn.net *.facebook.net *.google-analytics.com *.virtualearth.net *.google.com 127.0.0.1:* *.spotilocal.com:* 'unsafe-inline' 'unsafe-eval' blob: data: 'self'; style-src data: blob: 'unsafe-inline' *; connect-src *.facebook.com facebook.com *.fbcdn.net *.facebook.net *.spotilocal.com:* wss://*.facebook.com:* https://fb.scanandcleanlocal.com:* attachment.fbsbx.com ws://localhost:* blob: *.cdninstagram.com 'self'; block-all-mixed-content; upgrade-insecure-requests";

Expand Down Expand Up @@ -532,7 +532,7 @@ public function testUsingFacebookContentSecurityPolicy()
/*
* https://github.com/
*/
public function testUsingGitHubContentSecurityPolicy()
public function test_using_github_content_security_policy()
{
$csp = "default-src 'none'; base-uri 'self'; block-all-mixed-content; connect-src 'self' uploads.github.com www.githubstatus.com collector.githubapp.com api.github.com www.google-analytics.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com wss://live.github.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com; frame-ancestors 'none'; frame-src render.githubusercontent.com; img-src 'self' data: github.githubassets.com identicons.github.com collector.githubapp.com github-cloud.s3.amazonaws.com *.githubusercontent.com customer-stories-feed.github.com spotlights-feed.github.com; manifest-src 'self'; media-src 'none'; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com";

Expand Down Expand Up @@ -640,7 +640,7 @@ public function testUsingGitHubContentSecurityPolicy()
/*
* https://accounts.google.com
*/
public function testUsingGoogleContentSecurityPolicy()
public function test_using_google_content_security_policy()
{
$csp = "script-src 'nonce-oYvCFuvmnmawgMYMpObFBw' 'unsafe-inline' 'unsafe-eval'; object-src 'none'; base-uri 'self'; report-uri /cspreport";

Expand Down Expand Up @@ -678,7 +678,7 @@ public function testUsingGoogleContentSecurityPolicy()
/*
* https://www.paypal.com/tw/signin
*/
public function testUsingPayPalContentSecurityPolicy()
public function test_using_paypal_content_security_policy()
{
$csp = "default-src 'self' https://*.paypal.com https://*.paypalobjects.com; frame-src 'self' https://*.brighttalk.com https://*.paypal.com https://*.paypalobjects.com https://www.youtube-nocookie.com https://www.xoom.com https://www.wootag.com; script-src 'nonce-JTDEJ1tJpkGVoRUcTBE9s6EbWk0sVDYtLrZ909/1KRzJcxGE' 'self' https://*.paypal.com https://*.paypalobjects.com https://assets-cdn.s-xoom.com 'unsafe-inline' 'unsafe-eval'; connect-src 'self' https://nominatim.openstreetmap.org https://*.paypal.com https://*.paypalobjects.com https://*.google-analytics.com https://*.salesforce.com https://*.force.com https://*.eloqua.com https://nexus.ensighten.com https://api.paypal-retaillocator.com https://*.brighttalk.com https://*.sperse.io https://*.dialogtech.com; style-src 'self' https://*.paypal.com https://*.paypalobjects.com https://assets-cdn.s-xoom.com 'unsafe-inline'; font-src 'self' https://*.paypal.com https://*.paypalobjects.com https://assets-cdn.s-xoom.com data:; img-src 'self' https: data:; form-action 'self' https://*.paypal.com https://*.salesforce.com https://*.eloqua.com https://secure.opinionlab.com; base-uri 'self' https://*.paypal.com; object-src 'none'; frame-ancestors 'self' https://*.paypal.com; block-all-mixed-content; report-uri https://www.paypal.com/csplog/api/log/csp";

Expand Down Expand Up @@ -825,7 +825,7 @@ public function testUsingPayPalContentSecurityPolicy()
/*
* https://beta.protonmail.com/
*/
public function testUsingProtonMailContentSecurityPolicy()
public function test_using_proton_mail_content_security_policy()
{
$csp = "default-src 'self'; connect-src 'self' blob:; script-src 'self' blob: 'sha256-eAhF1Kdccp0BTXM6nMW7SYBdV0c3fZwzcC177TQ692g='; style-src 'self' 'unsafe-inline'; img-src http: https: data: blob: cid:; frame-src 'self' blob: https://secure.protonmail.com; object-src 'self' blob:; child-src 'self' data: blob:; report-uri https://reports.protonmail.ch/reports/csp; frame-ancestors 'none'";

Expand Down Expand Up @@ -920,7 +920,7 @@ public function testUsingProtonMailContentSecurityPolicy()
/*
* https://www.reddit.com/login
*/
public function testUsingRedditContentSecurityPolicy()
public function test_using_reddit_content_security_policy()
{
$csp = "frame-ancestors 'self' https://www.reddit.com https://new.reddit.com";

Expand Down
6 changes: 3 additions & 3 deletions tests/Builders/ExpectCertificateTransparencyBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

final class ExpectCertificateTransparencyBuilderTest extends TestCase
{
public function testExpectCertificateTransparency()
public function test_expect_certificate_transparency()
{
$config = [
'max-age' => 1440,
Expand Down Expand Up @@ -54,7 +54,7 @@ public function testExpectCertificateTransparency()
);
}

public function testNegativeMaxAge()
public function test_negative_max_age()
{
$config = [
'max-age' => -666,
Expand All @@ -66,7 +66,7 @@ public function testNegativeMaxAge()
);
}

public function testInvalidReportUri()
public function test_invalid_report_uri()
{
$config = [
'max-age' => 86400,
Expand Down
8 changes: 4 additions & 4 deletions tests/Builders/PermissionsPolicyBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

final class PermissionsPolicyBuilderTest extends TestCase
{
public function testPolicies()
public function test_policies()
{
$config = [
'autoplay' => [
Expand Down Expand Up @@ -40,7 +40,7 @@ public function testPolicies()
);
}

public function testPolicyKeyPriority()
public function test_policy_key_priority()
{
$config = [
'accelerometer' => [
Expand Down Expand Up @@ -69,7 +69,7 @@ public function testPolicyKeyPriority()
);
}

public function testPolicyMissingKeys()
public function test_policy_missing_keys()
{
$config = [
'accelerometer' => [
Expand All @@ -85,7 +85,7 @@ public function testPolicyMissingKeys()
);
}

public function testInvalidPolicyAllowList()
public function test_invalid_policy_allow_list()
{
$config = [
'accelerometer' => [
Expand Down
4 changes: 2 additions & 2 deletions tests/Builders/StrictTransportSecurityBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

final class StrictTransportSecurityBuilderTest extends TestCase
{
public function testStrictTransportSecurity()
public function test_strict_transport_security()
{
$config = [
'max-age' => 1440,
Expand Down Expand Up @@ -54,7 +54,7 @@ public function testStrictTransportSecurity()
);
}

public function testNegativeMaxAge()
public function test_negative_max_age()
{
$config = [
'max-age' => -666,
Expand Down
4 changes: 2 additions & 2 deletions tests/MiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected function getEnvironmentSetUp($app)
$app->make(HttpKernel::class)->pushMiddleware(SecureHeadersMiddleware::class);
}

public function testMiddleware()
public function test_middleware()
{
$this->app['router']->get('/', function () {
return 'Hello World!';
Expand All @@ -59,7 +59,7 @@ public function testMiddleware()
$this->assertArrayHasKey('x-frame-options', $headers);
}

public function testBinaryResponse()
public function test_binary_response()
{
$this->app['router']->get('/', function () {
return response()->download(__DIR__.'/../README.md');
Expand Down
34 changes: 17 additions & 17 deletions tests/SecureHeadersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ final class SecureHeadersTest extends TestCase
*/
protected $configPath = __DIR__.'/../config/secure-headers.php';

public function testSendHeaders()
public function test_send_headers()
{
(new SecureHeaders($this->config()))->send();

Expand All @@ -29,7 +29,7 @@ public function testSendHeaders()
);
}

public function testDisableHeader()
public function test_disable_header()
{
$config = $this->config();

Expand All @@ -42,7 +42,7 @@ public function testDisableHeader()
$this->assertArrayNotHasKey('X-Download-Options', $headers);
}

public function testLoadFromFile()
public function test_load_from_file()
{
$headers = SecureHeaders::fromFile($this->configPath)->headers();

Expand All @@ -51,14 +51,14 @@ public function testLoadFromFile()
$this->assertArrayHasKey('X-Frame-Options', $headers);
}

public function testFileNotFound()
public function test_file_not_found()
{
$this->expectException(InvalidArgumentException::class);

SecureHeaders::fromFile(__DIR__.'/not-found');
}

public function testServerHeader()
public function test_server_header()
{
$config = $this->config();

Expand All @@ -76,7 +76,7 @@ public function testServerHeader()
$this->assertSame('Example', $headers['Server']);
}

public function testXPoweredByHeader()
public function test_x_powered_by_header()
{
$config = $this->config();

Expand Down Expand Up @@ -109,7 +109,7 @@ public function testXPoweredByHeader()
$this->assertSame('Example', $headers['X-Powered-By']);
}

public function testContentSecurityPolicy()
public function test_content_security_policy()
{
$config = $this->config();

Expand Down Expand Up @@ -147,7 +147,7 @@ public function testContentSecurityPolicy()
);
}

public function testContentSecurityPolicyNonce()
public function test_content_security_policy_nonce()
{
$nonce = SecureHeaders::nonce();

Expand Down Expand Up @@ -178,7 +178,7 @@ public function testContentSecurityPolicyNonce()
);
}

public function testContentSecurityPolicyRemoveNonce()
public function test_content_security_policy_remove_nonce()
{
SecureHeaders::nonce('script');
SecureHeaders::nonce('style');
Expand Down Expand Up @@ -217,7 +217,7 @@ public function testContentSecurityPolicyRemoveNonce()
);
}

public function testContentSecurityPolicyNonceWillBeClearedAfterHeaderSent()
public function test_content_security_policy_nonce_will_be_cleared_after_header_sent()
{
$times = 10;

Expand All @@ -233,7 +233,7 @@ public function testContentSecurityPolicyNonceWillBeClearedAfterHeaderSent()
}
}

public function testPermissionsPolicy()
public function test_permissions_policy()
{
$config = $this->config();

Expand All @@ -257,7 +257,7 @@ public function testPermissionsPolicy()
$this->assertArrayNotHasKey('Permissions-Policy', $headers);
}

public function testStrictTransportSecurity()
public function test_strict_transport_security()
{
$config = $this->config();

Expand All @@ -276,7 +276,7 @@ public function testStrictTransportSecurity()
);
}

public function testExpectCertificateTransparency()
public function test_expect_certificate_transparency()
{
$config = $this->config();

Expand All @@ -295,7 +295,7 @@ public function testExpectCertificateTransparency()
);
}

public function testClearSiteData()
public function test_clear_site_data()
{
$config = $this->config();

Expand All @@ -314,7 +314,7 @@ public function testClearSiteData()
);
}

public function testCrossOriginPolicy()
public function test_cross_origin_policy()
{
$config = $this->config();

Expand All @@ -336,7 +336,7 @@ public function testCrossOriginPolicy()
);
}

public function testReportingEndpoints()
public function test_reporting_endpoints()
{
$config = $this->config();

Expand All @@ -361,7 +361,7 @@ public function testReportingEndpoints()
);
}

public function testNetworkErrorLogging()
public function test_network_error_logging()
{
$config = $this->config();

Expand Down

0 comments on commit c055675

Please sign in to comment.