From 2d53693ef00beb6ba91bfcb8a974fd8a11e84be1 Mon Sep 17 00:00:00 2001 From: zeroiszero Date: Fri, 13 Sep 2019 12:52:46 +0800 Subject: [PATCH] make test case compatible with phpunit 6 (#1) * make test case compatible with phpunit 6 * fix: undefined function `snake_case` * fix: remove Type declarations --- src/AdvancedCustomFields.php | 3 ++- tests/BasicFieldsTest.php | 4 ++-- tests/ChoicesFieldsTest.php | 2 +- tests/ContentFieldsTest.php | 4 ++-- tests/CorcelIntegrationTest.php | 2 +- tests/EmptyBasicFieldsTest.php | 4 ++-- tests/FieldFactoryTest.php | 2 +- tests/JqueryFieldsTest.php | 2 +- tests/LayoutFieldsTest.php | 2 +- tests/RelationalFieldsTest.php | 2 +- 10 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/AdvancedCustomFields.php b/src/AdvancedCustomFields.php index 48e0c03..41005ab 100644 --- a/src/AdvancedCustomFields.php +++ b/src/AdvancedCustomFields.php @@ -4,6 +4,7 @@ use Corcel\Acf\Exception\MissingFieldNameException; use Corcel\Model; +use Illuminate\Support\Str; /** * Class AdvancedCustomFields. @@ -53,7 +54,7 @@ public function __call($name, $arguments) throw new MissingFieldNameException('The field name is missing'); } - $field = FieldFactory::make($arguments[0], $this->post, snake_case($name)); + $field = FieldFactory::make($arguments[0], $this->post, Str::snake($name)); return $field ? $field->get() : null; } diff --git a/tests/BasicFieldsTest.php b/tests/BasicFieldsTest.php index cd2ffd0..b82f304 100644 --- a/tests/BasicFieldsTest.php +++ b/tests/BasicFieldsTest.php @@ -8,7 +8,7 @@ * * @author Junior Grossi */ -class BasicFieldsTest extends PHPUnit_Framework_TestCase +class BasicFieldsTest extends PHPUnit\Framework\TestCase { /** * @var Post @@ -18,7 +18,7 @@ class BasicFieldsTest extends PHPUnit_Framework_TestCase /** * Setup a base $this->post object to represent the page with the basic fields. */ - protected function setUp() + public function setUp() { $this->post = Post::find(11); // it' a page with the custom fields } diff --git a/tests/ChoicesFieldsTest.php b/tests/ChoicesFieldsTest.php index 8f2c67c..dcba6da 100644 --- a/tests/ChoicesFieldsTest.php +++ b/tests/ChoicesFieldsTest.php @@ -9,7 +9,7 @@ * * @author Junior Grossi */ -class ChoicesFieldsTest extends PHPUnit_Framework_TestCase +class ChoicesFieldsTest extends PHPUnit\Framework\TestCase { /** * @var Post diff --git a/tests/ContentFieldsTest.php b/tests/ContentFieldsTest.php index c45ced5..a55cfa9 100644 --- a/tests/ContentFieldsTest.php +++ b/tests/ContentFieldsTest.php @@ -11,7 +11,7 @@ * * @author Junior Grossi */ -class ContentFieldsTest extends PHPUnit_Framework_TestCase +class ContentFieldsTest extends PHPUnit\Framework\TestCase { /** * @var Post @@ -21,7 +21,7 @@ class ContentFieldsTest extends PHPUnit_Framework_TestCase /** * Setup a base $this->post object to represent the page with the content fields. */ - protected function setUp() + public function setUp() { $this->post = Post::find(21); // it' a page with the custom fields } diff --git a/tests/CorcelIntegrationTest.php b/tests/CorcelIntegrationTest.php index bae0e8e..62ed815 100644 --- a/tests/CorcelIntegrationTest.php +++ b/tests/CorcelIntegrationTest.php @@ -7,7 +7,7 @@ * * @author Junior Grossi */ -class CorcelIntegrationTest extends PHPUnit_Framework_TestCase +class CorcelIntegrationTest extends PHPUnit\Framework\TestCase { public function testIfCorcelIntegrationIsWorking() { diff --git a/tests/EmptyBasicFieldsTest.php b/tests/EmptyBasicFieldsTest.php index b7258f6..9e3bf97 100644 --- a/tests/EmptyBasicFieldsTest.php +++ b/tests/EmptyBasicFieldsTest.php @@ -9,7 +9,7 @@ * * @author Junior Grossi */ -class EmptyBasicFieldsTest extends PHPUnit_Framework_TestCase +class EmptyBasicFieldsTest extends PHPUnit\Framework\TestCase { /** * @var Post @@ -19,7 +19,7 @@ class EmptyBasicFieldsTest extends PHPUnit_Framework_TestCase /** * Setup a base $this->post object to represent the page with the basic fields. */ - protected function setUp() + public function setUp() { $this->post = Post::find(91); // it' a page with empty custom fields } diff --git a/tests/FieldFactoryTest.php b/tests/FieldFactoryTest.php index 083472d..5950cac 100644 --- a/tests/FieldFactoryTest.php +++ b/tests/FieldFactoryTest.php @@ -8,7 +8,7 @@ * * @author Junior Grossi */ -class FieldFactoryTest extends PHPUnit_Framework_TestCase +class FieldFactoryTest extends PHPUnit\Framework\TestCase { public function testInvalidFieldName() { diff --git a/tests/JqueryFieldsTest.php b/tests/JqueryFieldsTest.php index dcb22f7..8b25ddd 100644 --- a/tests/JqueryFieldsTest.php +++ b/tests/JqueryFieldsTest.php @@ -4,7 +4,7 @@ use Corcel\Acf\Field\Text; use Corcel\Model\Post; -class JqueryFieldsTests extends PHPUnit_Framework_TestCase +class JqueryFieldsTests extends PHPUnit\Framework\TestCase { /** * @var Post diff --git a/tests/LayoutFieldsTest.php b/tests/LayoutFieldsTest.php index ee139fd..b84a213 100644 --- a/tests/LayoutFieldsTest.php +++ b/tests/LayoutFieldsTest.php @@ -9,7 +9,7 @@ * * @author Junior Grossi */ -class LayoutFieldsTest extends PHPUnit_Framework_TestCase +class LayoutFieldsTest extends PHPUnit\Framework\TestCase { public function testRepeaterField() { diff --git a/tests/RelationalFieldsTest.php b/tests/RelationalFieldsTest.php index 704d6e4..9dbce91 100644 --- a/tests/RelationalFieldsTest.php +++ b/tests/RelationalFieldsTest.php @@ -11,7 +11,7 @@ * * @author Junior Grossi */ -class RelationalFieldsTests extends PHPUnit_Framework_TestCase +class RelationalFieldsTests extends PHPUnit\Framework\TestCase { /** * @var Post