-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Replace hard-coded Guzzle with PSR implementation * Strict types * Replace GitHub action workflow * Add PHPStan baseline
- Loading branch information
Showing
33 changed files
with
483 additions
and
872 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: 🏗 Build | ||
|
||
on: | ||
pull_request: | ||
types: [ synchronize, opened, reopened, ready_for_review ] | ||
push: | ||
branches: [ main ] | ||
|
||
permissions: | ||
checks: write | ||
pull-requests: write | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
prefer_lowest: ["", "--prefer-lowest"] | ||
php: ["8.1", "8.2", "8.3"] | ||
container: | ||
image: skpr/php-cli:${{ matrix.php }}-dev-v2-edge | ||
options: | ||
--pull always | ||
--user 1001:1001 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
show-progress: false | ||
- name: 📦 Composer Update | ||
run: composer update --with-all-dependencies --prefer-dist --no-progress --no-interaction ${{ matrix.prefer_lowest }} | ||
- name: 🧹 PHPCS | ||
run: ./bin/phpcs --report=checkstyle -q | ./bin/cs2pr | ||
- name: 🧹 PHPStan | ||
run: ./bin/phpstan --error-format=github analyse | ||
- name: ⚡ Run Tests | ||
run: ./bin/phpunit --log-junit phpunit-results.xml | ||
- name: 📝 Publish Test Results | ||
uses: EnricoMi/publish-unit-test-result-action@v2 | ||
if: always() | ||
with: | ||
files: phpunit-results.xml | ||
check_name: Test Results ${{ matrix.php }} ${{ matrix.prefer_lowest }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/composer.lock | ||
/.phpunit.cache | ||
/bin | ||
/vendor | ||
/composer.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ruleset name="bom-weather"> | ||
<description>PHP CodeSniffer configuration for BOM Weather</description> | ||
<!-- folders to scan --> | ||
<ruleset name="PNX Standard"> | ||
<file>./src</file> | ||
<file>./tests</file> | ||
<!-- extensions to scan --> | ||
<arg name="extensions" value="php"/> | ||
<!-- additional arguments --> | ||
<file>./tests/src</file> | ||
<rule ref="PreviousNextDrupal" /> | ||
<rule ref="SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctions" /> | ||
<arg name="report" value="full"/> | ||
<!-- inherit from coder --> | ||
<rule ref="./vendor/drupal/coder/coder_sniffer/Drupal"/> | ||
<!-- Additional detailed sniff configuration --> | ||
<!-- You can determine sniff names by running with -s flag --> | ||
<!-- Example 1 - ignore Drupal.NamingConventions.ValidFunctionName.ScopeNotCamelCaps | ||
<rule ref="Drupal.NamingConventions.ValidFunctionName.ScopeNotCamelCaps"> | ||
<severity>0</severity> | ||
</rule> | ||
// End example 1 --> | ||
<!-- Example 2 - ignore rule for specific files | ||
<rule ref="Drupal.NamingConventions.ValidVariableName.LowerCamelName"> | ||
<exclude-pattern>OfferNormalizerTrait.php</exclude-pattern> | ||
<exclude-pattern>TimeOfUseValidationTrait.php</exclude-pattern> | ||
</rule> | ||
// End example 2 --> | ||
</ruleset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
parameters: | ||
ignoreErrors: | ||
- | ||
message: "#^Method BomWeather\\\\Util\\\\BaseNormalizer\\:\\:normalize\\(\\) return type with generic class ArrayObject does not specify its types\\: TKey, TValue$#" | ||
count: 1 | ||
path: src/Util/BaseNormalizer.php | ||
|
||
- | ||
message: "#^Call to method getEndTime\\(\\) on an unknown class BomWeather\\\\Forecast\\\\RegionForecastPeriod\\.$#" | ||
count: 1 | ||
path: tests/src/Unit/Forecast/Serializer/ForecastSerializerTest.php | ||
|
||
- | ||
message: "#^Call to method getForecast\\(\\) on an unknown class BomWeather\\\\Forecast\\\\RegionForecastPeriod\\.$#" | ||
count: 1 | ||
path: tests/src/Unit/Forecast/Serializer/ForecastSerializerTest.php | ||
|
||
- | ||
message: "#^Call to method getStartTime\\(\\) on an unknown class BomWeather\\\\Forecast\\\\RegionForecastPeriod\\.$#" | ||
count: 1 | ||
path: tests/src/Unit/Forecast/Serializer/ForecastSerializerTest.php | ||
|
||
- | ||
message: "#^Parameter \\#1 \\$periods of method BomWeather\\\\Tests\\\\Unit\\\\Forecast\\\\Serializer\\\\ForecastSerializerTest\\:\\:assertRegionPeriods\\(\\) expects array\\<BomWeather\\\\Forecast\\\\RegionForecastPeriod\\>, array\\<BomWeather\\\\Forecast\\\\ForecastPeriod\\> given\\.$#" | ||
count: 1 | ||
path: tests/src/Unit/Forecast/Serializer/ForecastSerializerTest.php | ||
|
||
- | ||
message: "#^Parameter \\$periods of method BomWeather\\\\Tests\\\\Unit\\\\Forecast\\\\Serializer\\\\ForecastSerializerTest\\:\\:assertRegionPeriods\\(\\) has invalid type BomWeather\\\\Forecast\\\\RegionForecastPeriod\\.$#" | ||
count: 1 | ||
path: tests/src/Unit/Forecast/Serializer/ForecastSerializerTest.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
includes: | ||
- phpstan-baseline.neon | ||
|
||
parameters: | ||
level: 6 | ||
paths: | ||
- src | ||
- tests/src | ||
checkMissingIterableValueType: false | ||
ignoreErrors: | ||
- "#^Call to an undefined method Symfony\\\\Component\\\\Serializer\\\\SerializerInterface\\:\\:denormalize\\(\\)\\.$#" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,27 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<!-- TODO set checkForUnintentionallyCoveredCode="true" once https://www.drupal.org/node/2626832 is resolved. --> | ||
<!-- PHPUnit expects functional tests to be run with either a privileged user | ||
or your current system user. See core/tests/README.md and | ||
https://www.drupal.org/node/2116263 for details. | ||
--> | ||
<phpunit bootstrap="tests/bootstrap.php" colors="true" | ||
beStrictAboutTestsThatDoNotTestAnything="true" | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd" | ||
bootstrap="tests/bootstrap.php" | ||
cacheResultFile=".phpunit.cache/test-results" | ||
executionOrder="depends,defects" | ||
forceCoversAnnotation="true" | ||
beStrictAboutCoversAnnotation="true" | ||
beStrictAboutOutputDuringTests="true" | ||
beStrictAboutChangesToGlobalState="true" | ||
checkForUnintentionallyCoveredCode="false"> | ||
<php> | ||
<!-- Set error reporting to E_ALL. --> | ||
<ini name="error_reporting" value="32767"/> | ||
<!-- Do not limit the amount of memory tests take to run. --> | ||
<ini name="memory_limit" value="-1"/> | ||
<const name="BOOTSTRAP_IS_PHPUNIT" value="true"/> | ||
</php> | ||
<testsuites> | ||
<testsuite name="unit"> | ||
<directory>./tests/Unit</directory> | ||
</testsuite> | ||
<testsuite name="functional"> | ||
<directory>./tests/Functional</directory> | ||
</testsuite> | ||
</testsuites> | ||
<listeners> | ||
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"> | ||
</listener> | ||
</listeners> | ||
<!-- Filter for coverage reports. --> | ||
<filter> | ||
<whitelist> | ||
<directory>./src</directory> | ||
<!-- By definition test classes have no tests. --> | ||
<exclude> | ||
<directory suffix="Test.php">./</directory> | ||
<directory suffix="TestBase.php">./</directory> | ||
</exclude> | ||
</whitelist> | ||
</filter> | ||
beStrictAboutTodoAnnotatedTests="true" | ||
convertDeprecationsToExceptions="true" | ||
failOnRisky="true" | ||
failOnWarning="true" | ||
verbose="true"> | ||
<testsuites> | ||
<testsuite name="default"> | ||
<directory>tests/src</directory> | ||
</testsuite> | ||
</testsuites> | ||
|
||
<coverage cacheDirectory=".phpunit.cache/code-coverage" | ||
processUncoveredFiles="true"> | ||
<include> | ||
<directory suffix=".php">src</directory> | ||
</include> | ||
</coverage> | ||
</phpunit> |
Oops, something went wrong.