27 vfsStream::setup(
'Packages');
35 new FlowPackage($this->getMock(
'TYPO3\CMS\Core\Package\PackageManager'),
'Vendor.TestPackage',
'./ThisPackageSurelyDoesNotExist');
42 array(
'Doctrine.DBAL'),
44 array(
'RobertLemke.Flow.Twitter'),
45 array(
'Sumphonos.Stem'),
46 array(
'Schalke04.Soccer.MagicTrainer')
55 $packagePath =
'vfs://Packages/' . str_replace(
'\\',
'/', $packageKey) .
'/';
56 mkdir($packagePath, 0777, TRUE);
57 file_put_contents($packagePath .
'composer.json',
'{"name": "' . $packageKey .
'", "type": "flow-test"}');
59 $package =
new FlowPackage($this->getMock(
'TYPO3\CMS\Core\Package\PackageManager'), $packageKey, $packagePath);
60 $this->assertEquals($packageKey, $package->getPackageKey());
68 array(
'RobertLemke.Flow. Twitter'),
79 $packagePath =
'vfs://Packages/' . str_replace(
'\\',
'/', $packageKey) .
'/';
80 mkdir($packagePath, 0777, TRUE);
81 new FlowPackage($this->getMock(
'TYPO3\CMS\Core\Package\PackageManager'), $packageKey, $packagePath);
88 $packagePath =
'vfs://Packages/Application/Acme.MyPackage/';
89 mkdir($packagePath, 0777, TRUE);
90 file_put_contents($packagePath .
'composer.json',
'{"name": "acme/mypackage", "type": "flow-test"}');
91 $package =
new FlowPackage($this->getMock(
'TYPO3\CMS\Core\Package\PackageManager'),
'Acme.MyPackage', $packagePath);
92 $this->assertEquals(
'Acme\\MyPackage', $package->getNamespace());
99 $package =
new FlowPackage($this->getMock(
'TYPO3\CMS\Core\Package\PackageManager'),
'TYPO3.CMS.Core', PATH_typo3 .
'sysext/core/');
100 $packageMetaDataPath = $package->getMetaPath();
101 $this->assertSame($package->getPackagePath() . FlowPackage::DIRECTORY_METADATA, $packageMetaDataPath);
108 $package =
new FlowPackage($this->getMock(
'TYPO3\CMS\Core\Package\PackageManager'),
'TYPO3.CMS.Core', PATH_typo3 .
'sysext/core/');
109 $packageDocumentationPath = $package->getDocumentationPath();
111 $this->assertEquals($package->getPackagePath() . FlowPackage::DIRECTORY_DOCUMENTATION, $packageDocumentationPath);
118 $packageManagerMock = $this->getMock(
'TYPO3\CMS\Core\Package\PackageManager');
119 $packageManagerMock->expects($this->any())->method(
'isPackageKeyValid')->willReturn(TRUE);
120 $package =
new TYPO3Package($packageManagerMock,
'core', PATH_typo3 .
'sysext/core/', TYPO3Package::DIRECTORY_CLASSES);
121 $packageClassesPath = $package->getClassesPath();
122 $expected = $package->getPackagePath() . TYPO3Package::DIRECTORY_CLASSES;
123 $this->assertEquals($expected, $packageClassesPath);
130 $packagePath =
'vfs://Packages/Application/Acme/MyPackage/';
131 mkdir($packagePath, 0777, TRUE);
132 file_put_contents($packagePath .
'composer.json',
'{"name": "acme/mypackage", "type": "flow-test"}');
134 $package =
new FlowPackage($this->getMock(
'TYPO3\CMS\Core\Package\PackageManager'),
'Acme.MyPackage', $packagePath,
'no/trailing/slash');
136 $packageClassesPath = $package->getClassesPath();
137 $expected = $package->getPackagePath() .
'no/trailing/slash/';
139 $this->assertEquals($expected, $packageClassesPath);
146 vfsStream::setup(
'testDirectory');
148 $packagePath = vfsStream::url(
'testDirectory') .
'/';
149 file_put_contents($packagePath .
'composer.json',
'{"name": "typo3/flow", "type": "flow-test"}');
151 $package =
new FlowPackage($this->getMock(
'TYPO3\CMS\Core\Package\PackageManager'),
'TYPO3.Flow', $packagePath);
152 $documentations = $package->getPackageDocumentations();
154 $this->assertEquals(array(), $documentations);
161 $packagePath =
'vfs://Packages/Application/Vendor/Dummy/';
162 mkdir($packagePath, 0700, TRUE);
163 file_put_contents($packagePath .
'composer.json',
'{"name": "vendor/dummy", "type": "flow-test"}');
164 $package =
new FlowPackage($this->getMock(
'TYPO3\CMS\Core\Package\PackageManager'),
'Vendor.Dummy', $packagePath);
166 $this->assertFalse($package->isProtected());
167 $package->setProtected(TRUE);
168 $this->assertTrue($package->isProtected());
175 $packagePath =
'vfs://Packages/Application/Vendor/Dummy/';
176 mkdir($packagePath, 0700, TRUE);
177 file_put_contents($packagePath .
'composer.json',
'{"name": "vendor/dummy", "type": "flow-test"}');
178 $package =
new FlowPackage($this->getMock(
'TYPO3\CMS\Core\Package\PackageManager'),
'Vendor.Dummy', $packagePath);
180 $this->assertTrue($package->isObjectManagementEnabled());
187 $packagePath =
'vfs://Packages/Application/Acme.MyPackage/';
188 mkdir($packagePath, 0777, TRUE);
189 file_put_contents($packagePath .
'composer.json',
'{"name": "acme/mypackage", "type": "flow-test"}');
191 mkdir($packagePath .
'Classes/Acme/MyPackage/Controller', 0770, TRUE);
192 mkdir($packagePath .
'Classes/Acme/MyPackage/Domain/Model', 0770, TRUE);
194 file_put_contents($packagePath .
'Classes/Acme/MyPackage/Controller/FooController.php',
'');
195 file_put_contents($packagePath .
'Classes/Acme/MyPackage/Domain/Model/Foo.php',
'');
196 file_put_contents($packagePath .
'Classes/Acme/MyPackage/Domain/Model/Bar.php',
'');
198 $expectedClassFilesArray = array(
199 'Acme\MyPackage\Controller\FooController' =>
'Classes/Acme/MyPackage/Controller/FooController.php',
200 'Acme\MyPackage\Domain\Model\Foo' =>
'Classes/Acme/MyPackage/Domain/Model/Foo.php',
201 'Acme\MyPackage\Domain\Model\Bar' =>
'Classes/Acme/MyPackage/Domain/Model/Bar.php',
204 $package =
new FlowPackage($this->getMock(
'TYPO3\CMS\Core\Package\PackageManager'),
'Acme.MyPackage', $packagePath,
'Classes');
205 $actualClassFilesArray = $package->getClassFiles();
207 $this->assertEquals($expectedClassFilesArray, $actualClassFilesArray);
constructAcceptsValidPackageKeys($packageKey)
getDocumentationPathReturnsPathToDocumentationDirectory()
getClassesPathReturnsNormalizedPathToClasses()
getNamespaceReturnsThePhpNamespaceCorrespondingToThePackageKey()
getClassesPathReturnsPathToClasses()
constructRejectsInvalidPackageKeys($packageKey)
getClassFilesReturnsAListOfClassFilesOfThePackage()
constructThrowsPackageDoesNotExistException()
getPackageDocumentationsReturnsEmptyArrayIfDocumentationDirectoryDoesntExist()
isObjectManagementEnabledTellsIfObjectManagementShouldBeEnabledForThePackage()
aPackageCanBeFlaggedAsProtected()
getMetaPathReturnsPathToMetaDirectory()