1
|
|
|
<?php |
2
|
|
|
namespace Gilbertsoft\Lib\Tests\Unit\Service; |
3
|
|
|
|
4
|
|
|
use Gilbertsoft\Lib\Tests\Unit\Fixtures\InstallService; |
5
|
|
|
use TYPO3\CMS\Core\Utility\GeneralUtility; |
6
|
|
|
use TYPO3\CMS\Core\Tests\UnitTestCase; |
7
|
|
|
|
8
|
|
|
class InstallServiceTest extends UnitTestCase |
9
|
|
|
{ |
10
|
|
|
/** |
11
|
|
|
* @var InstallService |
12
|
|
|
*/ |
13
|
|
|
protected $installService; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* @var string Extension key |
17
|
|
|
*/ |
18
|
|
|
protected $extensionKey; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Returns a new InstallService instance. |
22
|
|
|
*/ |
23
|
|
|
protected function createInstallService($extensionKey) |
24
|
|
|
{ |
25
|
|
|
return $this->installService = GeneralUtility::makeInstance(InstallService::class, $extensionKey); |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
protected function setUp() |
29
|
|
|
{ |
30
|
|
|
$this->extensionKey = $this->getUniqueId('foobar'); |
31
|
|
|
$this->installService = $this->createInstallService($this->extensionKey); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
/* |
35
|
|
|
protected function tearDown() |
36
|
|
|
{ |
37
|
|
|
unset($this->installService); |
38
|
|
|
} |
39
|
|
|
*/ |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @test |
43
|
|
|
*/ |
44
|
|
|
public function canBeCreatedWithExtensionKey() |
45
|
|
|
{ |
46
|
|
|
$this->assertInstanceOf( |
47
|
|
|
InstallService::class, |
48
|
|
|
$this->createInstallService($this->getUniqueId('foobar')) |
49
|
|
|
); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @test |
54
|
|
|
* @expectedException \InvalidArgumentException |
55
|
|
|
* @expectedExceptionCode 1491494798 |
56
|
|
|
*/ |
57
|
|
|
public function canNotBeCreatedWithExtensionKeyNull() |
58
|
|
|
{ |
59
|
|
|
$this->createInstallService(null); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @test |
64
|
|
|
* @expectedException \InvalidArgumentException |
65
|
|
|
* @expectedExceptionCode 1491494798 |
66
|
|
|
*/ |
67
|
|
|
public function canNotBeCreatedWithExtensionKeyEmpty() |
68
|
|
|
{ |
69
|
|
|
$this->createInstallService(''); |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @test |
74
|
|
|
* @expectedException \InvalidArgumentException |
75
|
|
|
* @expectedExceptionCode 1491494798 |
76
|
|
|
*/ |
77
|
|
|
public function canNotBeCreatedWithExtensionKeyNumeric() |
78
|
|
|
{ |
79
|
|
|
$this->createInstallService(0); |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @test |
84
|
|
|
*/ |
85
|
|
|
public function showFlashMessage() |
86
|
|
|
{ |
87
|
|
|
/*$this->assertNull($this->installService->afterInstall($this->extensionKey)); |
88
|
|
|
$this->assertNull($this->installService->afterUninstall($this->extensionKey));*/ |
89
|
|
|
} |
90
|
|
|
} |
91
|
|
|
|