FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
ItemTreeBoundsTest.php
1 <?php
2 /*
3 Copyright (C) 2014, Siemens AG
4 
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 version 2 as published by the Free Software Foundation.
8 
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13 
14 You should have received a copy of the GNU General Public License along
15 with this program; if not, write to the Free Software Foundation, Inc.,
16 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18 
19 namespace Fossology\Lib\Dao\Data;
20 
22 
23 class ItemTreeBoundsTest extends \PHPUnit\Framework\TestCase
24 {
25 
29  private $itemTreeBounds;
30 
31  private $uploadTreeTableName = "uploadTreeTable";
32 
33  private $uploadId = 43;
34 
35  private $uploadTreeId = 8;
36 
37  private $left = 12;
38 
39  private $right = 26;
40 
41  protected function setUp()
42  {
43  $this->itemTreeBounds = new ItemTreeBounds($this->uploadTreeId, $this->uploadTreeTableName, $this->uploadId, $this->left, $this->right);
44  }
45 
46  public function testGetUploadTreeTableName()
47  {
48  assertThat($this->itemTreeBounds->getUploadTreeTableName(), is($this->uploadTreeTableName));
49  }
50 
51  public function testGetUploadTreeID()
52  {
53  assertThat($this->itemTreeBounds->getItemId(), is($this->uploadTreeId));
54  }
55 
56  public function testGetUploadId()
57  {
58  assertThat($this->itemTreeBounds->getUploadId(), is($this->uploadId));
59  }
60 
61  public function testGetLeft()
62  {
63  assertThat($this->itemTreeBounds->getLeft(), is($this->left));
64  }
65 
66  public function testGetRight()
67  {
68  assertThat($this->itemTreeBounds->getRight(), is($this->right));
69  }
70 
71  public function testContainsFiles()
72  {
73  assertThat($this->itemTreeBounds->containsFiles(), is(true));
74 
75  $this->itemTreeBounds = new ItemTreeBounds($this->uploadTreeId, $this->uploadTreeTableName, $this->uploadId, $this->left, $this->left + 2);
76 
77  assertThat($this->itemTreeBounds->containsFiles(), is(true));
78 
79  $this->itemTreeBounds = new ItemTreeBounds($this->uploadTreeId, $this->uploadTreeTableName, $this->uploadId, $this->left, $this->left + 1);
80 
81  assertThat($this->itemTreeBounds->containsFiles(), is(false));
82  }
83 }