Skip to content

Conversation

@ademarco
Copy link
Contributor

@ademarco ademarco commented Dec 8, 2017

This is a test PR to assess if PHP 7 is actually a required dependency or if the project can work on PHP 5.6 too.

@ademarco ademarco changed the title Remove PHP 7 dependency Make sure latest version works on both PHP 5.6 and 7 Dec 10, 2017
@ademarco
Copy link
Contributor Author

ademarco commented Dec 10, 2017

@lstrojny this PR fixes tests allowing the latest version of the library to run on both PHP 7 and 5.6.

@lstrojny
Copy link
Contributor

I would prefer not to go back to PHPUnit 5 but instead have a test suite that works with both 5 and 6, which should be relatively trivial. That way we can have both: 5.6 compatibility on the one hand but support for PHPUnit 6 as well.

@ademarco
Copy link
Contributor Author

ademarco commented Dec 11, 2017

The problem is that PHPUnit 6 requires PHP 7, so we don't have much choice if we want to support both 5.6 and 7 at the same time than to rollback to PHPUnit 5.

@lstrojny
Copy link
Contributor

@ademarco what about requiring "5|6" and having a tiny compatibility layer?

@ademarco
Copy link
Contributor Author

Yep, that can be interesting, I'll try that!

@ademarco
Copy link
Contributor Author

There we go! \cc @lstrojny

$this->assertSame('post-value', $this->http['firstNamedServer']->requests->latest()->getPostField('post-key'));
}

public function testFatalError()
Copy link
Contributor

Choose a reason for hiding this comment

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

We can have this test back for PHP 7, can’t we?

$this->tearDown();
$this->fail('Exception expected');
} catch (ExpectationFailedException $e) {
} catch (\PHPUnit_Framework_ExpectationFailedException $e) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This exception class is not available in PHPUnit 6, is it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, that's correct, but there isn't a compatibility layer on PHPUnit 5.7 for that, so the only option is to fall back to \Exception.

It turned out that we were running on phpunit 5.7 also on php7 due to the phpmock object dependencies, I'll fix that making sure to offer a compatible alternative for that too.

);
}

public function testFatalError()
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here, since it checks for 7.0, it should work fine

@ademarco
Copy link
Contributor Author

@lstrojny Ok tests are back and now we use phpunit 6 on php 7 and phpunit 5.7 on php 5.6.

@lstrojny lstrojny merged commit f7e727d into InterNations:master Dec 21, 2017
@lstrojny
Copy link
Contributor

Thank you!

@ademarco
Copy link
Contributor Author

Great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants