FOSSology  4.4.0
Open Source License Compliance by Open Source Software
GroupTest.php
Go to the documentation of this file.
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2024 Valens Niyonsenga <valensniyonsenga2003@gmail.com>
4  SPDX-License-Identifier: GPL-2.0-only
5 */
6 
12 
13 
15 use PHPUnit\Framework\TestCase;
16 
17 class GroupTest extends TestCase
18 {
26  private function getGroupInfo()
27  {
28  $expectedArray = [
29  "id" => 4,
30  "name" => "fossy",
31  ];
32  $obj = new Group(4,"fossy");
33  return [
34  'expectedArray' => $expectedArray,
35  'obj' => $obj
36  ];
37  }
38 
44  public function testDataFormat()
45  {
46  $expectedArray = $this->getGroupInfo()['expectedArray'];
47  $group = $this->getGroupInfo()['obj'];
48  $this->assertEquals($expectedArray, $group->getArray());
49  }
50 
56  public function testGetId()
57  {
58  $group = new Group(4, "fossy");
59  $this->assertEquals(4, $group->getId());
60  }
61 
67  public function testSetId()
68  {
69  $group = new Group(4, "fossy");
70  $group->setId(10);
71  $this->assertEquals(10, $group->getId());
72  }
73 
79  public function testGetName()
80  {
81  $group = new Group(4, "fossy");
82  $this->assertEquals("fossy", $group->getName());
83  }
84 
90  public function testSetName()
91  {
92  $group = new Group(4, "fossy");
93  $group->setName("newName");
94  $this->assertEquals("newName", $group->getName());
95  }
96 }