Skip to content
This repository was archived by the owner on Jan 31, 2020. It is now read-only.

Impove testing and add php 7.1 and 7.2 support #87

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 32 additions & 31 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,59 +2,60 @@ sudo: false

language: php

branches:
except:
- /^release-.*$/
- /^ghgfk-.*$/

cache:
directories:
- $HOME/.composer/cache
- $HOME/.local
- zf-mkdoc-theme

env:
global:
- SITE_URL: https://zendframework.github.io/zend-stdlib
- GH_USER_NAME: "Matthew Weier O'Phinney"
- GH_USER_EMAIL: matthew@weierophinney.net
- GH_REF: github.com/zendframework/zend-stdlib.git
- secure: "l+YU9Igd9IUA60PE+iC4AZt2hHY9hpsSB7S2jck9fjPm0+15UCGk2G1qg5hCi+FlPslXhk6wOLLDPc40BiCrwH+m5CP9cIdkGTuNc9rVF9S5IiRLkOVxeTcdE+JRm7hZ2NBgxEiTuBLs5RlN39o41zPDFllgnJv69UmmUIMHuG3NwJJiRE9NA2EMIhZwx3UT/Zqq94MzAbYXi2xspoQ53Z/rfvVSJK6tdARp31q4NWvlYsc2YVcEWv+j3VY5luMSCMVQVNBIuXdd0hYpGt2o3H6S9azzcKRQB7saoAT/tiAEj5121tv3j3cKNQQMzI4xv7RrtQEiAhumeU3AsVDyqBmqqUQNwpnWH0RZdRry4jUKJgx0TK0yZH8ewdz6DhktBqS+c2a/FzfO3yc+LeuIy3i73NezNwCgwviOBYbWPAo4LqKtJ7gdTbVVdJaUeCtKTZ1b1k4MtaxjZjz0IK5+rxJsZ1DQF5fhJIzkjXqEEON2mHQu/qE+I7ow4Jvfs0T+KYJW6Yf5qFzBkrTUNjV60rmawaEjgxgMvtwN+MvcQ/X2OWkdjdzqzQIDdjssdRu9IBPU/G2uqzS8POL9o1j8H3NE430Tsbg+jiENlqmU+ra5wuRrmTBToli1kpgl9LyhgvjGokxAB+mwwKv7FiIQtBmSgEvsD112eSYl3HVWpdE="
- COMPOSER_ARGS="--no-interaction --no-plugins"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need --no-plugins flag here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's default flag in many zf repos

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm... I don't know where you can see it. Definitely we don't have it in template in the maintainers repo: https://github.com/zendframework/maintainers/blob/master/template/.travis.yml#L11

- COVERAGE_DEPS="satooshi/php-coveralls"

matrix:
include:
- php: 5.6
env:
- TEST_COVERAGE=true
- DEPLOY_DOCS="$(if [[ $TRAVIS_BRANCH == 'master' && $TRAVIS_PULL_REQUEST == 'false' ]]; then echo -n 'true' ; else echo -n 'false' ; fi)"
- PATH="$HOME/.local/bin:$PATH"
- DEPS=lowest
- php: 5.6
env:
- DEPS=latest
- php: 7
env:
- DEPS=lowest
- php: 7
env:
- DEPS=latest
- php: 7.1
env:
- DEPS=lowest
- php: 7.1
env:
- DEPS=latest
- CS_CHECK=true
- php: hhvm
allow_failures:
- php: hhvm

notifications:
irc: "irc.freenode.org#zftalk.dev"
email: false
- TEST_COVERAGE=true
- php: 7.2
env:
- DEPS=lowest
- php: 7.2
env:
- DEPS=latest

