-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5ce2059
commit d8c391c
Showing
41 changed files
with
1,674 additions
and
0 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,35 @@ | ||
name: Testing DealNews\GetConfig | ||
|
||
on: [push] | ||
|
||
jobs: | ||
test: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
php-versions: ['8.0', '8.1', '8.2'] | ||
include: | ||
- operating-system: 'ubuntu-latest' | ||
php-versions: '8.0' | ||
phpunit-versions: 9 | ||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Composer Install | ||
uses: php-actions/composer@v6 | ||
with: | ||
php_version: ${{ matrix.php-versions }} | ||
|
||
- name: PHPUnit tests | ||
uses: php-actions/phpunit@v3 | ||
with: | ||
php_extensions: "pcov yaml" | ||
version: "9.6" | ||
php_version: ${{ matrix.php-versions }} | ||
|
||
- name: Run Phan | ||
uses: k1LoW/phan-action@v0 |
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,21 @@ | ||
# Temporary files | ||
.DS_Store | ||
*~ | ||
*.sw[aop] | ||
.php-cs-fixer.cache | ||
.phpunit.result.cache | ||
|
||
# Deployment dependencies | ||
vendor | ||
composer.lock | ||
phpunit.xml | ||
|
||
# IDE project settings | ||
.project | ||
.settings | ||
.idea | ||
*.sublime-workspace | ||
*.sublime-project | ||
|
||
# test artifacts | ||
tests/fixtures/test_copy.db |
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,116 @@ | ||
<?php | ||
|
||
use \Phan\Config; | ||
|
||
/** | ||
* This configuration will be read and overlayed on top of the | ||
* default configuration. Command line arguments will be applied | ||
* after this file is read. | ||
* | ||
* @see src/Phan/Config.php | ||
* See Config for all configurable options. | ||
* | ||
* A Note About Paths | ||
* ================== | ||
* | ||
* Files referenced from this file should be defined as | ||
* | ||
* ``` | ||
* Config::projectPath('relative_path/to/file') | ||
* ``` | ||
* | ||
* where the relative path is relative to the root of the | ||
* project which is defined as either the working directory | ||
* of the phan executable or a path passed in via the CLI | ||
* '-d' flag. | ||
*/ | ||
return [ | ||
// If true, missing properties will be created when | ||
// they are first seen. If false, we'll report an | ||
// error message. | ||
"allow_missing_properties" => true, | ||
|
||
// Allow null to be cast as any type and for any | ||
// type to be cast to null. | ||
"null_casts_as_any_type" => true, | ||
|
||
// If this has entries, scalars (int, float, bool, string, null) | ||
// are allowed to perform the casts listed. | ||
// E.g. ['int' => ['float', 'string'], 'float' => ['int'], 'string' => ['int'], 'null' => ['string']] | ||
// allows casting null to a string, but not vice versa. | ||
// (subset of scalar_implicit_cast) | ||
'scalar_implicit_partial' => [ | ||
'int' => ['float', 'string'], | ||
'float' => ['int'], | ||
'string' => ['int'], | ||
'null' => ['string', 'bool'], | ||
'bool' => ['null'], | ||
], | ||
|
||
// Backwards Compatibility Checking | ||
'backward_compatibility_checks' => false, | ||
|
||
// Run a quick version of checks that takes less | ||
// time | ||
"quick_mode" => true, | ||
|
||
// Only emit critical issues | ||
"minimum_severity" => 0, | ||
|
||
// A set of fully qualified class-names for which | ||
// a call to parent::__construct() is required | ||
'parent_constructor_required' => [ | ||
], | ||
|
||
// Add any issue types (such as 'PhanUndeclaredMethod') | ||
// here to inhibit them from being reported | ||
'suppress_issue_types' => [ | ||
// These report false positives in libraries due | ||
// to them not being used by any of the other | ||
// library code. | ||
'PhanUnreferencedPublicClassConstant', | ||
'PhanWriteOnlyProtectedProperty', | ||
'PhanUnreferencedPublicMethod', | ||
'PhanUnreferencedUseNormal', | ||
'PhanUnreferencedProtectedMethod', | ||
'PhanUnreferencedProtectedProperty', | ||
|
||
], | ||
|
||
// A list of directories that should be parsed for class and | ||
// method information. After excluding the directories | ||
// defined in exclude_analysis_directory_list, the remaining | ||
// files will be statically analyzed for errors. | ||
// | ||
// Thus, both first-party and third-party code being used by | ||
// your application should be included in this list. | ||
'directory_list' => [ | ||
'src', | ||
'vendor', | ||
'tests', | ||
], | ||
|
||
// A list of directories holding code that we want | ||
// to parse, but not analyze | ||
"exclude_analysis_directory_list" => [ | ||
"vendor", | ||
"tests", | ||
], | ||
|
||
// A file list that defines files that will be excluded | ||
// from parsing and analysis and will not be read at all. | ||
// | ||
// This is useful for excluding hopelessly unanalyzable | ||
// files that can't be removed for whatever reason. | ||
'exclude_file_list' => [ | ||
], | ||
|
||
// Set to true in order to attempt to detect dead | ||
// (unreferenced) code. Keep in mind that the | ||
// results will only be a guess given that classes, | ||
// properties, constants and methods can be referenced | ||
// as variables (like `$class->$property` or | ||
// `$class->$method()`) in ways that we're unable | ||
// to make sense of. | ||
'dead_code_detection' => true, | ||
]; |
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,68 @@ | ||
<?php | ||
|
||
$finder = (new PhpCsFixer\Finder()) | ||
->in(__DIR__) | ||
; | ||
|
||
return (new PhpCsFixer\Config()) | ||
->setRules([ | ||
'@PSR2' => true, | ||
'array_syntax' => [ | ||
'syntax' => 'short', | ||
], | ||
'binary_operator_spaces' => [ | ||
'default' => 'align_single_space', | ||
], | ||
'blank_line_after_opening_tag' => true, | ||
'blank_line_before_statement' => ['statements' => ['return']], | ||
'braces_position' => [ | ||
'allow_single_line_anonymous_functions' => true, | ||
'allow_single_line_empty_anonymous_classes' => true, | ||
'anonymous_classes_opening_brace' => 'same_line', | ||
'anonymous_functions_opening_brace' => 'same_line', | ||
'classes_opening_brace' => 'same_line', | ||
'control_structures_opening_brace' => 'same_line', | ||
'functions_opening_brace' => 'same_line', | ||
], | ||
'combine_consecutive_unsets' => true, | ||
'concat_space' => [ | ||
'spacing' => 'one', | ||
], | ||
'declare_equal_normalize' => true, | ||
'escape_implicit_backslashes' => [ | ||
'single_quoted' => true, | ||
'double_quoted' => true, | ||
], | ||
'function_typehint_space' => true, | ||
'include' => true, | ||
'lowercase_cast' => true, | ||
// 'class_attributes_separation' => ['elements' => ['method']], | ||
'native_function_casing' => true, | ||
'no_blank_lines_after_phpdoc' => true, | ||
'no_empty_comment' => true, | ||
'no_empty_statement' => true, | ||
'no_mixed_echo_print' => [ | ||
'use' => 'echo', | ||
], | ||
'no_multiline_whitespace_around_double_arrow' => true, | ||
'multiline_whitespace_before_semicolons' => false, | ||
'no_short_bool_cast' => true, | ||
'no_singleline_whitespace_before_semicolons' => true, | ||
'no_spaces_around_offset' => true, | ||
'no_unused_imports' => true, | ||
'no_whitespace_before_comma_in_array' => true, | ||
'no_whitespace_in_blank_line' => true, | ||
'object_operator_without_whitespace' => true, | ||
'ordered_imports' => true, | ||
'short_scalar_cast' => true, | ||
'single_blank_line_before_namespace' => true, | ||
'single_quote' => true, | ||
'space_after_semicolon' => true, | ||
'ternary_operator_spaces' => true, | ||
'trailing_comma_in_multiline' => ['elements' => ['arrays']], | ||
'trim_array_spaces' => true, | ||
'unary_operator_spaces' => true, | ||
'whitespace_after_comma_in_array' => true, | ||
]) | ||
->setFinder($finder) | ||
; |
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,3 @@ | ||
# Test Helpers | ||
|
||
A collection of traits that are useful when writing PHPUnit tests. |
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,45 @@ | ||
{ | ||
"name": "dealnews/test-helpers", | ||
"type": "library", | ||
"license": "BSD-3-Clause", | ||
"description": "A PHP library of traits for use in PHPUnit test cases.", | ||
"config": { | ||
"optimize-autoloader": true, | ||
"discard-changes": true, | ||
"sort-packages": true | ||
}, | ||
"require": { | ||
"php": "^8.0", | ||
"guzzlehttp/guzzle": "^7.8", | ||
"phpunit/phpunit": "^9.6" | ||
}, | ||
"require-dev": { | ||
"friendsofphp/php-cs-fixer": "^3.38", | ||
"php-parallel-lint/php-parallel-lint": "^1.3" | ||
}, | ||
"autoload": { | ||
"psr-4" : { | ||
"DealNews\\TestHelpers\\" : "src" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"DealNews\\TestHelpers\\Tests\\": "tests/" | ||
} | ||
}, | ||
"scripts": { | ||
"phan": [ | ||
"docker run --rm -e PHAN_DISABLE_XDEBUG_WARN=1 -v `pwd`:/mnt/src -w /mnt/src phanphp/phan:5 -p" | ||
], | ||
"test": [ | ||
"parallel-lint src/ tests/", | ||
"phpunit --colors=never" | ||
], | ||
"lint": [ | ||
"parallel-lint src/ tests/" | ||
], | ||
"fix": [ | ||
"php-cs-fixer fix --config .php-cs-fixer.dist.php src tests" | ||
] | ||
} | ||
} |
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 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="./tests/bootstrap.php" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"> | ||
<coverage includeUncoveredFiles="true" processUncoveredFiles="false"> | ||
<include> | ||
<directory suffix=".php">./src</directory> | ||
</include> | ||
<exclude> | ||
<directory suffix=".php">./tests</directory> | ||
<directory suffix=".php">./vendor</directory> | ||
</exclude> | ||
<report> | ||
<text outputFile="php://stdout" showUncoveredFiles="true"/> | ||
</report> | ||
</coverage> | ||
<testsuites> | ||
<testsuite name="default"> | ||
<directory>./tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
<groups> | ||
<exclude> | ||
<group>functional</group> | ||
</exclude> | ||
</groups> | ||
<php> | ||
<env name="DN_ETC_DIR" value="./tests/etc"/> | ||
<env name="DN_INI_FILE" value="./tests/etc/config_env_file.ini"/> | ||
<env name="CONFIG_TEST_ENV_VAR" value="foo"/> | ||
<env name="config.test.env.dot.var" value="foobar"/> | ||
</php> | ||
</phpunit> |
Oops, something went wrong.