Skip to content

Commit

Permalink
Fast tests (#272)
Browse files Browse the repository at this point in the history
* Disable XDebug when not needed
* Fix PHP Extension deps
* Fast tests
* MSI and Covered MSI limits increased
  • Loading branch information
Spomky committed Sep 1, 2022
1 parent 3bbdac8 commit e597d95
Show file tree
Hide file tree
Showing 10 changed files with 147 additions and 94 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/integrate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
extensions: "json, mbstring, openssl, sqlite3, curl, uuid"
extensions: "ctype, curl, dom, json, libxml, mbstring, openssl, phar, simplexml, sodium, tokenizer, xml, xmlwriter, zlib"
coverage: "xdebug"

- name: "Checkout code"
Expand Down Expand Up @@ -101,7 +101,7 @@ jobs:
uses: "shivammathur/setup-php@v2"
with:
php-version: "8.1"
extensions: "json, mbstring, openssl, sqlite3, curl, uuid"
extensions: "ctype, curl, dom, json, libxml, mbstring, openssl, phar, simplexml, sodium, tokenizer, xml, xmlwriter, zlib"

- name: "Checkout code"
uses: "actions/checkout@v3"
Expand Down Expand Up @@ -129,7 +129,7 @@ jobs:
uses: "shivammathur/setup-php@v2"
with:
php-version: "8.1"
extensions: "json, mbstring, openssl, sqlite3, curl, uuid"
extensions: "ctype, curl, dom, json, libxml, mbstring, openssl, phar, simplexml, sodium, tokenizer, xml, xmlwriter, zlib"

- name: "Checkout code"
uses: "actions/checkout@v3"
Expand Down Expand Up @@ -161,7 +161,7 @@ jobs:
uses: "shivammathur/setup-php@v2"
with:
php-version: "8.1"
extensions: "json, mbstring, openssl, sqlite3, curl, uuid"
extensions: "ctype, curl, dom, json, libxml, mbstring, openssl, phar, simplexml, sodium, tokenizer, xml, xmlwriter, zlib"

- name: "Checkout code"
uses: "actions/checkout@v3"
Expand Down Expand Up @@ -189,7 +189,7 @@ jobs:
uses: "shivammathur/setup-php@v2"
with:
php-version: "8.1"
extensions: "json, mbstring, openssl, sqlite3, curl, uuid"
extensions: "ctype, curl, dom, json, libxml, mbstring, openssl, phar, simplexml, sodium, tokenizer, xml, xmlwriter, zlib"
coverage: "xdebug"

- name: "Checkout code"
Expand Down
11 changes: 5 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.PHONY: mu
mu: vendor ## Mutation tests
vendor/bin/infection -s --threads=$$(nproc) --min-msi=22 --min-covered-msi=45
vendor/bin/phpunit --coverage-text
vendor/bin/infection -s --threads=$$(nproc) --min-msi=33 --min-covered-msi=52

.PHONY: tests
tests: vendor ## Run all tests
Expand Down Expand Up @@ -30,22 +29,22 @@ tf: vendor ## Run only functional tests

.PHONY: st
st: vendor ## Run static analyse
vendor/bin/phpstan analyse
XDEBUG_MODE=off vendor/bin/phpstan analyse


################################################

.PHONY: ci-mu
ci-mu: vendor ## Mutation tests (for CI/CD only)
vendor/bin/infection --logger-github -s --threads=$$(nproc) --min-msi=22 --min-covered-msi=45
vendor/bin/infection --logger-github -s --threads=$$(nproc) --min-msi=33 --min-covered-msi=52

.PHONY: ci-cc
ci-cc: vendor ## Show test coverage rates (for CI/CD only)
vendor/bin/phpunit --coverage-text

.PHONY: ci-cs
ci-cs: vendor ## Check all files using defined ECS rules (for CI/CD only)
vendor/bin/ecs check
XDEBUG_MODE=off vendor/bin/ecs check

################################################

Expand All @@ -58,7 +57,7 @@ node_modules: package.json

.PHONY: rector
rector: vendor ## Check all files using Rector
vendor/bin/rector process --ansi --dry-run --xdebug
XDEBUG_MODE=off vendor/bin/rector process --ansi --dry-run --xdebug

vendor: composer.json
composer validate
Expand Down
16 changes: 10 additions & 6 deletions src/webauthn/src/AuthenticatorAttestationResponseValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,11 @@ private function checkMetadataStatement(
//No attestation is asked. We shall ensure that the data is anonymous.
if (
$aaguid === '00000000-0000-0000-0000-000000000000'
&& ($attestationStatement->getType() === AttestationStatement::TYPE_NONE || $attestationStatement->getType() === AttestationStatement::TYPE_SELF)) {
&& in_array(
$attestationStatement->getType(),
[AttestationStatement::TYPE_NONE, AttestationStatement::TYPE_SELF],
true
)) {
$this->logger->debug('The Attestation Statement is anonymous.');
$this->checkCertificateChain($attestationStatement, null);

Expand Down Expand Up @@ -312,17 +316,17 @@ private function checkMetadataStatement(
'The Metadata Statement Repository is mandatory when requesting attestation objects.'
);
$metadataStatement = $this->metadataStatementRepository->findOneByAAGUID($aaguid);
// We check the last status report
$this->checkStatusReport($aaguid);

// We check the certificate chain (if any)
$this->checkCertificateChain($attestationStatement, $metadataStatement);

// At this point, the Metadata Statement is mandatory
Assertion::notNull(
$metadataStatement,
sprintf('The Metadata Statement for the AAGUID "%s" is missing', $aaguid)
);
// We check the last status report
$this->checkStatusReport($aaguid);

// We check the certificate chain (if any)
$this->checkCertificateChain($attestationStatement, $metadataStatement);

// Check Attestation Type is allowed
if (count($metadataStatement->getAttestationTypes()) !== 0) {
Expand Down
19 changes: 14 additions & 5 deletions tests/library/Functional/AbstractTestCase.php

Large diffs are not rendered by default.

Loading

0 comments on commit e597d95

Please sign in to comment.