From 0a58637ace303153885b952d474965814eafb22c Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Mon, 23 Apr 2018 08:42:13 +0200 Subject: [PATCH 1/6] phpunit compat 5.6 vs 7.x --- tests/BaseObjectTest.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/BaseObjectTest.php b/tests/BaseObjectTest.php index 73eb4720b..f56093b89 100644 --- a/tests/BaseObjectTest.php +++ b/tests/BaseObjectTest.php @@ -7,12 +7,15 @@ namespace Friendica\Test; use Friendica\App; use Friendica\BaseObject; -use PHPUnit_Framework_TestCase; - +// backward compatibility +if (!class_exists('\PHPUnit\Framework\TestCase')) { + class_alias('\PHPUnit_Framework_TestCase', '\PHPUnit\Framework\TestCase'); +} +use \PHPUnit_Framework_TestCase; /** * Tests for the BaseObject class. */ -class BaseObjectTest extends PHPUnit_Framework_TestCase +class BaseObjectTest extends \PHPUnit\Framework\TestCase { /** From c31a54175d6f9be95bc7a05fea2bf4f0b7c3bf6f Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Mon, 23 Apr 2018 08:47:42 +0200 Subject: [PATCH 2/6] comment out use clause --- tests/BaseObjectTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/BaseObjectTest.php b/tests/BaseObjectTest.php index f56093b89..4a60b9ec3 100644 --- a/tests/BaseObjectTest.php +++ b/tests/BaseObjectTest.php @@ -11,7 +11,7 @@ use Friendica\BaseObject; if (!class_exists('\PHPUnit\Framework\TestCase')) { class_alias('\PHPUnit_Framework_TestCase', '\PHPUnit\Framework\TestCase'); } -use \PHPUnit_Framework_TestCase; +#use \PHPUnit_Framework_TestCase; /** * Tests for the BaseObject class. */ From 61a380975b193cf127aa9e38b4aa1e938e0358ff Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Mon, 23 Apr 2018 08:53:46 +0200 Subject: [PATCH 3/6] there are more then 1 test ATM --- tests/TextTest.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/TextTest.php b/tests/TextTest.php index 3a15b9766..5baaa17ac 100644 --- a/tests/TextTest.php +++ b/tests/TextTest.php @@ -5,12 +5,16 @@ namespace Friendica\Test; -use PHPUnit_Framework_TestCase; +//use PHPUnit_Framework_TestCase; +// backward compatibility +if (!class_exists('\PHPUnit\Framework\TestCase')) { + class_alias('\PHPUnit_Framework_TestCase', '\PHPUnit\Framework\TestCase'); +} /** * Tests for text functions. */ -class TextTest extends PHPUnit_Framework_TestCase +class TextTest extends \PHPUnit\Framework\TestCase { /** From f1535c0f01ad3bd86c29126984b37f8a9d465495 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Mon, 23 Apr 2018 09:35:12 +0200 Subject: [PATCH 4/6] use strlen instead of count as above (php7.2 fails) --- tests/TextTest.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/TextTest.php b/tests/TextTest.php index 5baaa17ac..5b2b84bd7 100644 --- a/tests/TextTest.php +++ b/tests/TextTest.php @@ -5,7 +5,6 @@ namespace Friendica\Test; -//use PHPUnit_Framework_TestCase; // backward compatibility if (!class_exists('\PHPUnit\Framework\TestCase')) { class_alias('\PHPUnit_Framework_TestCase', '\PHPUnit\Framework\TestCase'); @@ -65,7 +64,7 @@ class TextTest extends \PHPUnit\Framework\TestCase public function testAutonameLength1() { $autoname1=autoname(1); - $this->assertEquals(1, count($autoname1)); + $this->assertEquals(1, strlen($autoname1)); $autoname2=autoname(1); $this->assertEquals(1, count($autoname2)); From 6e313736f48269b6c3ea2bd44f478eef9795b63d Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Mon, 23 Apr 2018 09:37:06 +0200 Subject: [PATCH 5/6] remove comment --- tests/BaseObjectTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/BaseObjectTest.php b/tests/BaseObjectTest.php index 4a60b9ec3..b7b90b138 100644 --- a/tests/BaseObjectTest.php +++ b/tests/BaseObjectTest.php @@ -11,7 +11,6 @@ use Friendica\BaseObject; if (!class_exists('\PHPUnit\Framework\TestCase')) { class_alias('\PHPUnit_Framework_TestCase', '\PHPUnit\Framework\TestCase'); } -#use \PHPUnit_Framework_TestCase; /** * Tests for the BaseObject class. */ From bcc298204e5c28be9ca49cc858c46f2ee80ad9a5 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Mon, 23 Apr 2018 09:37:56 +0200 Subject: [PATCH 6/6] use strlen instead of count(php7.2 fails) --- tests/TextTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/TextTest.php b/tests/TextTest.php index 5b2b84bd7..3cda2342f 100644 --- a/tests/TextTest.php +++ b/tests/TextTest.php @@ -67,7 +67,7 @@ class TextTest extends \PHPUnit\Framework\TestCase $this->assertEquals(1, strlen($autoname1)); $autoname2=autoname(1); - $this->assertEquals(1, count($autoname2)); + $this->assertEquals(1, strlen($autoname2)); } /**