From ffc633b18bba3ecce8c447bfb771d7760db3fa76 Mon Sep 17 00:00:00 2001 From: thangnn Date: Thu, 25 Apr 2024 12:18:01 +0700 Subject: [PATCH 1/2] add unitTest_WidgetArea_getCount --- .../src/Model/Entity/WidgetArea.php | 1 + .../TestCase/Model/Entity/WidgetAreaTest.php | 33 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 plugins/bc-widget-area/tests/TestCase/Model/Entity/WidgetAreaTest.php diff --git a/plugins/bc-widget-area/src/Model/Entity/WidgetArea.php b/plugins/bc-widget-area/src/Model/Entity/WidgetArea.php index 67ad32bddd..6b7bc83ff7 100644 --- a/plugins/bc-widget-area/src/Model/Entity/WidgetArea.php +++ b/plugins/bc-widget-area/src/Model/Entity/WidgetArea.php @@ -105,6 +105,7 @@ protected function _setWidgets($value) * @return int * @checked * @noTodo + * @unitTest */ protected function _getCount() { diff --git a/plugins/bc-widget-area/tests/TestCase/Model/Entity/WidgetAreaTest.php b/plugins/bc-widget-area/tests/TestCase/Model/Entity/WidgetAreaTest.php new file mode 100644 index 0000000000..0dcc291779 --- /dev/null +++ b/plugins/bc-widget-area/tests/TestCase/Model/Entity/WidgetAreaTest.php @@ -0,0 +1,33 @@ +WidgetArea = $this->getTableLocator()->get('BcWidgetArea.WidgetAreas'); + } + + public function tearDown(): void + { + unset($this->WidgetArea); + parent::tearDown(); + } + + /** + * test _getCount + */ + public function test_getCount() + { + $widgetArea = new WidgetArea([ + 'widgets' => 'a:1:{i:0;a:1:{s:4:"test";a:2:{s:4:"sort";i:1;s:4:"name";s:4:"test";}}}', + ]); + $getCount = $this->execPrivateMethod($widgetArea, '_getCount', []); + $this->assertEquals(1, $getCount); + } +} \ No newline at end of file From 3021e098ec7e383903ead56d82252dd8cdfa8cc6 Mon Sep 17 00:00:00 2001 From: thangnn Date: Thu, 25 Apr 2024 14:00:26 +0700 Subject: [PATCH 2/2] modified --- .../TestCase/Model/Entity/WidgetAreaTest.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/plugins/bc-widget-area/tests/TestCase/Model/Entity/WidgetAreaTest.php b/plugins/bc-widget-area/tests/TestCase/Model/Entity/WidgetAreaTest.php index 0dcc291779..78ac6c3671 100644 --- a/plugins/bc-widget-area/tests/TestCase/Model/Entity/WidgetAreaTest.php +++ b/plugins/bc-widget-area/tests/TestCase/Model/Entity/WidgetAreaTest.php @@ -30,4 +30,20 @@ public function test_getCount() $getCount = $this->execPrivateMethod($widgetArea, '_getCount', []); $this->assertEquals(1, $getCount); } + + /** + * test _getWidgetsArray + */ + public function test_getWidgetsArray() + { + $this->markTestIncomplete('こちらのテストはまだ未確認です'); + } + + /** + * test _setWidgets + */ + public function test_setWidgets() + { + $this->markTestIncomplete('こちらのテストはまだ未確認です'); + } } \ No newline at end of file