ヤミRoot VoidGate
User / IP
:
216.73.216.143
Host / Server
:
146.88.233.70 / dev.loger.cm
System
:
Linux hybrid1120.fr.ns.planethoster.net 3.10.0-957.21.2.el7.x86_64 #1 SMP Wed Jun 5 14:26:44 UTC 2019 x86_64
Command
|
Upload
|
Create
Mass Deface
|
Jumping
|
Symlink
|
Reverse Shell
Ping
|
Port Scan
|
DNS Lookup
|
Whois
|
Header
|
cURL
:
/
home
/
logercm
/
dev.loger.cm
/
vendor
/
hautelook
/
alice-bundle
/
tests
/
Locator
/
Viewing: EnvDirectoryLocatorTest.php
<?php /* * This file is part of the Hautelook\AliceBundle package. * * (c) Baldur Rensch <brensch@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Hautelook\AliceBundle\Locator; use Hautelook\AliceBundle\FixtureLocatorInterface; use Hautelook\AliceBundle\Locator\EnvDirectoryLocator\AnotherDummyBundle\AnotherDummyBundle; use Hautelook\AliceBundle\Locator\EnvDirectoryLocator\DummyBundle\DummyBundle; use Hautelook\AliceBundle\Locator\EnvDirectoryLocator\EmptyBundle\EmptyBundle; use Hautelook\AliceBundle\Locator\EnvDirectoryLocator\OneMoreDummyBundle\OneMoreDummyBundle; use PHPUnit\Framework\TestCase; use ReflectionClass; /** * @covers \Hautelook\AliceBundle\Locator\EnvDirectoryLocator */ class EnvDirectoryLocatorTest extends TestCase { public function testIsAFixtureLocator() { $this->assertTrue(is_a(EnvDirectoryLocator::class, FixtureLocatorInterface::class, true)); } public function testIsNotClonable() { $this->assertFalse((new ReflectionClass(EnvDirectoryLocator::class))->isCloneable()); } /** * @dataProvider provideSets */ public function testGetFilesFromABundle(array $bundles, string $environment, array $paths, array $expected) { $invalidPath = ''; $locator = new EnvDirectoryLocator($paths, [$invalidPath]); $actual = $locator->locateFiles($bundles, $environment); $this->assertEqualsCanonicalizing($expected, $actual); } public function provideSets() { yield 'bundle without any resources' => [ [new EmptyBundle()], 'test', ['Resources/fixtures'], [], ]; yield 'bundle with non-existing path' => [ [new EmptyBundle()], 'test', ['ftp://Resources/fixtures'], [], ]; yield 'bundle with file as path' => [ [new EmptyBundle()], 'test', ['Resources/fixtures/test/file1.yml'], [], ]; yield 'bundle with fixture files' => [ [new DummyBundle()], 'test', ['Resources/fixtures'], [ sprintf('%s/file1.yml', $prefix = realpath(__DIR__.'/../../fixtures/Locator/EnvDirectoryLocator/DummyBundle/Resources/fixtures/test')), $prefix.'/file2.yaml', $prefix.'/file3.php', $prefix.'/file5.YML', $prefix.'/file6.YAML', ], ]; yield 'bundle with fixture files from multiple directories' => [ [new DummyBundle()], 'test', [ 'Resources/fixtures', 'Resources/fixtures2', ], [ sprintf('%s/file1.yml', realpath(__DIR__.'/../../fixtures/Locator/EnvDirectoryLocator/DummyBundle/Resources/fixtures2/test')), sprintf('%s/file1.yml', $prefix = realpath(__DIR__.'/../../fixtures/Locator/EnvDirectoryLocator/DummyBundle/Resources/fixtures/test')), $prefix.'/file2.yaml', $prefix.'/file3.php', $prefix.'/file5.YML', $prefix.'/file6.YAML', ], ]; yield 'bundle with fixture files but no fixtures in env' => [ [new DummyBundle()], '', ['Resources/fixtures'], [], ]; yield 'bundle with fixture files 2' => [ [new DummyBundle()], '', ['Resources/fixtures/test'], [ $prefix.'/file1.yml', $prefix.'/file2.yaml', $prefix.'/file3.php', $prefix.'/file5.YML', $prefix.'/file6.YAML', ], ]; yield 'bundle with fixture files in a custom directory' => [ [new AnotherDummyBundle()], 'dev', ['resources'], [ realpath(__DIR__.'/../../fixtures/Locator/EnvDirectoryLocator/AnotherDummyBundle/resources/dev/file10.yml'), ], ]; yield 'bundle with fixture directory but no fixture files' => [ [new AnotherDummyBundle()], 'test', ['resources'], [], ]; } /** * @dataProvider provideSetsForSeveralBundles */ public function testGetFilesFromSeveralBundles( array $bundles, string $environment, array $paths, array $expected ) { $invalidPath = ''; $locator = new EnvDirectoryLocator($paths, [$invalidPath]); $actual = $locator->locateFiles($bundles, $environment); $this->assertEqualsCanonicalizing($expected, $actual); } public function provideSetsForSeveralBundles() { $baseDir = 'Resources'.\DIRECTORY_SEPARATOR.'fixtures'; $baseDir2 = 'Resources'.\DIRECTORY_SEPARATOR.'fixtures2'; $env = 'test'; $bundleA = new DummyBundle(); $bundleB = new OneMoreDummyBundle(); $prefixA1 = $bundleA->getPath().\DIRECTORY_SEPARATOR.$baseDir.\DIRECTORY_SEPARATOR.$env.\DIRECTORY_SEPARATOR; $prefixA2 = $bundleA->getPath().\DIRECTORY_SEPARATOR.$baseDir2.\DIRECTORY_SEPARATOR.$env.\DIRECTORY_SEPARATOR; $prefixB = $bundleB->getPath().\DIRECTORY_SEPARATOR.$baseDir.\DIRECTORY_SEPARATOR.$env.\DIRECTORY_SEPARATOR; yield 'several bundles with fixture files' => [ [$bundleA, $bundleB], $env, [$baseDir, $baseDir2], [ $prefixA1.'file1.yml', $prefixA2.'file1.yml', $prefixA1.'file2.yaml', $prefixA1.'file3.php', $prefixA1.'file5.YML', $prefixA1.'file6.YAML', $prefixB.'file1.yml', $prefixB.'file2.yaml', $prefixB.'file3.php', ], ]; } public function testGetFilesFromProjectDir() { $basePath = realpath(__DIR__.'/../..'); $locator = new EnvDirectoryLocator(['fixtures/fixture_files'], [$basePath]); $this->assertSame([$basePath.'/fixtures/fixture_files/city.yml'], $locator->locateFiles([], '')); } }
Coded With 💗 by
0x6ick