Skip to content

Commit

Permalink
add unitTest_WidgetArea_setWidgets
Browse files Browse the repository at this point in the history
  • Loading branch information
thangnn committed May 7, 2024
1 parent 3ae812d commit d0a746b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions plugins/bc-widget-area/src/Model/Entity/WidgetArea.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ protected function _getWidgetsArray()
* @return string|null
* @checked
* @noTodo
* @unitTest
*/
protected function _setWidgets($value)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,20 @@ public function test_getWidgetsArray()
*/
public function test_setWidgets()
{
$this->markTestIncomplete('こちらのテストはまだ未確認です');
$widgetArea = new WidgetArea();

//正常系実行
$setWidgets = $this->execPrivateMethod($widgetArea, '_setWidgets',
[['test' => ['sort' => 1, 'name' => 'test']]]);
$this->assertEquals('YToxOntzOjQ6InRlc3QiO2E6Mjp7czo0OiJzb3J0IjtpOjE7czo0OiJuYW1lIjtzOjQ6InRlc3QiO319',
$setWidgets);

//case is not array
$setWidgets = $this->execPrivateMethod($widgetArea, '_setWidgets', ['test']);
$this->assertEquals('test', $setWidgets);

//case is array but value is empty
$setWidgets = $this->execPrivateMethod($widgetArea, '_setWidgets', [[]]);
$this->assertNull($setWidgets);
}
}

0 comments on commit d0a746b

Please sign in to comment.