Skip to content

Commit

Permalink
Run AllTests against PHP 7.3 on travis (matomo-org#14148)
Browse files Browse the repository at this point in the history
* Run AllTests against PHP 7.3 on travis

* use INTL_IDNA_VARIANT_UTS46 for idn_to_utf8

PHP 7.2 deprecated INTL_IDNA_VARIANT_2003 but still uses it as default until 7.4

* Fix test as var_export signature for stdClasses changed in PHP 7.3

see php/php-src@e4e9cd8
  • Loading branch information
sgiehl authored and diosmosis committed Mar 11, 2019
1 parent f7b442a commit a345c2f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Expand Up @@ -63,10 +63,10 @@ matrix:
sudo: false
addons: false
# All tests after another
- php: 7
- php: 7.3
env: TEST_SUITE=AllTests MYSQL_ADAPTER=MYSQLI ALLTEST_EXTRA_OPTIONS="--run-first-half-only"
sudo: required
- php: 7
- php: 7.3
env: TEST_SUITE=AllTests MYSQL_ADAPTER=MYSQLI ALLTEST_EXTRA_OPTIONS="--run-second-half-only"
sudo: required
# UITests use a specific version because the default 5.5 (== 5.5.38) is missing FreeType support
Expand Down
7 changes: 5 additions & 2 deletions plugins/API/tests/Unit/HtmlRendererTest.php
Expand Up @@ -275,6 +275,10 @@ public function test_renderDataTable_shouldRenderDataTableWithComplexMetadata()

$response = $this->builder->renderDataTable($dataTable);

$stdClass = version_compare(PHP_VERSION, 7.3, '>=') ?
"(object) array(\n )," :
"stdClass::__set_state(array(\n )),";

$this->assertEquals('<table id="MultiSites_getAll" border="1">
<thead>
<tr>
Expand All @@ -292,8 +296,7 @@ public function test_renderDataTable_shouldRenderDataTableWithComplexMetadata()
Piwik\Plugins\CoreHome\Columns\Metrics\AverageTimeOnSite::__set_state(array(
)),
1 =&gt;
stdClass::__set_state(array(
)),
' . $stdClass . '
2 =&gt;
Piwik\Date::__set_state(array(
\'timestamp\' =&gt; 1451606400,
Expand Down
4 changes: 2 additions & 2 deletions tests/PHPUnit/Integration/EmailValidatorTest.php
Expand Up @@ -60,7 +60,7 @@ public function test_allCurrentTlds()
if (strpos(mb_strtolower($tld), 'xn--') !== 0) {
$tld = mb_strtolower($tld);
}
$domainNameExtension = idn_to_utf8($tld);
$domainNameExtension = idn_to_utf8($tld, 0, INTL_IDNA_VARIANT_UTS46);
$email = 'test@example.' . $domainNameExtension;

if(!$this->isValid($email)) {
Expand Down Expand Up @@ -101,7 +101,7 @@ public function test_invalidTld()
$tld = mb_strtolower($tld);
}
$this->assertFalse(
$this->isValid('test@example.' . idn_to_utf8($tld))
$this->isValid('test@example.' . idn_to_utf8($tld, 0, INTL_IDNA_VARIANT_UTS46))
);
}
}
Expand Down

0 comments on commit a345c2f

Please sign in to comment.