/** * @test */ public function classesFromPsr4PackagesAreLoaded() { $this->mockPackage1 = $this->getMockBuilder(Package::class)->disableOriginalConstructor()->getMock(); $this->mockPackage1->expects($this->any())->method('getNamespaces')->will($this->returnValue(['Acme\\MyApp'])); $this->mockPackage1->expects($this->any())->method('getPackagePath')->will($this->returnValue('vfs://Test/Packages/Application/Acme.MyApp/')); $this->mockPackage1->expects($this->any())->method('getFlattenedAutoloadConfiguration')->will($this->returnValue([['namespace' => 'Acme\\MyApp', 'classPath' => 'vfs://Test/Packages/Application/Acme.MyApp/Classes/', 'mappingType' => ClassLoader::MAPPING_TYPE_PSR4]])); mkdir('vfs://Test/Packages/Application/Acme.MyApp/Classes', 0770, true); file_put_contents('vfs://Test/Packages/Application/Acme.MyApp/Classes/Foo.php', '<?php ' . __CLASS__ . '::$testClassWasLoaded = TRUE; ?>'); $this->mockPackages['Acme.MyApp'] = $this->mockPackage1; $this->classLoader->setPackages($this->mockPackages); $this->classLoader->loadClass('Acme\\MyApp\\Foo'); $this->assertTrue(self::$testClassWasLoaded); }
/** * @test * @expectedException \Neos\Flow\Composer\Exception\MissingPackageManifestException */ public function throwExceptionWhenSpecifyingAPathWithMissingComposerManifest() { $packagePath = 'vfs://Packages/Some/Path/Some.Package/'; mkdir($packagePath, 0777, true); $package = new Package('Some.Package', 'some/package', 'vfs://Packages/Some/Path/Some.Package/', []); $package->getComposerManifest(); }