Skip to content

Commit

Permalink
Fix ZTS detection (#26)
Browse files Browse the repository at this point in the history
* test: fix PHPUnit ZTS detection

* test: ignore phpstan

* tests: more instead ZTS detection
  • Loading branch information
zeriyoshi authored Nov 27, 2024
1 parent 0f190a8 commit ecd939b
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion ext/tests/php70/array_rand.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ colopl_bc
date.timezone=UTC
--SKIPIF--
<?php
if (PHP_ZTS !== 0) print 'skip ZTS not supported';
if ((bool) PHP_ZTS === true) print 'skip ZTS not supported';
?>
--FILE--
<?php
Expand Down
2 changes: 1 addition & 1 deletion ext/tests/php70/array_rand_zts.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ colopl_bc
date.timezone=UTC
--SKIPIF--
<?php
if (PHP_ZTS === 0 || PHP_ZTS === false) print 'skip NTS not supported';
if ((bool) PHP_ZTS === false) print 'skip NTS not supported';
?>
--FILE--
<?php
Expand Down
2 changes: 1 addition & 1 deletion ext/tests/php70/shuffle.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ colopl_bc
date.timezone=UTC
--SKIPIF--
<?php
if (PHP_ZTS !== 0) print 'skip ZTS not supported';
if ((bool) PHP_ZTS === true) print 'skip ZTS not supported';
?>
--FILE--
<?php
Expand Down
2 changes: 1 addition & 1 deletion ext/tests/php70/shuffle_zts.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ colopl_bc
date.timezone=UTC
--SKIPIF--
<?php
if (PHP_ZTS === 0 || PHP_ZTS === false) print 'skip NTS not supported';
if ((bool) PHP_ZTS === false) print 'skip NTS not supported';
?>
--FILE--
<?php
Expand Down
2 changes: 1 addition & 1 deletion ext/tests/php70/str_shuffle.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ colopl_bc
date.timezone=UTC
--SKIPIF--
<?php
if (PHP_ZTS !== 0) print 'skip ZTS not supported';
if ((bool) PHP_ZTS === true) print 'skip ZTS not supported';
?>
--FILE--
<?php
Expand Down
2 changes: 1 addition & 1 deletion ext/tests/php70/str_shuffle_zts.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ colopl_bc
date.timezone=UTC
--SKIPIF--
<?php
if (PHP_ZTS === 0 || PHP_ZTS === false) print 'skip NTS not supported';
if ((bool) PHP_ZTS === false) print 'skip NTS not supported';
?>
--FILE--
<?php
Expand Down
2 changes: 1 addition & 1 deletion ext/tests/php70/undefined_behavior_compatibility.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ colopl_bc
date.timezone=UTC
--SKIPIF--
<?php
if (PHP_ZTS !== 0) print 'skip ZTS not supported';
if ((bool) PHP_ZTS === true) print 'skip ZTS not supported';
if (PHP_INT_SIZE !== 8) die("skip this test is for 64bit platform only");
?>
--FILE--
Expand Down
12 changes: 6 additions & 6 deletions tests/Extension/PHP70Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function testSRand(): void
{
\Colopl\ColoplBc\Php70\srand(1234);

if (\PHP_ZTS === 0) {
if ((bool) \PHP_ZTS === false) {
self::assertSame(\Colopl\ColoplBc\Php70\rand(), 479142414);
} else {
self::assertSame(\Colopl\ColoplBc\Php70\rand(), 1584308507);
Expand All @@ -43,7 +43,7 @@ public function testSRandNull(): void
* @psalm-suppress PossiblyNullArgument
*/
\Colopl\ColoplBc\Php70\srand($seed);
if (\PHP_ZTS === 0) {
if ((bool) \PHP_ZTS === false) {
self::assertSame(\Colopl\ColoplBc\Php70\rand(), 1804289383);
} else {
self::assertSame(\Colopl\ColoplBc\Php70\rand(), 1012484);
Expand All @@ -53,7 +53,7 @@ public function testSRandNull(): void
public function testRand(): void
{
\Colopl\ColoplBc\Php70\srand(5678);
if (\PHP_ZTS === 0) {
if ((bool) \PHP_ZTS === false) {
self::assertSame(\Colopl\ColoplBc\Php70\rand(), 1860157456);
} else {
self::assertSame(\Colopl\ColoplBc\Php70\rand(), 1173971923);
Expand All @@ -71,7 +71,7 @@ public function testShuffle(): void
\Colopl\ColoplBc\Php70\srand(1234);
\Colopl\ColoplBc\Php70\shuffle($arr);

if (\PHP_ZTS === 0) {
if ((bool) \PHP_ZTS === false) {
self::assertSame($arr, [2, 3, 4, 1]);
} else {
self::assertSame($arr, [4, 2, 1, 3]);
Expand All @@ -83,7 +83,7 @@ public function testStrShuffle(): void
$str = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.';
\Colopl\ColoplBc\Php70\srand(1234);

if (\PHP_ZTS === 0) {
if ((bool) \PHP_ZTS === false) {
self::assertSame(
\Colopl\ColoplBc\Php70\str_shuffle($str),
'cfapiqi uogi txnrdaeqvnataten ume v aiisalm isiatdaduaeudr eenteotscdm itdenrieuaicii loi aaot imxll ne luecat uri ipp a l moplaur tsarc.eptuisrccdlotep ecorU oeaceqsuerno .t li sa rerldulidieoor i n nd tloiii eeulds ithsnot btrnf ilm a,nuto umdscd viee.amndrueonmce ns dancratmamo inuios ilmo sg a neo ci. eispiisu pueoe umurt denaamlmiu ,loi ptctaurst lrinm usLrdto gru coaetucnuliittro, npemeDnpt s,efdlq q teoiabuEet ert ioinu tlbxoo o '
Expand All @@ -100,7 +100,7 @@ public function testArrayRand(): void
{
\Colopl\ColoplBc\Php70\srand(1234);

if (\PHP_ZTS === 0) {
if ((bool) \PHP_ZTS === false) {
self::assertSame(
\Colopl\ColoplBc\Php70\array_rand([1, 2, 3, 4, 5], 3),
[0, 1, 3]
Expand Down

0 comments on commit ecd939b

Please sign in to comment.