Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add php 7 to travis #1858

Merged
merged 1 commit into from
Dec 21, 2015
Merged

Add php 7 to travis #1858

merged 1 commit into from
Dec 21, 2015

Conversation

dimitri-koenig
Copy link
Contributor

I reworked the travis config to make it all work. At least most of the time the tests run through, so the config is working.

The next step would be to fix failing tests and its source code.

@magento-cicd2
Copy link
Contributor

We have automated a Magento Contributor License Agreement verifier for contributions sent to our GitHub projects.
Please see the CLA agreement in the Pull Request comments below.

@dimitri-koenig
Copy link
Contributor Author

Please merge this PR :-)

@@ -2,6 +2,8 @@ language: php
php:
- 5.5
- 5.6
- 7.0
- hhvm
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see any test results produced by hhvm jobs, here is the example of such: https://travis-ci.org/Sanuch/magento2/builds/47961569

You can take needed changes from @Sanuch fork or remove hhvm occurrences from this PR.

@orlangur
Copy link
Contributor

Very nice to see PHP7 jobs workable on Travis CI at last 👍

@dimitri-koenig dimitri-koenig changed the title Add php 7 and hhvm to travis and extend tests for every plattform Add php 7 to travis Nov 7, 2015
@dimitri-koenig
Copy link
Contributor Author

Did some cleanup and rework of this pr

@davidalger
Copy link
Member

@dimitri-koenig Looking at the Travis CI report there are only 3 failures on the PHP 7 build, specifically unit tests verifying PHP readiness checks. They are failing on something related to the always_populate_raw_post_data php configuration. Think you could take a stab at resolving those 3 failures? It would be great to get tests running on PHP 7, and even better if they all passed. Looks like it's only one small step away. :)

@dimitri-koenig
Copy link
Contributor Author

I really prefer to delegate this to a separate issue and so merge and close this pull request. One small change after another. Deal? :-)

@dimitri-koenig
Copy link
Contributor Author

@davidalger Could you still merge this pull request?

@Vinai
Copy link
Contributor

Vinai commented Nov 23, 2015

The github community team doesn't do merges, that is up to the core team. I think the chances for a merge would be greatly improved if the tests where all passing.
Even though I definitely can relate to favoring multiple smaller PRs, it's not our decision.

@adragus-inviqa
Copy link
Contributor

@dimitri-koenig - I think it's just a simple matter of changing the expected arrays depending on the version of PHP and/or Hack lang, because some array keys in the PHP readiness check will be missing in PHP7/Hack: link.

So, in Magento\Setup\Test\Unit\Model\PhpReadinessCheckTest::testCheckPhpSettingsNoXDebug() (link), instead of

$expected = [
    'responseType' => ResponseTypeInterface::RESPONSE_TYPE_SUCCESS,
    'data' => [
        'always_populate_raw_post_data' => [
            'message' => $rawPostMessage,
            'helpUrl' => 'http://php.net/manual/en/ini.core.php#ini.always-populate-settings-data',
            'error' => false
        ]
    ]
];

you'd do something like

/**
 * @return bool
 */
private function isPhp7OrHackLang()
{
    return version_compare(PHP_VERSION, '7.0.0-beta') >= 0 || defined('HHVM_VERSION');
}

// ...

$expected = [ 'responseType' => ResponseTypeInterface::RESPONSE_TYPE_SUCCESS ];

if (!$this->isPhp7OrHackLang()) {
    $expected['data'] = [
        'always_populate_raw_post_data' => [
            'message' => $rawPostMessage,
            'helpUrl' => 'http://php.net/manual/en/ini.core.php#ini.always-populate-settings-data',
            'error' => false
        ];
}

You'd have to do this 3 times, in the same class - Magento\Setup\Test\Unit\Model\PhpReadinessCheckTest - so you can reuse the isPhp7OrHackLang() and there you go - all PHP7 tests will pass. 🎉

davidalger pushed a commit to davidalger/magento2 that referenced this pull request Nov 24, 2015
@davidalger
Copy link
Member

@adragus-inviqa Thanks for that. I implemented it in a branch on my own fork (see 7bca51c6ab). They still pass on 5.5 and 5.6 but give another strange error under PHP 5.7. Don't have time to try and solve it this week…but maybe next. If I do, and this PR isn't updated, I'll just submit one with the new changes included. If you've got suggestions, I'll take 'em too :)

There were 3 failures:

1) Magento\Setup\Test\Unit\Model\PhpReadinessCheckTest::testCheckPhpSettings
Expectation failed for method name is equal to <string:parseConstraints> when invoked at sequence index 0.
The expected invocation at index 0 was never reached.

2) Magento\Setup\Test\Unit\Model\PhpReadinessCheckTest::testCheckPhpSettingsFailed
Expectation failed for method name is equal to <string:parseConstraints> when invoked at sequence index 0.
The expected invocation at index 0 was never reached.

3) Magento\Setup\Test\Unit\Model\PhpReadinessCheckTest::testCheckPhpSettingsNoXDebug
Expectation failed for method name is equal to <string:parseConstraints> when invoked at sequence index 0.
The expected invocation at index 0 was never reached.

You can see the failing tests with new error messages here: https://travis-ci.org/davidalger/magento2/jobs/93043185

@adragus-inviqa
Copy link
Contributor

Yeah, that's a head scratcher. Not sure what could've changed in 5.7, as that to() seems related to call order.
Or, as one of the comments in here put it: "expect method blah() to be called as the n-th method call on this mock...".

@davidalger
Copy link
Member

@adragus-inviqa That link helped a bunch. There was a mock being setup within a method each of these tests called, but the mock isn't used when running PHP 7. Changed that and the tests all passed! I'm going to submit a PR with the entire set of changes now.

@magento-team magento-team merged commit da282a0 into magento:develop Dec 21, 2015
@dimitri-koenig dimitri-koenig deleted the feature/travis-rework branch December 22, 2015 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants