From 6fba99ba08d759203a801859cb9e79ec85c8cfb7 Mon Sep 17 00:00:00 2001 From: Mark Beech Date: Wed, 22 Jun 2022 21:36:25 +0100 Subject: [PATCH 01/15] Github workflows --- .github/workflows/php-cs-fixer.yml | 23 +++++++++++ .github/workflows/tests.yml | 54 +++++++++++++++++++++++++ .styleci.yml | 65 ------------------------------ .travis.yml | 30 -------------- 4 files changed, 77 insertions(+), 95 deletions(-) create mode 100644 .github/workflows/php-cs-fixer.yml create mode 100644 .github/workflows/tests.yml delete mode 100644 .styleci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/php-cs-fixer.yml b/.github/workflows/php-cs-fixer.yml new file mode 100644 index 0000000..1c083c4 --- /dev/null +++ b/.github/workflows/php-cs-fixer.yml @@ -0,0 +1,23 @@ +name: Check & fix styling + +on: [ push ] + +jobs: + php-cs-fixer: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + ref: ${{ github.head_ref }} + + - name: Run PHP CS Fixer + uses: docker://oskarstark/php-cs-fixer-ga:2.18.6 + with: + args: --config=.php_cs.dist --allow-risky=yes + + - name: Commit changes + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: Fix styling \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..bea5a29 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,54 @@ +name: Test + +on: + push: + branches: + - "master" + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: true + matrix: + php: [5.3, 5.4, 5.5, 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1] + + name: PHP:${{ matrix.php }} + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup PHP, with composer + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + tools: composer:v2 + coverage: xdebug + + - name: Get composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache composer dependencies + uses: actions/cache@v2 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} + restore-keys: dependencies-php-${{ matrix.php }}-composer- + + - name: Install Composer dependencies + run: | + composer install --prefer-dist --no-interaction --no-suggest + + - name: Run Unit tests + run: | + vendor/bin/phpunit --coverage-clover=tests/logs/clover.xml + + - name: Upload coverage results to Coveralls + env: + COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + composer global require php-coveralls/php-coveralls "^1.0" + coveralls --coverage_clover=tests/logs/clover.xml -v \ No newline at end of file diff --git a/.styleci.yml b/.styleci.yml deleted file mode 100644 index e46be86..0000000 --- a/.styleci.yml +++ /dev/null @@ -1,65 +0,0 @@ -preset: none -enabled: - - array_element_white_space_after_comma - - blankline_after_open_tag - - braces - - concat_without_spaces - - double_arrow_multiline_whitespaces - - duplicate_semicolon - - elseif - - empty_return - - encoding - - eof_ending - - function_call_space - - function_declaration - - include - - indentation - - join_function - - line_after_namespace - - linefeed - - list_commas - - logical_not_operators_with_successor_space - - short_array_syntax - - lowercase_constants - - lowercase_keywords - - method_argument_space - - multiline_array_trailing_comma - - multiline_spaces_before_semicolon - - multiple_use - - namespace_no_leading_whitespace - - no_blank_lines_after_class_opening - - no_empty_lines_after_phpdocs - - no_extra_consecutive_blank_lines - - object_operator - - operators_spaces - - length_ordered_imports - - parenthesis - - phpdoc_indent - - phpdoc_inline_tag - - phpdoc_no_access - - phpdoc_no_package - - phpdoc_scalar - - phpdoc_short_description - - phpdoc_to_comment - - phpdoc_trim - - phpdoc_type_to_var - - phpdoc_var_without_name - - remove_leading_slash_use - - return - - self_accessor - - short_echo_tag - - short_tag - - single_array_no_trailing_comma - - single_blank_line_before_namespace - - single_line_after_imports - - single_quote - - spaces_before_semicolon - - spaces_cast - - standardize_not_equal - - ternary_spaces - - trailing_spaces - - trim_array_spaces - - unalign_equals - - unary_operators_spaces - - visibility - - whitespacy_lines \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 003f1dd..0000000 --- a/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -language: php - -cache: - directories: - - $HOME/.composer/cache - -matrix: - include: - - php: 5.6 - - php: 7.0 - - php: 7.1 - - php: 7.2 - - php: 7.3 - - php: 7.4 - - php: nightly - allow_failures: - - php: nightly - fast_finish: true - -before_install: - - travis_retry composer self-update - -install: - - composer install --no-interaction --prefer-dist --no-suggest - -script: - - ./vendor/bin/phpunit --coverage-clover ./tests/logs/clover.xml - -after_script: - - php vendor/bin/coveralls -v From 9c8f27a2d61824beda66e22fc634548f6266b3fe Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Wed, 22 Jun 2022 20:36:37 +0000 Subject: [PATCH 02/15] Apply fixes from StyleCI [ci skip] [skip ci] --- src/Shortcode.php | 2 -- src/Shortcodes.php | 31 +++++++++++++++++++------------ tests/ParseTest.php | 8 ++++---- tests/bootstrap.php | 2 +- 4 files changed, 24 insertions(+), 19 deletions(-) diff --git a/src/Shortcode.php b/src/Shortcode.php index e52b48f..de5a2e8 100644 --- a/src/Shortcode.php +++ b/src/Shortcode.php @@ -2,8 +2,6 @@ namespace Jaybizzle\Shortcodes; -use Jaybizzle\Shortcodes\ShortcodeContract; - abstract class Shortcode implements ShortcodeContract { /** diff --git a/src/Shortcodes.php b/src/Shortcodes.php index 8d63792..6547834 100644 --- a/src/Shortcodes.php +++ b/src/Shortcodes.php @@ -18,7 +18,7 @@ class Shortcodes */ public function add($classes) { - if (! is_array($classes)) { + if (!is_array($classes)) { $classes = [$classes]; } @@ -48,12 +48,13 @@ public function removeAll() /** * Search content for shortcodes and filter shortcodes through their hooks. * - * @param string $content + * @param string $content + * * @return string */ public function parse($content) { - if (empty($content) || empty($this->shortcodeTags) || ! is_array($this->shortcodeTags)) { + if (empty($content) || empty($this->shortcodeTags) || !is_array($this->shortcodeTags)) { return $content; } @@ -79,6 +80,7 @@ protected function getShortcodeRegex() * Build the shortcode regex for the specified tags. * * @param string $tags + * * @return string */ protected function buildShortcodeRegex($tags) @@ -89,7 +91,8 @@ protected function buildShortcodeRegex($tags) /** * Regular Expression callable for doShortcode() for calling shortcode hook. * - * @param array $matches + * @param array $matches + * * @return string */ protected function doShortcodeTag($matches) @@ -112,7 +115,8 @@ protected function doShortcodeTag($matches) /** * Retrieve all attributes from the shortcode tag. * - * @param string $text + * @param string $text + * * @return array */ protected function shortcodeParseAtts($text) @@ -123,11 +127,11 @@ protected function shortcodeParseAtts($text) if (preg_match_all($pattern, $text, $match, PREG_SET_ORDER)) { foreach ($match as $m) { - if (! empty($m[1])) { + if (!empty($m[1])) { $atts[strtolower($m[1])] = stripcslashes($m[2]); - } elseif (! empty($m[3])) { + } elseif (!empty($m[3])) { $atts[strtolower($m[3])] = stripcslashes($m[4]); - } elseif (! empty($m[5])) { + } elseif (!empty($m[5])) { $atts[strtolower($m[5])] = stripcslashes($m[6]); } elseif (isset($m[7]) && strlen($m[7])) { $atts[] = stripcslashes($m[7]); @@ -145,12 +149,13 @@ protected function shortcodeParseAtts($text) /** * Remove all shortcode tags from the given content. * - * @param string $content + * @param string $content + * * @return string */ public function stripShortcodes($content) { - if (empty($content) || empty($this->shortcodeTags) || ! is_array($this->shortcodeTags)) { + if (empty($content) || empty($this->shortcodeTags) || !is_array($this->shortcodeTags)) { return $content; } @@ -162,7 +167,8 @@ public function stripShortcodes($content) /** * Remove specified shortcode tag from the given content. * - * @param string $content + * @param string $content + * * @return string */ public function stripShortcode($shortcode, $content) @@ -170,7 +176,7 @@ public function stripShortcode($shortcode, $content) if (empty($content)) { return $content; } - + $pattern = $this->buildShortcodeRegex(preg_quote($shortcode)); return preg_replace('/'.$pattern.'/s', ' ', $content); @@ -190,6 +196,7 @@ public function getShortcodes($content) * * @param string $shortcode * @param string $content + * * @return array */ public function getShortcode($shortcode, $content) diff --git a/tests/ParseTest.php b/tests/ParseTest.php index f357aed..02267cd 100644 --- a/tests/ParseTest.php +++ b/tests/ParseTest.php @@ -1,14 +1,14 @@ shortcodes = new Shortcodes; + $this->shortcodes = new Shortcodes(); } /** @test */ @@ -349,11 +349,11 @@ public function parse() { $attributes = ''; - if (! empty($this->attributes)) { + if (!empty($this->attributes)) { $attributes = ' '.http_build_query($this->attributes, '', ' '); } - if (! empty($this->content)) { + if (!empty($this->content)) { return "<{$this->shortcode}{$attributes}>{$this->content}shortcode}>"; } diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 405df61..b435b92 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -2,7 +2,7 @@ $dot = dirname(__FILE__); -if (! file_exists($composer = dirname($dot).'/vendor/autoload.php')) { +if (!file_exists($composer = dirname($dot).'/vendor/autoload.php')) { throw new RuntimeException("Please run 'composer install' first to set up autoloading. $composer"); } /** @var \Composer\Autoload\ClassLoader $autoloader */ From ba9fd9d6b075d4400aebad1f0882b6f2ede9b2fa Mon Sep 17 00:00:00 2001 From: Mark Beech Date: Wed, 22 Jun 2022 21:40:42 +0100 Subject: [PATCH 03/15] wip --- .github/workflows/php-cs-fixer.yml | 28 ++--- .php-cs-fixer.php | 164 +++++++++++++++++++++++++++++ 2 files changed, 179 insertions(+), 13 deletions(-) create mode 100644 .php-cs-fixer.php diff --git a/.github/workflows/php-cs-fixer.yml b/.github/workflows/php-cs-fixer.yml index 1c083c4..9b80fa5 100644 --- a/.github/workflows/php-cs-fixer.yml +++ b/.github/workflows/php-cs-fixer.yml @@ -1,23 +1,25 @@ name: Check & fix styling -on: [ push ] +on: [push] jobs: php-cs-fixer: runs-on: ubuntu-latest + if: "!contains(github.event.head_commit.message, 'cs-skip')" steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - ref: ${{ github.head_ref }} + - name: Checkout code + uses: actions/checkout@v2 + with: + token: ${{ secrets.PAT }} + ref: ${{ github.head_ref }} - - name: Run PHP CS Fixer - uses: docker://oskarstark/php-cs-fixer-ga:2.18.6 - with: - args: --config=.php_cs.dist --allow-risky=yes + - name: Run PHP CS Fixer + uses: docker://oskarstark/php-cs-fixer-ga + with: + args: --config=.php-cs-fixer.php --allow-risky=yes - - name: Commit changes - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: Fix styling \ No newline at end of file + - name: Commit changes + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: Fix styling [cs-skip] \ No newline at end of file diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php new file mode 100644 index 0000000..43d89b8 --- /dev/null +++ b/.php-cs-fixer.php @@ -0,0 +1,164 @@ + true, + 'array_syntax' => ['syntax' => 'short'], + 'binary_operator_spaces' => [ + 'default' => 'single_space', + 'operators' => ['=>' => null], + ], + 'blank_line_after_namespace' => true, + 'blank_line_after_opening_tag' => true, + 'blank_line_before_statement' => [ + 'statements' => ['return'], + ], + 'braces' => true, + 'cast_spaces' => true, + 'class_attributes_separation' => [ + 'elements' => [ + 'const' => 'one', + 'method' => 'one', + 'property' => 'one', + 'trait_import' => 'none', + ], + ], + 'class_definition' => [ + 'multi_line_extends_each_single_line' => true, + 'single_item_single_line' => true, + 'single_line' => true, + ], + 'concat_space' => [ + 'spacing' => 'none', + ], + 'constant_case' => ['case' => 'lower'], + 'declare_equal_normalize' => true, + 'elseif' => true, + 'encoding' => true, + 'full_opening_tag' => true, + 'fully_qualified_strict_types' => true, // added by Shift + 'function_declaration' => true, + 'function_typehint_space' => true, + 'general_phpdoc_tag_rename' => true, + 'heredoc_to_nowdoc' => true, + 'include' => true, + 'increment_style' => ['style' => 'post'], + 'indentation_type' => true, + 'linebreak_after_opening_tag' => true, + 'line_ending' => true, + 'lowercase_cast' => true, + 'lowercase_keywords' => true, + 'lowercase_static_reference' => true, // added from Symfony + 'magic_method_casing' => true, // added from Symfony + 'magic_constant_casing' => true, + 'method_argument_space' => [ + 'on_multiline' => 'ignore', + ], + 'multiline_whitespace_before_semicolons' => [ + 'strategy' => 'no_multi_line', + ], + 'native_function_casing' => true, + 'no_alias_functions' => true, + 'no_extra_blank_lines' => [ + 'tokens' => [ + 'extra', + 'throw', + 'use', + ], + ], + 'no_blank_lines_after_class_opening' => true, + 'no_blank_lines_after_phpdoc' => true, + 'no_closing_tag' => true, + 'no_empty_phpdoc' => true, + 'no_empty_statement' => true, + 'no_leading_import_slash' => true, + 'no_leading_namespace_whitespace' => true, + 'no_mixed_echo_print' => [ + 'use' => 'echo', + ], + 'no_multiline_whitespace_around_double_arrow' => true, + 'no_short_bool_cast' => true, + 'no_singleline_whitespace_before_semicolons' => true, + 'no_spaces_after_function_name' => true, + 'no_spaces_around_offset' => [ + 'positions' => ['inside', 'outside'], + ], + 'no_spaces_inside_parenthesis' => true, + 'no_trailing_comma_in_list_call' => true, + 'no_trailing_comma_in_singleline_array' => true, + 'no_trailing_whitespace' => true, + 'no_trailing_whitespace_in_comment' => true, + 'no_unneeded_control_parentheses' => [ + 'statements' => ['break', 'clone', 'continue', 'echo_print', 'return', 'switch_case', 'yield'], + ], + 'no_unreachable_default_argument_value' => true, + 'no_useless_return' => true, + 'no_whitespace_before_comma_in_array' => true, + 'no_whitespace_in_blank_line' => true, + 'normalize_index_brace' => true, + 'not_operator_with_successor_space' => true, + 'object_operator_without_whitespace' => true, + 'ordered_imports' => ['sort_algorithm' => 'alpha'], + 'psr_autoloading' => true, + 'phpdoc_indent' => true, + 'phpdoc_inline_tag_normalizer' => true, + 'phpdoc_no_access' => true, + 'phpdoc_no_package' => true, + 'phpdoc_no_useless_inheritdoc' => true, + 'phpdoc_scalar' => true, + 'phpdoc_single_line_var_spacing' => true, + 'phpdoc_summary' => false, + 'phpdoc_to_comment' => false, // override to preserve user preference + 'phpdoc_tag_type' => true, + 'phpdoc_trim' => true, + 'phpdoc_types' => true, + 'phpdoc_var_without_name' => true, + 'self_accessor' => true, + 'short_scalar_cast' => true, + 'simplified_null_return' => false, // disabled as "risky" + 'single_blank_line_at_eof' => true, + 'single_blank_line_before_namespace' => true, + 'single_class_element_per_statement' => [ + 'elements' => ['const', 'property'], + ], + 'single_import_per_statement' => true, + 'single_line_after_imports' => true, + 'single_line_comment_style' => [ + 'comment_types' => ['hash'], + ], + 'single_quote' => true, + 'space_after_semicolon' => true, + 'standardize_not_equals' => true, + 'switch_case_semicolon_to_colon' => true, + 'switch_case_space' => true, + 'ternary_operator_spaces' => true, + 'trailing_comma_in_multiline' => ['elements' => ['arrays']], + 'trim_array_spaces' => true, + 'unary_operator_spaces' => true, + 'visibility_required' => [ + 'elements' => ['method', 'property'], + ], + 'whitespace_after_comma_in_array' => true, +]; + +$finder = Finder::create() + ->in([ + __DIR__.'/app', + __DIR__.'/config', + __DIR__.'/database', + __DIR__.'/resources', + __DIR__.'/routes', + __DIR__.'/tests', + ]) + ->name('*.php') + ->notName('*.blade.php') + ->ignoreDotFiles(true) + ->ignoreVCS(true); + +return (new Config) + ->setFinder($finder) + ->setRules($rules) + ->setRiskyAllowed(true) + ->setUsingCache(true); From 4b14e76927d2242214ec332b920a4670d408eb22 Mon Sep 17 00:00:00 2001 From: Mark Beech Date: Wed, 22 Jun 2022 21:43:18 +0100 Subject: [PATCH 04/15] wip --- .github/workflows/php-cs-fixer.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/php-cs-fixer.yml b/.github/workflows/php-cs-fixer.yml index 9b80fa5..0e3f6d4 100644 --- a/.github/workflows/php-cs-fixer.yml +++ b/.github/workflows/php-cs-fixer.yml @@ -11,7 +11,6 @@ jobs: - name: Checkout code uses: actions/checkout@v2 with: - token: ${{ secrets.PAT }} ref: ${{ github.head_ref }} - name: Run PHP CS Fixer From 3b162cf55433012162dbbff79d7bf94c1989a17a Mon Sep 17 00:00:00 2001 From: Mark Beech Date: Wed, 22 Jun 2022 21:44:39 +0100 Subject: [PATCH 05/15] wip --- .php-cs-fixer.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 43d89b8..5c61835 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -145,11 +145,7 @@ $finder = Finder::create() ->in([ - __DIR__.'/app', - __DIR__.'/config', - __DIR__.'/database', - __DIR__.'/resources', - __DIR__.'/routes', + __DIR__.'/src', __DIR__.'/tests', ]) ->name('*.php') From 63149a6bc5a126af40dfafc5f692a88a31528939 Mon Sep 17 00:00:00 2001 From: JayBizzle Date: Wed, 22 Jun 2022 20:44:58 +0000 Subject: [PATCH 06/15] Fix styling [cs-skip] --- .php-cs-fixer.cache | 1 + src/Shortcodes.php | 12 ++++++------ tests/ParseTest.php | 4 ++-- tests/bootstrap.php | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) create mode 100644 .php-cs-fixer.cache diff --git a/.php-cs-fixer.cache b/.php-cs-fixer.cache new file mode 100644 index 0000000..d29ec3a --- /dev/null +++ b/.php-cs-fixer.cache @@ -0,0 +1 @@ +{"php":"8.1.6","version":"3.8.0","indent":" ","lineEnding":"\n","rules":{"array_indentation":true,"array_syntax":{"syntax":"short"},"binary_operator_spaces":{"default":"single_space","operators":{"=>":null}},"blank_line_after_namespace":true,"blank_line_after_opening_tag":true,"blank_line_before_statement":{"statements":["return"]},"braces":true,"cast_spaces":true,"class_attributes_separation":{"elements":{"const":"one","method":"one","property":"one","trait_import":"none"}},"class_definition":{"multi_line_extends_each_single_line":true,"single_item_single_line":true,"single_line":true},"concat_space":{"spacing":"none"},"constant_case":{"case":"lower"},"declare_equal_normalize":true,"elseif":true,"encoding":true,"full_opening_tag":true,"fully_qualified_strict_types":true,"function_declaration":true,"function_typehint_space":true,"general_phpdoc_tag_rename":true,"heredoc_to_nowdoc":true,"include":true,"increment_style":{"style":"post"},"indentation_type":true,"linebreak_after_opening_tag":true,"line_ending":true,"lowercase_cast":true,"lowercase_keywords":true,"lowercase_static_reference":true,"magic_method_casing":true,"magic_constant_casing":true,"method_argument_space":{"on_multiline":"ignore"},"multiline_whitespace_before_semicolons":{"strategy":"no_multi_line"},"native_function_casing":true,"no_alias_functions":true,"no_extra_blank_lines":{"tokens":["extra","throw","use"]},"no_blank_lines_after_class_opening":true,"no_blank_lines_after_phpdoc":true,"no_closing_tag":true,"no_empty_phpdoc":true,"no_empty_statement":true,"no_leading_import_slash":true,"no_leading_namespace_whitespace":true,"no_mixed_echo_print":{"use":"echo"},"no_multiline_whitespace_around_double_arrow":true,"no_short_bool_cast":true,"no_singleline_whitespace_before_semicolons":true,"no_spaces_after_function_name":true,"no_spaces_around_offset":{"positions":["inside","outside"]},"no_spaces_inside_parenthesis":true,"no_trailing_comma_in_list_call":true,"no_trailing_comma_in_singleline_array":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"no_unneeded_control_parentheses":{"statements":["break","clone","continue","echo_print","return","switch_case","yield"]},"no_unreachable_default_argument_value":true,"no_useless_return":true,"no_whitespace_before_comma_in_array":true,"no_whitespace_in_blank_line":true,"normalize_index_brace":true,"not_operator_with_successor_space":true,"object_operator_without_whitespace":true,"ordered_imports":{"sort_algorithm":"alpha"},"psr_autoloading":true,"phpdoc_indent":true,"phpdoc_inline_tag_normalizer":true,"phpdoc_no_access":true,"phpdoc_no_package":true,"phpdoc_no_useless_inheritdoc":true,"phpdoc_scalar":true,"phpdoc_single_line_var_spacing":true,"phpdoc_tag_type":true,"phpdoc_trim":true,"phpdoc_types":true,"phpdoc_var_without_name":true,"self_accessor":true,"short_scalar_cast":true,"single_blank_line_at_eof":true,"single_blank_line_before_namespace":true,"single_class_element_per_statement":{"elements":["const","property"]},"single_import_per_statement":true,"single_line_after_imports":true,"single_line_comment_style":{"comment_types":["hash"]},"single_quote":true,"space_after_semicolon":true,"standardize_not_equals":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"ternary_operator_spaces":true,"trailing_comma_in_multiline":{"elements":["arrays"]},"trim_array_spaces":true,"unary_operator_spaces":true,"visibility_required":{"elements":["method","property"]},"whitespace_after_comma_in_array":true},"hashes":{"src\/Shortcode.php":3560097536,"src\/Shortcodes.php":3939376158,"src\/ShortcodeContract.php":2070114346,"tests\/ParseTest.php":3074930478,"tests\/bootstrap.php":3982004710}} \ No newline at end of file diff --git a/src/Shortcodes.php b/src/Shortcodes.php index 6547834..81e6c4f 100644 --- a/src/Shortcodes.php +++ b/src/Shortcodes.php @@ -18,7 +18,7 @@ class Shortcodes */ public function add($classes) { - if (!is_array($classes)) { + if (! is_array($classes)) { $classes = [$classes]; } @@ -54,7 +54,7 @@ public function removeAll() */ public function parse($content) { - if (empty($content) || empty($this->shortcodeTags) || !is_array($this->shortcodeTags)) { + if (empty($content) || empty($this->shortcodeTags) || ! is_array($this->shortcodeTags)) { return $content; } @@ -127,11 +127,11 @@ protected function shortcodeParseAtts($text) if (preg_match_all($pattern, $text, $match, PREG_SET_ORDER)) { foreach ($match as $m) { - if (!empty($m[1])) { + if (! empty($m[1])) { $atts[strtolower($m[1])] = stripcslashes($m[2]); - } elseif (!empty($m[3])) { + } elseif (! empty($m[3])) { $atts[strtolower($m[3])] = stripcslashes($m[4]); - } elseif (!empty($m[5])) { + } elseif (! empty($m[5])) { $atts[strtolower($m[5])] = stripcslashes($m[6]); } elseif (isset($m[7]) && strlen($m[7])) { $atts[] = stripcslashes($m[7]); @@ -155,7 +155,7 @@ protected function shortcodeParseAtts($text) */ public function stripShortcodes($content) { - if (empty($content) || empty($this->shortcodeTags) || !is_array($this->shortcodeTags)) { + if (empty($content) || empty($this->shortcodeTags) || ! is_array($this->shortcodeTags)) { return $content; } diff --git a/tests/ParseTest.php b/tests/ParseTest.php index 02267cd..d206876 100644 --- a/tests/ParseTest.php +++ b/tests/ParseTest.php @@ -349,11 +349,11 @@ public function parse() { $attributes = ''; - if (!empty($this->attributes)) { + if (! empty($this->attributes)) { $attributes = ' '.http_build_query($this->attributes, '', ' '); } - if (!empty($this->content)) { + if (! empty($this->content)) { return "<{$this->shortcode}{$attributes}>{$this->content}shortcode}>"; } diff --git a/tests/bootstrap.php b/tests/bootstrap.php index b435b92..405df61 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -2,7 +2,7 @@ $dot = dirname(__FILE__); -if (!file_exists($composer = dirname($dot).'/vendor/autoload.php')) { +if (! file_exists($composer = dirname($dot).'/vendor/autoload.php')) { throw new RuntimeException("Please run 'composer install' first to set up autoloading. $composer"); } /** @var \Composer\Autoload\ClassLoader $autoloader */ From 21d141a2591816b6a27b529e8ba06a36ca12eccc Mon Sep 17 00:00:00 2001 From: Mark Beech Date: Wed, 22 Jun 2022 21:45:54 +0100 Subject: [PATCH 07/15] wip --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 2c1fc0c..a6a6ac4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /vendor composer.phar composer.lock -.DS_Store \ No newline at end of file +.DS_Store +.php-cs-fixer.cache \ No newline at end of file From 062f5a79dc0d2f7f652eaa5d790c55b8e78a19d5 Mon Sep 17 00:00:00 2001 From: Mark Beech Date: Wed, 22 Jun 2022 21:46:13 +0100 Subject: [PATCH 08/15] wip --- .php-cs-fixer.cache | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .php-cs-fixer.cache diff --git a/.php-cs-fixer.cache b/.php-cs-fixer.cache deleted file mode 100644 index d29ec3a..0000000 --- a/.php-cs-fixer.cache +++ /dev/null @@ -1 +0,0 @@ -{"php":"8.1.6","version":"3.8.0","indent":" ","lineEnding":"\n","rules":{"array_indentation":true,"array_syntax":{"syntax":"short"},"binary_operator_spaces":{"default":"single_space","operators":{"=>":null}},"blank_line_after_namespace":true,"blank_line_after_opening_tag":true,"blank_line_before_statement":{"statements":["return"]},"braces":true,"cast_spaces":true,"class_attributes_separation":{"elements":{"const":"one","method":"one","property":"one","trait_import":"none"}},"class_definition":{"multi_line_extends_each_single_line":true,"single_item_single_line":true,"single_line":true},"concat_space":{"spacing":"none"},"constant_case":{"case":"lower"},"declare_equal_normalize":true,"elseif":true,"encoding":true,"full_opening_tag":true,"fully_qualified_strict_types":true,"function_declaration":true,"function_typehint_space":true,"general_phpdoc_tag_rename":true,"heredoc_to_nowdoc":true,"include":true,"increment_style":{"style":"post"},"indentation_type":true,"linebreak_after_opening_tag":true,"line_ending":true,"lowercase_cast":true,"lowercase_keywords":true,"lowercase_static_reference":true,"magic_method_casing":true,"magic_constant_casing":true,"method_argument_space":{"on_multiline":"ignore"},"multiline_whitespace_before_semicolons":{"strategy":"no_multi_line"},"native_function_casing":true,"no_alias_functions":true,"no_extra_blank_lines":{"tokens":["extra","throw","use"]},"no_blank_lines_after_class_opening":true,"no_blank_lines_after_phpdoc":true,"no_closing_tag":true,"no_empty_phpdoc":true,"no_empty_statement":true,"no_leading_import_slash":true,"no_leading_namespace_whitespace":true,"no_mixed_echo_print":{"use":"echo"},"no_multiline_whitespace_around_double_arrow":true,"no_short_bool_cast":true,"no_singleline_whitespace_before_semicolons":true,"no_spaces_after_function_name":true,"no_spaces_around_offset":{"positions":["inside","outside"]},"no_spaces_inside_parenthesis":true,"no_trailing_comma_in_list_call":true,"no_trailing_comma_in_singleline_array":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"no_unneeded_control_parentheses":{"statements":["break","clone","continue","echo_print","return","switch_case","yield"]},"no_unreachable_default_argument_value":true,"no_useless_return":true,"no_whitespace_before_comma_in_array":true,"no_whitespace_in_blank_line":true,"normalize_index_brace":true,"not_operator_with_successor_space":true,"object_operator_without_whitespace":true,"ordered_imports":{"sort_algorithm":"alpha"},"psr_autoloading":true,"phpdoc_indent":true,"phpdoc_inline_tag_normalizer":true,"phpdoc_no_access":true,"phpdoc_no_package":true,"phpdoc_no_useless_inheritdoc":true,"phpdoc_scalar":true,"phpdoc_single_line_var_spacing":true,"phpdoc_tag_type":true,"phpdoc_trim":true,"phpdoc_types":true,"phpdoc_var_without_name":true,"self_accessor":true,"short_scalar_cast":true,"single_blank_line_at_eof":true,"single_blank_line_before_namespace":true,"single_class_element_per_statement":{"elements":["const","property"]},"single_import_per_statement":true,"single_line_after_imports":true,"single_line_comment_style":{"comment_types":["hash"]},"single_quote":true,"space_after_semicolon":true,"standardize_not_equals":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"ternary_operator_spaces":true,"trailing_comma_in_multiline":{"elements":["arrays"]},"trim_array_spaces":true,"unary_operator_spaces":true,"visibility_required":{"elements":["method","property"]},"whitespace_after_comma_in_array":true},"hashes":{"src\/Shortcode.php":3560097536,"src\/Shortcodes.php":3939376158,"src\/ShortcodeContract.php":2070114346,"tests\/ParseTest.php":3074930478,"tests\/bootstrap.php":3982004710}} \ No newline at end of file From 42a1658d4b2769d7ca41498c87361dd84d1c606a Mon Sep 17 00:00:00 2001 From: Mark Beech Date: Wed, 22 Jun 2022 21:48:34 +0100 Subject: [PATCH 09/15] wip --- composer.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/composer.json b/composer.json index f2aa7e0..ea0e4be 100644 --- a/composer.json +++ b/composer.json @@ -9,8 +9,7 @@ } ], "require-dev": { - "phpunit/phpunit": "^4.8|^5.5|^6.5", - "satooshi/php-coveralls": "1.*" + "phpunit/phpunit": "^4.8|^5.5|^6.5|^9.4" }, "autoload": { "psr-4": { From 981bd2767c14954df60709dc3731a4a37b8456b9 Mon Sep 17 00:00:00 2001 From: Mark Beech Date: Wed, 22 Jun 2022 21:57:45 +0100 Subject: [PATCH 10/15] wip --- .github/workflows/tests.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bea5a29..3f53d61 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -44,11 +44,4 @@ jobs: - name: Run Unit tests run: | - vendor/bin/phpunit --coverage-clover=tests/logs/clover.xml - - - name: Upload coverage results to Coveralls - env: - COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - composer global require php-coveralls/php-coveralls "^1.0" - coveralls --coverage_clover=tests/logs/clover.xml -v \ No newline at end of file + vendor/bin/phpunit --coverage-clover=tests/logs/clover.xml \ No newline at end of file From d6b252f5a814999b1ad82e5b34af93b7d5922c54 Mon Sep 17 00:00:00 2001 From: Mark Beech Date: Wed, 22 Jun 2022 22:05:02 +0100 Subject: [PATCH 11/15] wip --- tests/ParseTest.php | 183 ++++++++++++++++++++++++++++---------------- 1 file changed, 119 insertions(+), 64 deletions(-) diff --git a/tests/ParseTest.php b/tests/ParseTest.php index d206876..43033f3 100644 --- a/tests/ParseTest.php +++ b/tests/ParseTest.php @@ -6,172 +6,199 @@ class ParseTest extends TestCase { - public function setUp() - { - $this->shortcodes = new Shortcodes(); - } - /** @test */ public function no_tags_added() { + $shortcodes = new Shortcodes(); + $this->assertEquals( 'This is some [foo /] content', - $this->shortcodes->parse('This is some [foo /] content') + $shortcodes->parse('This is some [foo /] content') ); } /** @test */ public function we_can_add_a_single_shortcode() { - $this->shortcodes->add(FooShortcode::class); + $shortcodes = new Shortcodes(); + + $shortcodes->add(FooShortcode::class); - $this->assertCount(1, $this->shortcodes->shortcodeTags); + $this->assertCount(1, $shortcodes->shortcodeTags); } /** @test */ public function we_can_add_multiple_shorcodes() { - $this->shortcodes->add([ + $shortcodes = new Shortcodes(); + + $shortcodes->add([ FooShortcode::class, BarShortcode::class, ]); - $this->assertCount(2, $this->shortcodes->shortcodeTags); + $this->assertCount(2, $shortcodes->shortcodeTags); } /** @test */ public function tags_with_closing_slash() { - $this->shortcodes->add(FooShortcode::class); + $shortcodes = new Shortcodes(); + + $shortcodes->add(FooShortcode::class); $this->assertEquals( 'This is some content', - $this->shortcodes->parse('This is some [foo /] content') + $shortcodes->parse('This is some [foo /] content') ); } /** @test */ public function tags_without_closing_slash() { - $this->shortcodes->add(FooShortcode::class); + $shortcodes = new Shortcodes(); + + $shortcodes->add(FooShortcode::class); $this->assertEquals( 'This is some content', - $this->shortcodes->parse('This is some [foo] content') + $shortcodes->parse('This is some [foo] content') ); } /** @test */ public function tags_with_closing_slash_and_attributes() { - $this->shortcodes->add(FooShortcode::class); + $shortcodes = new Shortcodes(); + + $shortcodes->add(FooShortcode::class); $this->assertEquals( 'This is some content', - $this->shortcodes->parse('This is some [foo bar=baz /] content') + $shortcodes->parse('This is some [foo bar=baz /] content') ); } /** @test */ public function tags_without_closing_slash_and_attributes() { - $this->shortcodes->add(FooShortcode::class); + $shortcodes = new Shortcodes(); + + $shortcodes->add(FooShortcode::class); $this->assertEquals( 'This is some content', - $this->shortcodes->parse('This is some [foo bar=baz] content') + $shortcodes->parse('This is some [foo bar=baz] content') ); } /** @test */ public function tags_with_opening_and_closing_tags() { - $this->shortcodes->add(FooShortcode::class); + $shortcodes = new Shortcodes(); + + $shortcodes->add(FooShortcode::class); $this->assertEquals( 'This is some bar baz content', - $this->shortcodes->parse('This is some [foo]bar baz[/foo] content') + $shortcodes->parse('This is some [foo]bar baz[/foo] content') ); } /** @test */ public function attributes_enclosed_in_double_quotes() { - $this->shortcodes->add(FooShortcode::class); + $shortcodes = new Shortcodes(); + + $shortcodes->add(FooShortcode::class); $this->assertEquals( 'This is some content', - $this->shortcodes->parse('This is some [foo bar="baz"] content') + $shortcodes->parse('This is some [foo bar="baz"] content') ); } /** @test */ public function attributes_enclosed_in_single_quotes() { - $this->shortcodes->add(FooShortcode::class); + $shortcodes = new Shortcodes(); + + $shortcodes->add(FooShortcode::class); $this->assertEquals( 'This is some content', - $this->shortcodes->parse('This is some [foo bar=\'baz\'] content') + $shortcodes->parse('This is some [foo bar=\'baz\'] content') ); } /** @test */ public function attributes_multiple_attributes() { - $this->shortcodes->add(FooShortcode::class); + $shortcodes = new Shortcodes(); + + $shortcodes->add(FooShortcode::class); $this->assertEquals( 'This is some content', - $this->shortcodes->parse('This is some [foo bar=baz qux=foo] content') + $shortcodes->parse('This is some [foo bar=baz qux=foo] content') ); } /** @test */ public function we_can_strip_all_tags() { - $this->shortcodes->add(FooShortcode::class); + $shortcodes = new Shortcodes(); + + $shortcodes->add(FooShortcode::class); $this->assertEquals( 'This is some content', - $this->shortcodes->stripShortcodes('This is some [foo bar=baz qux=foo] content') + $shortcodes->stripShortcodes('This is some [foo bar=baz qux=foo] content') ); } /** @test */ public function we_can_strip_specified_tag() { - $this->shortcodes->add(FooShortcode::class); + $shortcodes = new Shortcodes(); + + $shortcodes->add(FooShortcode::class); $this->assertEquals( 'This is some [bar bar=baz qux=foo] content', - $this->shortcodes->stripShortcode('foo', 'This is some [foo bar=baz qux=foo] [bar bar=baz qux=foo] content') + $shortcodes->stripShortcode('foo', 'This is some [foo bar=baz qux=foo] [bar bar=baz qux=foo] content') ); } /** @test */ public function we_can_get_attributes_for_specified_shortcode() { - $this->shortcodes->add(FooShortcode::class); + $shortcodes = new Shortcodes(); + + $shortcodes->add(FooShortcode::class); $this->assertEquals( [], - $this->shortcodes->getShortcode('foo', 'This is some [bar bar=baz qux=foo] content') + $shortcodes->getShortcode('foo', 'This is some [bar bar=baz qux=foo] content') ); } /** @test */ public function we_can_strip_tags_when_no_tags_specified() { + $shortcodes = new Shortcodes(); + $this->assertEquals( 'This is some [foo bar=baz qux=foo] content', - $this->shortcodes->stripShortcodes('This is some [foo bar=baz qux=foo] content') + $shortcodes->stripShortcodes('This is some [foo bar=baz qux=foo] content') ); } /** @test */ public function we_can_get_the_attributes_from_the_specified_tag() { + $shortcodes = new Shortcodes(); + $expected = [[ 'bar' => 'baz', 'qux' => 'foo', @@ -179,15 +206,17 @@ public function we_can_get_the_attributes_from_the_specified_tag() $this->assertEquals( $expected, - $this->shortcodes->getShortcode('foo', 'This is some [foo bar=baz qux=foo] [bar bar=baz qux=foo] content') + $shortcodes->getShortcode('foo', 'This is some [foo bar=baz qux=foo] [bar bar=baz qux=foo] content') ); } /** @test */ public function we_can_get_the_attributes_from_all_tags() { - $this->shortcodes->add(FooShortcode::class); - $this->shortcodes->add(BarShortcode::class); + $shortcodes = new Shortcodes(); + + $shortcodes->add(FooShortcode::class); + $shortcodes->add(BarShortcode::class); $expected = [ 'foo' => [[ @@ -203,133 +232,159 @@ public function we_can_get_the_attributes_from_all_tags() ]], ]; + $shortcodes = new Shortcodes(); + $this->assertEquals( $expected, - $this->shortcodes->getShortcodes('This is some [foo bar=baz qux=foo] [foo bar=baz qux=foo] [bar bar=baz qux=foo] content') + $shortcodes->getShortcodes('This is some [foo bar=baz qux=foo] [foo bar=baz qux=foo] [bar bar=baz qux=foo] content') ); } /** @test */ public function test_we_can_remove_single_shortcode_tag() { - $this->shortcodes->add(FooShortcode::class); - $this->shortcodes->add(BarShortcode::class); + $shortcodes = new Shortcodes(); - $this->shortcodes->remove('foo'); + $shortcodes->add(FooShortcode::class); + $shortcodes->add(BarShortcode::class); - $this->assertCount(1, $this->shortcodes->shortcodeTags); + $shortcodes->remove('foo'); + + $this->assertCount(1, $shortcodes->shortcodeTags); } /** @test */ public function test_we_can_remove_all_shortcode_tags() { - $this->shortcodes->add(FooShortcode::class); - $this->shortcodes->add(BarShortcode::class); + $shortcodes = new Shortcodes(); + + $shortcodes->add(FooShortcode::class); + $shortcodes->add(BarShortcode::class); - $this->shortcodes->removeAll('foo'); + $shortcodes->removeAll('foo'); - $this->assertCount(0, $this->shortcodes->shortcodeTags); + $this->assertCount(0, $shortcodes->shortcodeTags); } /** @test */ public function shortcode_tags_can_be_escaped() { - $this->shortcodes->add(FooShortcode::class); + $shortcodes = new Shortcodes(); + + $shortcodes->add(FooShortcode::class); $this->assertEquals( 'This is some [foo bar=baz] content', - $this->shortcodes->parse('This is some [[foo bar=baz]] content') + $shortcodes->parse('This is some [[foo bar=baz]] content') ); } /** @test */ public function content_with_no_shortcodes() { + $shortcodes = new Shortcodes(); + $this->assertEquals( 'This is some content', - $this->shortcodes->parse('This is some content') + $shortcodes->parse('This is some content') ); } /** @test */ public function shortcode_with_hyphens() { - $this->shortcodes->add(BazShortcode::class); + $shortcodes = new Shortcodes(); + + $shortcodes->add(BazShortcode::class); $this->assertEquals( 'This is some content', - $this->shortcodes->parse('This is some [foo-bar] content') + $shortcodes->parse('This is some [foo-bar] content') ); } /** @test */ public function attribute_with_double_quotes() { - $this->shortcodes->add(FooShortcode::class); + $shortcodes = new Shortcodes(); + + $shortcodes->add(FooShortcode::class); $this->assertEquals( 'This is some content', - $this->shortcodes->parse('This is some [foo bar="baz"] content') + $shortcodes->parse('This is some [foo bar="baz"] content') ); } /** @test */ public function attribute_with_single_quotes() { - $this->shortcodes->add(FooShortcode::class); + $shortcodes = new Shortcodes(); + + $shortcodes->add(FooShortcode::class); $this->assertEquals( 'This is some content', - $this->shortcodes->parse('This is some [foo bar=\'baz\'] content') + $shortcodes->parse('This is some [foo bar=\'baz\'] content') ); } /** @test */ public function single_positional_attribute() { - $this->shortcodes->add(FooShortcode::class); + $shortcodes = new Shortcodes(); + + $shortcodes->add(FooShortcode::class); $this->assertEquals( 'This is some content', - $this->shortcodes->parse('This is some [foo 123] content') + $shortcodes->parse('This is some [foo 123] content') ); } /** @test */ public function attribute_with_url() { - $this->shortcodes->add(FooShortcode::class); + $shortcodes = new Shortcodes(); + + $shortcodes->add(FooShortcode::class); $this->assertEquals( 'This is some content', - $this->shortcodes->parse('This is some [foo url=http://www.foo.com/bar] content') + $shortcodes->parse('This is some [foo url=http://www.foo.com/bar] content') ); } /** @test */ public function mixed_attribute_types() { - $this->shortcodes->add(FooShortcode::class); + $shortcodes = new Shortcodes(); + + $shortcodes->add(FooShortcode::class); $this->assertEquals( 'This is some content', - $this->shortcodes->parse('This is some [foo 123 http://foo.com/ 0 "foo" bar] content') + $shortcodes->parse('This is some [foo 123 http://foo.com/ 0 "foo" bar] content') ); } /** @test */ public function magic_properties_are_gettable() { - $this->shortcodes->add(QuxShortcode::class); + $shortcodes = new Shortcodes(); - $this->shortcodes->parse('This is some [qux foo=bar]'); + $shortcodes->add(QuxShortcode::class); + + $shortcodes->parse('This is some [qux foo=bar]'); $this->addToAssertionCount(1); } /** @test */ public function exception_is_thrown_when_accessing_uknown_magic_property() { - $this->shortcodes->add(BazQuxShortcode::class); + $shortcodes = new Shortcodes(); + + $shortcodes->add(BazQuxShortcode::class); if (version_compare(PHP_VERSION, '7.0', '>=')) { $this->expectException(\Exception::class); @@ -337,7 +392,7 @@ public function exception_is_thrown_when_accessing_uknown_magic_property() $this->setExpectedException(\Exception::class); } - $this->shortcodes->parse('This is some [qux foo=bar]'); + $shortcodes->parse('This is some [qux foo=bar]'); } } From 679a3c266922ac2280a336a3129c714e8d7feac2 Mon Sep 17 00:00:00 2001 From: Mark Beech Date: Wed, 22 Jun 2022 22:07:01 +0100 Subject: [PATCH 12/15] wip --- .phpunit.result.cache | 1 + tests/ParseTest.php | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) create mode 100644 .phpunit.result.cache diff --git a/.phpunit.result.cache b/.phpunit.result.cache new file mode 100644 index 0000000..b9debb5 --- /dev/null +++ b/.phpunit.result.cache @@ -0,0 +1 @@ +{"version":1,"defects":{"ParseTest::we_can_get_the_attributes_from_all_tags":4},"times":{"ParseTest::no_tags_added":0.006,"ParseTest::we_can_add_a_single_shortcode":0.001,"ParseTest::we_can_add_multiple_shorcodes":0,"ParseTest::tags_with_closing_slash":0,"ParseTest::tags_without_closing_slash":0,"ParseTest::tags_with_closing_slash_and_attributes":0,"ParseTest::tags_without_closing_slash_and_attributes":0,"ParseTest::tags_with_opening_and_closing_tags":0,"ParseTest::attributes_enclosed_in_double_quotes":0,"ParseTest::attributes_enclosed_in_single_quotes":0,"ParseTest::attributes_multiple_attributes":0,"ParseTest::we_can_strip_all_tags":0,"ParseTest::we_can_strip_specified_tag":0,"ParseTest::we_can_get_attributes_for_specified_shortcode":0,"ParseTest::we_can_strip_tags_when_no_tags_specified":0,"ParseTest::we_can_get_the_attributes_from_the_specified_tag":0,"ParseTest::we_can_get_the_attributes_from_all_tags":0.001,"ParseTest::test_we_can_remove_single_shortcode_tag":0,"ParseTest::test_we_can_remove_all_shortcode_tags":0,"ParseTest::shortcode_tags_can_be_escaped":0,"ParseTest::content_with_no_shortcodes":0,"ParseTest::shortcode_with_hyphens":0,"ParseTest::attribute_with_double_quotes":0,"ParseTest::attribute_with_single_quotes":0,"ParseTest::single_positional_attribute":0,"ParseTest::attribute_with_url":0,"ParseTest::mixed_attribute_types":0,"ParseTest::magic_properties_are_gettable":0,"ParseTest::exception_is_thrown_when_accessing_uknown_magic_property":0}} \ No newline at end of file diff --git a/tests/ParseTest.php b/tests/ParseTest.php index 43033f3..7797009 100644 --- a/tests/ParseTest.php +++ b/tests/ParseTest.php @@ -232,8 +232,6 @@ public function we_can_get_the_attributes_from_all_tags() ]], ]; - $shortcodes = new Shortcodes(); - $this->assertEquals( $expected, $shortcodes->getShortcodes('This is some [foo bar=baz qux=foo] [foo bar=baz qux=foo] [bar bar=baz qux=foo] content') From bcf00b096037ebc6351fde93620ad2dc8cf7ccd1 Mon Sep 17 00:00:00 2001 From: Mark Beech Date: Wed, 22 Jun 2022 22:12:49 +0100 Subject: [PATCH 13/15] wip --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3f53d61..df5bdb8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,7 +12,7 @@ jobs: strategy: fail-fast: true matrix: - php: [5.3, 5.4, 5.5, 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1] + php: [7.4, 8.0, 8.1] name: PHP:${{ matrix.php }} From acccfbf27a463887120fffc0b6ba0088638ff45d Mon Sep 17 00:00:00 2001 From: Mark Beech Date: Wed, 22 Jun 2022 22:18:54 +0100 Subject: [PATCH 14/15] wip --- .github/workflows/tests.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index df5bdb8..d10d507 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -44,4 +44,11 @@ jobs: - name: Run Unit tests run: | - vendor/bin/phpunit --coverage-clover=tests/logs/clover.xml \ No newline at end of file + vendor/bin/phpunit --coverage-clover=tests/logs/clover.xml + + - name: Upload coverage results to Coveralls + env: + COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + composer global require php-coveralls/php-coveralls "^1.0" + coveralls --coverage_clover=tests/logs/clover.xml -v \ No newline at end of file From 07c9037bbe43599581491bec1b82a99bbffa5a53 Mon Sep 17 00:00:00 2001 From: Mark Beech Date: Wed, 22 Jun 2022 22:20:27 +0100 Subject: [PATCH 15/15] wip --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d10d507..d003d36 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -50,5 +50,5 @@ jobs: env: COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - composer global require php-coveralls/php-coveralls "^1.0" + composer global require php-coveralls/php-coveralls "^2.0" coveralls --coverage_clover=tests/logs/clover.xml -v \ No newline at end of file