Add findActionGroupById
This commit is contained in:
@@ -106,6 +106,22 @@ class CharacterViewpoint implements CreateableInterface
|
||||
$this->actionGroups = $actionGroups;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds an action group by id.
|
||||
* @param $actionGroupId
|
||||
* @return ActionGroup|null
|
||||
*/
|
||||
public function findActionGroupById(string $actionGroupId)
|
||||
{
|
||||
$groups = $this->getActionGroups();
|
||||
foreach ($groups as $g) {
|
||||
if ($g->getId() == $actionGroupId) {
|
||||
return $g;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all attachments.
|
||||
* @return array
|
||||
|
||||
@@ -103,6 +103,9 @@ class CharacterViewpointTest extends CoreModelTestCase
|
||||
|
||||
$output = $em->getRepository(CharacterViewpoint::class)->find(2);
|
||||
$this->assertEquals($actionGroups, $output->getActionGroups());
|
||||
|
||||
$this->assertEquals($ag2, $input->findActionGroupById('id2'));
|
||||
$this->assertNull($input->findActionGroupById('not-there'));
|
||||
}
|
||||
|
||||
public function testAttachments()
|
||||
|
||||
Reference in New Issue
Block a user