Skip to content

Commit 1bfee35

Browse files
committed
Migrate another class (maybe fail...)
1 parent 532dedd commit 1bfee35

File tree

1 file changed

+19
-20
lines changed

1 file changed

+19
-20
lines changed

tests/Integration/Deploy/RepositoryTest.php

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -31,29 +31,18 @@
3131
* ---------------------------------------------------------------------
3232
*/
3333

34-
use PHPUnit\Framework\TestCase;
34+
use Glpi\Tests\DbTestCase;
3535

36-
class RepositoryTest extends TestCase
36+
class RepositoryTest extends DbTestCase
3737
{
38-
private $packages_1_id = 0;
39-
private $packages_2_id = 0;
40-
private $filename = "";
41-
private $sha512 = "";
38+
private int $packages_1_id = 0;
39+
private int $packages_2_id = 0;
40+
private string $filename = "";
41+
private string $sha512 = "";
4242

43-
public static function setUpBeforeClass(): void
43+
public function setUp(): void
4444
{
45-
46-
// Delete all packages
47-
$pfDeployPackage = new PluginGlpiinventoryDeployPackage();
48-
$items = $pfDeployPackage->find();
49-
foreach ($items as $item) {
50-
$pfDeployPackage->delete(['id' => $item['id']], true);
51-
}
52-
}
53-
54-
protected function setUp(): void
55-
{
56-
45+
parent::setUp();
5746
$pfDeployPackage = new PluginGlpiinventoryDeployPackage();
5847

5948
// create a package
@@ -78,8 +67,18 @@ protected function setUp(): void
7867
$this->sha512 = hash_file('sha512', $this->filename);
7968
}
8069

70+
public function tearDown(): void
71+
{
72+
// remove created file in upload folder
73+
if (file_exists($this->filename)) {
74+
unlink($this->filename);
75+
}
76+
77+
parent::tearDown();
78+
}
79+
8180

82-
public function testCleanFiles()
81+
public function testCleanFiles(): void
8382
{
8483
$pfDeployPackage = new PluginGlpiinventoryDeployPackage();
8584
$pfDeployFile = new PluginGlpiinventoryDeployFile();

0 commit comments

Comments
 (0)