before_install:
- if [[ $TEST_COVERAGE != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi
- composer self-update
- if [[ $TEST_COVERAGE == 'true' ]]; then composer require --dev --no-update satooshi/php-coveralls ; fi

install:
- travis_retry composer install --no-interaction --ignore-platform-reqs
- travis_retry composer install $COMPOSER_ARGS --ignore-platform-reqs
- if [[ $LEGACY_DEPS != '' ]]; then travis_retry composer update --with-dependencies $COMPOSER_ARGS $LEGACY_DEPS ; fi
- if [[ $DEPS == 'lowest' ]]; then travis_retry composer update --prefer-lowest --prefer-stable $COMPOSER_ARGS ; fi
- if [[ $DEPS == 'latest' ]]; then travis_retry composer update $COMPOSER_ARGS ; fi
- stty cols 120 && composer show

script:
- if [[ $TEST_COVERAGE == 'true' ]]; then composer test-coverage ; fi
- if [[ $TEST_COVERAGE != 'true' ]]; then composer test ; fi
- if [[ $TEST_COVERAGE == 'true' ]]; then composer test-coverage ; else composer test ; fi
- if [[ $CS_CHECK == 'true' ]]; then composer cs-check ; fi
- if [[ $DEPLOY_DOCS == "true" && "$TRAVIS_TEST_RESULT" == "0" ]]; then wget -O theme-installer.sh "https://raw.githubusercontent.com/zendframework/zf-mkdoc-theme/master/theme-installer.sh" ; chmod 755 theme-installer.sh ; ./theme-installer.sh ; fi

after_success:
- if [[ $DEPLOY_DOCS == "true" ]]; then echo "Preparing to build and deploy documentation" ; ./zf-mkdoc-theme/deploy.sh ; echo "Completed deploying documentation" ; fi

after_script:
- if [[ $TEST_COVERAGE == 'true' ]]; then composer upload-coverage ; fi

notifications:
email: false
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"require-dev": {
"athletic/athletic": "~0.1",
"phpunit/PHPUnit": "~4.0",
"phpunit/phpunit": "^5.7.25",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm... not so easy, need more work to update PHPUnit ...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, actually I'm so surprised, tests pass ! We must have there only basic tests then:)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:) One thing to do (in next pr) it's to add support for phpunit 6.

"zendframework/zend-coding-standard": "~1.0.0"
},
"extra": {
Expand Down
121 changes: 42 additions & 79 deletions test/StringWrapper/CommonStringWrapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,75 +138,47 @@ public function wordWrapProvider()
{
return [
// Standard cut tests
'cut-single-line' =>
['utf-8', 'äbüöcß', 2, ' ', true, 'äb üö cß'],
'cut-multi-line' =>
['utf-8', 'äbüöc ß äbüöcß', 2, ' ', true, 'äb üö c ß äb üö cß'],
'cut-multi-line-short-words' =>
['utf-8', 'Ä very long wöööööööööööörd.', 8, "\n", true,
"Ä very\nlong\nwööööööö\nööööörd."],
'cut-multi-line-with-previous-new-lines' =>
['utf-8', "Ä very\nlong wöööööööööööörd.", 8, "\n", false,
"Ä very\nlong\nwöööööööööööörd."],
'long-break' =>
['utf-8', "Ä very<br>long wöö<br>öööööööö<br>öörd.", 8, '<br>', false,
"Ä very<br>long wöö<br>öööööööö<br>öörd."],
'cut-single-line' => ['utf-8', 'äbüöcß', 2, ' ', true, 'äb üö cß'],
'cut-multi-line' => ['utf-8', 'äbüöc ß äbüöcß', 2, ' ', true, 'äb üö c ß äb üö cß'],
'cut-multi-line-short-words' => ['utf-8', 'Ä very long wöööööööööööörd.', 8, "\n", true,
"Ä very\nlong\nwööööööö\nööööörd."],
'cut-multi-line-with-previous-new-lines' => ['utf-8', "Ä very\nlong wöööööööööööörd.",
8, "\n", false, "Ä very\nlong\nwöööööööööööörd."],
'long-break' => ['utf-8', "Ä very<br>long wöö<br>öööööööö<br>öörd.", 8, '<br>', false,
"Ä very<br>long wöö<br>öööööööö<br>öörd."],

// Alternative cut tests
'cut-beginning-single-space' =>
['utf-8', ' äüöäöü', 3, ' ', true, ' äüö äöü'],
'cut-ending-single-space' =>
['utf-8', 'äüöäöü ', 3, ' ', true, 'äüö äöü '],
'cut-ending-single-space-with-non-space-divider' =>
['utf-8', 'äöüäöü ', 3, '-', true, 'äöü-äöü-'],
'cut-ending-two-spaces' =>
['utf-8', 'äüöäöü ', 3, ' ', true, 'äüö äöü '],
'no-cut-ending-single-space' =>
['utf-8', '12345 ', 5, '-', false, '12345-'],
'no-cut-ending-two-spaces' =>
['utf-8', '12345 ', 5, '-', false, '12345- '],
'cut-ending-three-spaces' =>
['utf-8', 'äüöäöü ', 3, ' ', true, 'äüö äöü '],
'cut-ending-two-breaks' =>
['utf-8', 'äüöäöü--', 3, '-', true, 'äüö-äöü--'],
'cut-tab' =>
['utf-8', "äbü\töcß", 3, ' ', true, "äbü \töc ß"],
'cut-new-line-with-space' =>
['utf-8', "äbü\nößt", 3, ' ', true, "äbü \nöß t"],
'cut-new-line-with-new-line' =>
['utf-8', "äbü\nößte", 3, "\n", true, "äbü\nößt\ne"],
'cut-beginning-single-space' => ['utf-8', ' äüöäöü', 3, ' ', true, ' äüö äöü'],
'cut-ending-single-space' => ['utf-8', 'äüöäöü ', 3, ' ', true, 'äüö äöü '],
'cut-ending-single-space-with-non-space-divider' => ['utf-8', 'äöüäöü ', 3, '-', true,
'äöü-äöü-'],
'cut-ending-two-spaces' => ['utf-8', 'äüöäöü ', 3, ' ', true, 'äüö äöü '],
'no-cut-ending-single-space' => ['utf-8', '12345 ', 5, '-', false, '12345-'],
'no-cut-ending-two-spaces' => ['utf-8', '12345 ', 5, '-', false, '12345- '],
'cut-ending-three-spaces' => ['utf-8', 'äüöäöü ', 3, ' ', true, 'äüö äöü '],
'cut-ending-two-breaks' => ['utf-8', 'äüöäöü--', 3, '-', true, 'äüö-äöü--'],
'cut-tab' => ['utf-8', "äbü\töcß", 3, ' ', true, "äbü \töc ß"],
'cut-new-line-with-space' => ['utf-8', "äbü\nößt", 3, ' ', true, "äbü \nöß t"],
'cut-new-line-with-new-line' => ['utf-8', "äbü\nößte", 3, "\n", true, "äbü\nößt\ne"],

// Break cut tests
'cut-break-before' =>
['ascii', 'foobar-foofoofoo', 8, '-', true, 'foobar-foofoofo-o'],
'cut-break-with' =>
['ascii', 'foobar-foobar', 6, '-', true, 'foobar-foobar'],
'cut-break-within' =>
['ascii', 'foobar-foobar', 7, '-', true, 'foobar-foobar'],
'cut-break-within-end' =>
['ascii', 'foobar-', 7, '-', true, 'foobar-'],
'cut-break-after' =>
['ascii', 'foobar-foobar', 5, '-', true, 'fooba-r-fooba-r'],
'cut-break-before' => ['ascii', 'foobar-foofoofoo', 8, '-', true, 'foobar-foofoofo-o'],
'cut-break-with' => ['ascii', 'foobar-foobar', 6, '-', true, 'foobar-foobar'],
'cut-break-within' => ['ascii', 'foobar-foobar', 7, '-', true, 'foobar-foobar'],
'cut-break-within-end' => ['ascii', 'foobar-', 7, '-', true, 'foobar-'],
'cut-break-after' => ['ascii', 'foobar-foobar', 5, '-', true, 'fooba-r-fooba-r'],

// Standard no-cut tests
'no-cut-single-line' =>
['utf-8', 'äbüöcß', 2, ' ', false, 'äbüöcß'],
'no-cut-multi-line' =>
['utf-8', 'äbüöc ß äbüöcß', 2, "\n", false, "äbüöc\nß\näbüöcß"],
'no-cut-multi-word' =>
['utf-8', 'äöü äöü äöü', 5, "\n", false, "äöü\näöü\näöü"],
'no-cut-single-line' => ['utf-8', 'äbüöcß', 2, ' ', false, 'äbüöcß'],
'no-cut-multi-line' => ['utf-8', 'äbüöc ß äbüöcß', 2, "\n", false, "äbüöc\nß\näbüöcß"],
'no-cut-multi-word' => ['utf-8', 'äöü äöü äöü', 5, "\n", false, "äöü\näöü\näöü"],

// Break no-cut tests
'no-cut-break-before' =>
['ascii', 'foobar-foofoofoo', 8, '-', false, 'foobar-foofoofoo'],
'no-cut-break-with' =>
['ascii', 'foobar-foobar', 6, '-', false, 'foobar-foobar'],
'no-cut-break-within' =>
['ascii', 'foobar-foobar', 7, '-', false, 'foobar-foobar'],
'no-cut-break-within-end' =>
['ascii', 'foobar-', 7, '-', false, 'foobar-'],
'no-cut-break-after' =>
['ascii', 'foobar-foobar', 5, '-', false, 'foobar-foobar'],
'no-cut-break-before' => ['ascii', 'foobar-foofoofoo', 8, '-', false, 'foobar-foofoofoo'],
'no-cut-break-with' => ['ascii', 'foobar-foobar', 6, '-', false, 'foobar-foobar'],
'no-cut-break-within' => ['ascii', 'foobar-foobar', 7, '-', false, 'foobar-foobar'],
'no-cut-break-within-end' => ['ascii', 'foobar-', 7, '-', false, 'foobar-'],
'no-cut-break-after' => ['ascii', 'foobar-foobar', 5, '-', false, 'foobar-foobar'],
];
}

Expand Down Expand Up @@ -248,28 +220,19 @@ public function strPadProvider()
{
return [
// single-byte
'left-padding_single-byte' =>
['ascii', 'aaa', 5, 'o', STR_PAD_LEFT, 'ooaaa'],
'center-padding_single-byte' =>
['ascii', 'aaa', 6, 'o', STR_PAD_BOTH, 'oaaaoo'],
'right-padding_single-byte' =>
['ascii', 'aaa', 5, 'o', STR_PAD_RIGHT, 'aaaoo'],
'left-padding_single-byte' => ['ascii', 'aaa', 5, 'o', STR_PAD_LEFT, 'ooaaa'],
'center-padding_single-byte' => ['ascii', 'aaa', 6, 'o', STR_PAD_BOTH, 'oaaaoo'],
'right-padding_single-byte' => ['ascii', 'aaa', 5, 'o', STR_PAD_RIGHT, 'aaaoo'],

// multi-byte
'left-padding_multi-byte' =>
['utf-8', 'äää', 5, 'ö', STR_PAD_LEFT, 'ööäää'],
'center-padding_multi-byte' =>
['utf-8', 'äää', 6, 'ö', STR_PAD_BOTH, 'öäääöö'],
'right-padding_multi-byte' =>
['utf-8', 'äää', 5, 'ö', STR_PAD_RIGHT, 'äääöö'],
'left-padding_multi-byte' => ['utf-8', 'äää', 5, 'ö', STR_PAD_LEFT, 'ööäää'],
'center-padding_multi-byte' => ['utf-8', 'äää', 6, 'ö', STR_PAD_BOTH, 'öäääöö'],
'right-padding_multi-byte' => ['utf-8', 'äää', 5, 'ö', STR_PAD_RIGHT, 'äääöö'],

// ZF-12186
'input-longer-than-pad-length' =>
['utf-8', 'äääöö', 2, 'ö', STR_PAD_RIGHT, 'äääöö'],
'input-same-as-pad-length' =>
['utf-8', 'äääöö', 5, 'ö', STR_PAD_RIGHT, 'äääöö'],
'negative-pad-length' =>
['utf-8', 'äääöö', -2, 'ö', STR_PAD_RIGHT, 'äääöö'],
'input-longer-than-pad-length' => ['utf-8', 'äääöö', 2, 'ö', STR_PAD_RIGHT, 'äääöö'],
'input-same-as-pad-length' => ['utf-8', 'äääöö', 5, 'ö', STR_PAD_RIGHT, 'äääöö'],
'negative-pad-length' => ['utf-8', 'äääöö', -2, 'ö', STR_PAD_RIGHT, 'äääöö'],
];
}

Expand Down
7 changes: 4 additions & 3 deletions test/TestAsset/ArrayObjectObjectCount.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@

class ArrayObjectObjectCount implements \Countable
{
public function count() {
return 42;
}
public function count()
{
return 42;
}
}