FOSSology  4.5.1
Open Source License Compliance by Open Source Software
ObligationTest.php
Go to the documentation of this file.
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2021 Siemens AG
4  Author: Gaurav Mishra <mishra.gaurav@siemens.com>
5 
6  SPDX-License-Identifier: GPL-2.0-only
7 */
14 
16 use PHPUnit\Framework\TestCase;
17 
22 class ObligationTest extends TestCase
23 {
25 
31  public function testConstructor()
32  {
33  $obligation = new Obligation("123", 'My obligation', 'Obligation',
34  'This should represent some valid obligation text.', 'yellow');
35  $this->assertInstanceOf(Obligation::class, $obligation);
36  }
37 
42  public function testDataFormat()
43  {
44  $expectedObligation = [
45  'id' => 123,
46  'topic' => 'My obligation',
47  'type' => 'Obligation',
48  'text' => 'This should represent some valid obligation text.',
49  'classification' => 'yellow',
50  'comment' => ""
51  ];
52 
53  $actualObligation = new Obligation("123", 'My obligation', 'Obligation',
54  'This should represent some valid obligation text.', 'yellow');
55 
56  $this->assertEquals($expectedObligation, $actualObligation->getArray());
57  }
58 }