FOSSology  4.4.0
Open Source License Compliance by Open Source Software
ItemTreeBoundsTest.php
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2014 Siemens AG
4 
5  SPDX-License-Identifier: GPL-2.0-only
6 */
7 
8 namespace Fossology\Lib\Dao\Data;
9 
11 
12 class ItemTreeBoundsTest extends \PHPUnit\Framework\TestCase
13 {
14 
18  private $itemTreeBounds;
19 
20  private $uploadTreeTableName = "uploadTreeTable";
21 
22  private $uploadId = 43;
23 
24  private $uploadTreeId = 8;
25 
26  private $left = 12;
27 
28  private $right = 26;
29 
30  protected function setUp() : void
31  {
32  $this->itemTreeBounds = new ItemTreeBounds($this->uploadTreeId, $this->uploadTreeTableName, $this->uploadId, $this->left, $this->right);
33  }
34 
35  public function testGetUploadTreeTableName()
36  {
37  assertThat($this->itemTreeBounds->getUploadTreeTableName(), is($this->uploadTreeTableName));
38  }
39 
40  public function testGetUploadTreeID()
41  {
42  assertThat($this->itemTreeBounds->getItemId(), is($this->uploadTreeId));
43  }
44 
45  public function testGetUploadId()
46  {
47  assertThat($this->itemTreeBounds->getUploadId(), is($this->uploadId));
48  }
49 
50  public function testGetLeft()
51  {
52  assertThat($this->itemTreeBounds->getLeft(), is($this->left));
53  }
54 
55  public function testGetRight()
56  {
57  assertThat($this->itemTreeBounds->getRight(), is($this->right));
58  }
59 
60  public function testContainsFiles()
61  {
62  assertThat($this->itemTreeBounds->containsFiles(), is(true));
63 
64  $this->itemTreeBounds = new ItemTreeBounds($this->uploadTreeId, $this->uploadTreeTableName, $this->uploadId, $this->left, $this->left + 2);
65 
66  assertThat($this->itemTreeBounds->containsFiles(), is(true));
67 
68  $this->itemTreeBounds = new ItemTreeBounds($this->uploadTreeId, $this->uploadTreeTableName, $this->uploadId, $this->left, $this->left + 1);
69 
70  assertThat($this->itemTreeBounds->containsFiles(), is(false));
71  }
72 }