14 use org\bovigo\vfs\vfsStream;
18 use TYPO3\CMS\Core\Package\PackageManager;
19 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
30 vfsStream::setup(
'Packages');
38 $this->expectException(InvalidPackagePathException::class);
39 $this->expectExceptionCode(1166631890);
41 $packageManagerMock = $this->createMock(PackageManager::class);
42 $packageManagerMock->expects($this->any())->method(
'isPackageKeyValid')->willReturn(
true);
43 new Package($packageManagerMock,
'Vendor.TestPackage',
'./ThisPackageSurelyDoesNotExist');
53 [
'My.Own.TwitterPackage'],
65 $packagePath =
'vfs://Packages/' . str_replace(
'\\',
'/', $packageKey) .
'/';
66 mkdir($packagePath, 0777,
true);
67 file_put_contents($packagePath .
'composer.json',
'{"name": "' . $packageKey .
'", "type": "flow-test"}');
68 file_put_contents($packagePath .
'ext_emconf.php',
'');
70 $packageManagerMock = $this->createMock(PackageManager::class);
71 $packageManagerMock->expects($this->any())->method(
'isPackageKeyValid')->willReturn(
true);
72 $package =
new Package($packageManagerMock, $packageKey, $packagePath);
73 $this->assertEquals($packageKey, $package->getPackageKey());
82 [
'RobertLemke.Flow. Twitter'],
93 $this->expectException(InvalidPackageKeyException::class);
94 $this->expectExceptionCode(1217959511);
96 $packagePath =
'vfs://Packages/' . str_replace(
'\\',
'/', $packageKey) .
'/';
97 mkdir($packagePath, 0777,
true);
99 $packageManagerMock = $this->createMock(PackageManager::class);
100 new Package($packageManagerMock, $packageKey, $packagePath);
108 $packagePath =
'vfs://Packages/Application/Vendor/Dummy/';
109 mkdir($packagePath, 0700,
true);
110 file_put_contents($packagePath .
'composer.json',
'{"name": "vendor/dummy", "type": "flow-test"}');
111 file_put_contents($packagePath .
'ext_emconf.php',
'');
113 $packageManagerMock = $this->createMock(PackageManager::class);
114 $packageManagerMock->expects($this->any())->method(
'isPackageKeyValid')->willReturn(
true);
115 $package =
new Package($packageManagerMock,
'Vendor.Dummy', $packagePath);
117 $this->assertFalse($package->isProtected());
118 $package->setProtected(
true);
119 $this->assertTrue($package->isProtected());