Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add CustomLink::isGroupSelectable #3215

Merged
merged 4 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions plugins/bc-custom-content/src/Model/Entity/CustomLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class CustomLink extends Entity
* @return bool
* @checked
* @noTodo
* @unitTest
*/
public function isGroupSelectable(): bool
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php

namespace BcCustomContent\Test\TestCase\Model\Entity;

use BaserCore\TestSuite\BcTestCase;
use BcCustomContent\Model\Entity\CustomField;
use BcCustomContent\Model\Entity\CustomLink;
use CakephpFixtureFactories\Scenario\ScenarioAwareTrait;

class CustomLinkTest extends BcTestCase
{
use ScenarioAwareTrait;


public function setUp(): void
{
parent::setUp();
}

public function tearDown(): void
{
parent::tearDown();
}

/**
* test isGroupSelectable
*/
public function test_isGroupSelectable()
{
//check if custom_field is not group
$customLink = new CustomLink([
'id' => 1,
'custom_table_id' => 1,
'custom_field_id' => 1,
]);
$result = $this->execPrivateMethod($customLink, 'isGroupSelectable', []);
$this->assertTrue($result);
//check if custom_field is group
$customField = new CustomField([
'id' => 1,
'name' => 'test',
'type' => 'group'
]);
$customLink = new CustomLink([
'id' => 1,
'custom_table_id' => 1,
'custom_field_id' => 1,
'custom_field' => $customField
]);
$result = $this->execPrivateMethod($customLink, 'isGroupSelectable', []);
$this->assertFalse($result);
}
}
Loading