1
0
mirror of https://github.com/danog/class-finder.git synced 2024-11-26 20:14:59 +01:00

Switch namespace

This commit is contained in:
Daniil Gentili 2020-10-11 18:24:12 +02:00
parent 2bbbde7a5e
commit 7d76667d46
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
30 changed files with 162 additions and 162 deletions

View File

@ -7,7 +7,7 @@ Example PHP:
require_once __DIR__ . '/../vendor/autoload.php'; require_once __DIR__ . '/../vendor/autoload.php';
use HaydenPierce\ClassFinder\ClassFinder; use danog\ClassFinder\ClassFinder;
ClassFinder::enableExperimentalFilesSupport(); ClassFinder::enableExperimentalFilesSupport();
$classes = ClassFinder::getClassesInNamespace('Acme\Foo\Bar'); $classes = ClassFinder::getClassesInNamespace('Acme\Foo\Bar');

View File

@ -7,7 +7,7 @@ Example PHP:
require_once __DIR__ . '/../vendor/autoload.php'; require_once __DIR__ . '/../vendor/autoload.php';
use HaydenPierce\ClassFinder\ClassFinder; use danog\ClassFinder\ClassFinder;
ClassFinder::enableExperimentalFilesSupport(); ClassFinder::enableExperimentalFilesSupport();
$classes = ClassFinder::getClassesInNamespace('Acme\Foo\Bar'); $classes = ClassFinder::getClassesInNamespace('Acme\Foo\Bar');

View File

@ -7,7 +7,7 @@ Example PHP:
require_once __DIR__ . '/../vendor/autoload.php'; require_once __DIR__ . '/../vendor/autoload.php';
use HaydenPierce\ClassFinder\ClassFinder; use danog\ClassFinder\ClassFinder;
$classes = ClassFinder::getClassesInNamespace('Acme\Foo\Bar'); $classes = ClassFinder::getClassesInNamespace('Acme\Foo\Bar');
``` ```
@ -25,7 +25,7 @@ is the directory that contains the composer.json configuration and where classes
require_once __DIR__ . '/../vendor/autoload.php'; require_once __DIR__ . '/../vendor/autoload.php';
use HaydenPierce\ClassFinder\ClassFinder; use danog\ClassFinder\ClassFinder;
ClassFinder::setAppRoot(realpath(__DIR__ . '../../app/')); // This is suggesting that the app root is really someone else. ClassFinder::setAppRoot(realpath(__DIR__ . '../../app/')); // This is suggesting that the app root is really someone else.
$classes = ClassFinder::getClassesInNamespace('Acme\Foo\Bar'); $classes = ClassFinder::getClassesInNamespace('Acme\Foo\Bar');

View File

@ -9,7 +9,7 @@ Example PHP:
require_once __DIR__ . '/../vendor/autoload.php'; require_once __DIR__ . '/../vendor/autoload.php';
use HaydenPierce\ClassFinder\ClassFinder; use danog\ClassFinder\ClassFinder;
$classes = ClassFinder::getClassesInNamespace('Acme\Foo\Bar'); $classes = ClassFinder::getClassesInNamespace('Acme\Foo\Bar');
``` ```

View File

@ -1,8 +1,8 @@
<?php <?php
namespace HaydenPierce\ClassFinder; namespace danog\ClassFinder;
use HaydenPierce\ClassFinder\Exception\ClassFinderException; use danog\ClassFinder\Exception\ClassFinderException;
class AppConfig class AppConfig
{ {

View File

@ -1,13 +1,13 @@
<?php <?php
namespace HaydenPierce\ClassFinder; namespace danog\ClassFinder;
use HaydenPierce\ClassFinder\Classmap\ClassmapEntryFactory; use danog\ClassFinder\Classmap\ClassmapEntryFactory;
use HaydenPierce\ClassFinder\Classmap\ClassmapFinder; use danog\ClassFinder\Classmap\ClassmapFinder;
use HaydenPierce\ClassFinder\Files\FilesEntryFactory; use danog\ClassFinder\Files\FilesEntryFactory;
use HaydenPierce\ClassFinder\Files\FilesFinder; use danog\ClassFinder\Files\FilesFinder;
use HaydenPierce\ClassFinder\PSR4\PSR4Finder; use danog\ClassFinder\PSR4\PSR4Finder;
use HaydenPierce\ClassFinder\PSR4\PSR4NamespaceFactory; use danog\ClassFinder\PSR4\PSR4NamespaceFactory;
class ClassFinder class ClassFinder
{ {

View File

@ -1,8 +1,8 @@
<?php <?php
namespace HaydenPierce\ClassFinder\Classmap; namespace danog\ClassFinder\Classmap;
use HaydenPierce\ClassFinder\ClassFinder; use danog\ClassFinder\ClassFinder;
class ClassmapEntry class ClassmapEntry
{ {

View File

@ -1,9 +1,9 @@
<?php <?php
namespace HaydenPierce\ClassFinder\Classmap; namespace danog\ClassFinder\Classmap;
use HaydenPierce\ClassFinder\AppConfig; use danog\ClassFinder\AppConfig;
use HaydenPierce\ClassFinder\ClassFinder; use danog\ClassFinder\ClassFinder;
class ClassmapEntryFactory class ClassmapEntryFactory
{ {

View File

@ -1,9 +1,9 @@
<?php <?php
namespace HaydenPierce\ClassFinder\Classmap; namespace danog\ClassFinder\Classmap;
use HaydenPierce\ClassFinder\ClassFinder; use danog\ClassFinder\ClassFinder;
use HaydenPierce\ClassFinder\FinderInterface; use danog\ClassFinder\FinderInterface;
class ClassmapFinder implements FinderInterface class ClassmapFinder implements FinderInterface
{ {

View File

@ -1,6 +1,6 @@
<?php <?php
namespace HaydenPierce\ClassFinder\Exception; namespace danog\ClassFinder\Exception;
class ClassFinderException extends \Exception class ClassFinderException extends \Exception
{ {

View File

@ -1,8 +1,8 @@
<?php <?php
namespace HaydenPierce\ClassFinder\Files; namespace danog\ClassFinder\Files;
use HaydenPierce\ClassFinder\ClassFinder; use danog\ClassFinder\ClassFinder;
class FilesEntry class FilesEntry
{ {

View File

@ -1,9 +1,9 @@
<?php <?php
namespace HaydenPierce\ClassFinder\Files; namespace danog\ClassFinder\Files;
use HaydenPierce\ClassFinder\AppConfig; use danog\ClassFinder\AppConfig;
use HaydenPierce\ClassFinder\Exception\ClassFinderException; use danog\ClassFinder\Exception\ClassFinderException;
class FilesEntryFactory class FilesEntryFactory
{ {

View File

@ -1,9 +1,9 @@
<?php <?php
namespace HaydenPierce\ClassFinder\Files; namespace danog\ClassFinder\Files;
use HaydenPierce\ClassFinder\Exception\ClassFinderException; use danog\ClassFinder\Exception\ClassFinderException;
use HaydenPierce\ClassFinder\FinderInterface; use danog\ClassFinder\FinderInterface;
class FilesFinder implements FinderInterface class FilesFinder implements FinderInterface
{ {

View File

@ -1,6 +1,6 @@
<?php <?php
namespace HaydenPierce\ClassFinder; namespace danog\ClassFinder;
interface FinderInterface interface FinderInterface
{ {

View File

@ -1,9 +1,9 @@
<?php <?php
namespace HaydenPierce\ClassFinder\PSR4; namespace danog\ClassFinder\PSR4;
use HaydenPierce\ClassFinder\ClassFinder; use danog\ClassFinder\ClassFinder;
use HaydenPierce\ClassFinder\FinderInterface; use danog\ClassFinder\FinderInterface;
class PSR4Finder implements FinderInterface class PSR4Finder implements FinderInterface
{ {

View File

@ -1,9 +1,9 @@
<?php <?php
namespace HaydenPierce\ClassFinder\PSR4; namespace danog\ClassFinder\PSR4;
use HaydenPierce\ClassFinder\ClassFinder; use danog\ClassFinder\ClassFinder;
use HaydenPierce\ClassFinder\Exception\ClassFinderException; use danog\ClassFinder\Exception\ClassFinderException;
class PSR4Namespace class PSR4Namespace
{ {
@ -70,7 +70,7 @@ class PSR4Namespace
* $b->countMatchingNamespaceSegments("TestApp1\\Multi") -> 2, TestApp1\\Multi matches * $b->countMatchingNamespaceSegments("TestApp1\\Multi") -> 2, TestApp1\\Multi matches
* *
* PSR4Namespace $c; * PSR4Namespace $c;
* $c->namespace = "HaydenPierce\\Foo\\Bar"; * $c->namespace = "danog\\Foo\\Bar";
* $c->countMatchingNamespaceSegments("TestApp1\\Multi") -> 0, No matches. * $c->countMatchingNamespaceSegments("TestApp1\\Multi") -> 0, No matches.
* *
* @param string $namespace * @param string $namespace

View File

@ -1,9 +1,9 @@
<?php <?php
namespace HaydenPierce\ClassFinder\PSR4; namespace danog\ClassFinder\PSR4;
use HaydenPierce\ClassFinder\AppConfig; use danog\ClassFinder\AppConfig;
use HaydenPierce\ClassFinder\Exception\ClassFinderException; use danog\ClassFinder\Exception\ClassFinderException;
class PSR4NamespaceFactory class PSR4NamespaceFactory
{ {

View File

@ -1,5 +1,5 @@
{ {
"name": "HaydenPierce/testApp", "name": "danog/testApp",
"type": "project", "type": "project",
"license": "MIT", "license": "MIT",
"authors": [ "authors": [

View File

@ -81,7 +81,7 @@
"type": "library", "type": "library",
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"HaydenPierce\\ClassFinder\\": "src/" "danog\\ClassFinder\\": "src/"
} }
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
@ -113,8 +113,8 @@
"type": "library", "type": "library",
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"HaydenPierce\\SandboxApp\\": "src/", "danog\\SandboxApp\\": "src/",
"HaydenPierce\\SandboxAppMulti\\": [ "danog\\SandboxAppMulti\\": [
"multi/Bop", "multi/Bop",
"multi/Bot" "multi/Bot"
] ]

View File

@ -4,7 +4,7 @@ namespace TestApp1;
require_once __DIR__ . '/../vendor/autoload.php'; require_once __DIR__ . '/../vendor/autoload.php';
use HaydenPierce\ClassFinder\ClassFinder; use danog\ClassFinder\ClassFinder;
// "vendor/bin/phpunit" "./test/app1/src/ClassFinderTest.php" // "vendor/bin/phpunit" "./test/app1/src/ClassFinderTest.php"
class ClassFinderTest extends \PHPUnit_Framework_TestCase class ClassFinderTest extends \PHPUnit_Framework_TestCase
@ -22,7 +22,7 @@ class ClassFinderTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* @expectedException HaydenPierce\ClassFinder\Exception\ClassFinderException * @expectedException danog\ClassFinder\Exception\ClassFinderException
* @expectedExceptionMessage Could not locate composer.json. You can get around this by setting ClassFinder::$appRoot manually. * @expectedExceptionMessage Could not locate composer.json. You can get around this by setting ClassFinder::$appRoot manually.
*/ */
public function testThrowsOnMissingComposerConfig() public function testThrowsOnMissingComposerConfig()

View File

@ -4,7 +4,7 @@ namespace TestApp1;
require_once __DIR__ . '/../vendor/autoload.php'; require_once __DIR__ . '/../vendor/autoload.php';
use HaydenPierce\ClassFinder\ClassFinder; use danog\ClassFinder\ClassFinder;
class ClassmapTest extends \PHPUnit_Framework_TestCase class ClassmapTest extends \PHPUnit_Framework_TestCase
{ {
@ -47,22 +47,22 @@ class ClassmapTest extends \PHPUnit_Framework_TestCase
'Classfinder should be able to load classes based on a classmap.' 'Classfinder should be able to load classes based on a classmap.'
), ),
array( array(
'HaydenPierce\Classmap', 'danog\Classmap',
array( array(
'HaydenPierce\Classmap\Classmap2ClassmapINC', 'danog\Classmap\Classmap2ClassmapINC',
'HaydenPierce\Classmap\Classmap2ClassmapPHP', 'danog\Classmap\Classmap2ClassmapPHP',
'HaydenPierce\Classmap\Classmap3ClassesPHP', 'danog\Classmap\Classmap3ClassesPHP',
'HaydenPierce\Classmap\ClassmapClassmap2PHP' 'danog\Classmap\ClassmapClassmap2PHP'
), ),
'Classfinder should be able to load classes based on a classmap from 3rd party packages.' 'Classfinder should be able to load classes based on a classmap from 3rd party packages.'
), ),
array( array(
'HaydenPierce\Classmap2', 'danog\Classmap2',
array( array(
'HaydenPierce\Classmap2\Classmap2ClassmapINC', 'danog\Classmap2\Classmap2ClassmapINC',
'HaydenPierce\Classmap2\Classmap2ClassmapPHP', 'danog\Classmap2\Classmap2ClassmapPHP',
'HaydenPierce\Classmap2\Classmap3ClassesPHP', 'danog\Classmap2\Classmap3ClassesPHP',
'HaydenPierce\Classmap2\ClassmapClassmap2PHP' 'danog\Classmap2\ClassmapClassmap2PHP'
), ),
'Classfinder should be able to handle multiple namespaces in a single file for a classmap.' 'Classfinder should be able to handle multiple namespaces in a single file for a classmap.'
) )
@ -110,16 +110,16 @@ class ClassmapTest extends \PHPUnit_Framework_TestCase
'Classfinder should be able to load classes recursively based on a classmap.' 'Classfinder should be able to load classes recursively based on a classmap.'
), ),
array( array(
'HaydenPierce', 'danog',
array( array(
'HaydenPierce\Classmap2\Classmap2ClassmapINC', 'danog\Classmap2\Classmap2ClassmapINC',
'HaydenPierce\Classmap2\Classmap2ClassmapPHP', 'danog\Classmap2\Classmap2ClassmapPHP',
'HaydenPierce\Classmap2\Classmap3ClassesPHP', 'danog\Classmap2\Classmap3ClassesPHP',
'HaydenPierce\Classmap2\ClassmapClassmap2PHP', 'danog\Classmap2\ClassmapClassmap2PHP',
'HaydenPierce\Classmap\Classmap2ClassmapINC', 'danog\Classmap\Classmap2ClassmapINC',
'HaydenPierce\Classmap\Classmap2ClassmapPHP', 'danog\Classmap\Classmap2ClassmapPHP',
'HaydenPierce\Classmap\Classmap3ClassesPHP', 'danog\Classmap\Classmap3ClassesPHP',
'HaydenPierce\Classmap\ClassmapClassmap2PHP', 'danog\Classmap\ClassmapClassmap2PHP',
), ),
'Classfinder should be able to load third party classes recursively based on a classmap.' 'Classfinder should be able to load third party classes recursively based on a classmap.'
) )

View File

@ -4,7 +4,7 @@ namespace TestApp1;
require_once __DIR__ . '/../vendor/autoload.php'; require_once __DIR__ . '/../vendor/autoload.php';
use HaydenPierce\ClassFinder\ClassFinder; use danog\ClassFinder\ClassFinder;
class FilesTest extends \PHPUnit_Framework_TestCase class FilesTest extends \PHPUnit_Framework_TestCase
{ {
@ -53,14 +53,14 @@ class FilesTest extends \PHPUnit_Framework_TestCase
'ClassFinder should be able to find 1st party classes included from `files` listed in composer.json.' 'ClassFinder should be able to find 1st party classes included from `files` listed in composer.json.'
), ),
array( array(
'HaydenPierce\Files', 'danog\Files',
array( array(
'HaydenPierce\Files\z', 'danog\Files\z',
'HaydenPierce\Files\z2', 'danog\Files\z2',
'HaydenPierce\Files\a', 'danog\Files\a',
'HaydenPierce\Files\a2', 'danog\Files\a2',
'HaydenPierce\Files\b', 'danog\Files\b',
'HaydenPierce\Files\b2' 'danog\Files\b2'
), ),
'ClassFinder should be able to find 3rd party classes included from `files` listed in composer.json of those projects.' 'ClassFinder should be able to find 3rd party classes included from `files` listed in composer.json of those projects.'
) )

View File

@ -4,7 +4,7 @@ namespace TestApp1;
require_once __DIR__ . '/../vendor/autoload.php'; require_once __DIR__ . '/../vendor/autoload.php';
use HaydenPierce\ClassFinder\ClassFinder; use danog\ClassFinder\ClassFinder;
class PSR4Test extends \PHPUnit_Framework_TestCase class PSR4Test extends \PHPUnit_Framework_TestCase
{ {
@ -58,7 +58,7 @@ class PSR4Test extends \PHPUnit_Framework_TestCase
'TestApp1\Multi\Uik', 'TestApp1\Multi\Uik',
'TestApp1\Multi\Yik' 'TestApp1\Multi\Yik'
), ),
'ClassFinder should be able to find 1st party classes when a provided namespace root maps to multiple directories (Example: "HaydenPierce\\SandboxAppMulti\\": ["multi/Bop", "multi/Bot"] )' 'ClassFinder should be able to find 1st party classes when a provided namespace root maps to multiple directories (Example: "danog\\SandboxAppMulti\\": ["multi/Bop", "multi/Bot"] )'
), ),
array( array(
'TestApp1\Multi\Yop', 'TestApp1\Multi\Yop',
@ -68,32 +68,32 @@ class PSR4Test extends \PHPUnit_Framework_TestCase
'TestApp1\Multi\Yop\Eij', 'TestApp1\Multi\Yop\Eij',
'TestApp1\Multi\Yop\Rij' 'TestApp1\Multi\Yop\Rij'
), ),
'ClassFinder should be able to find 1st party classes when a provided namespace root maps to multiple directories multiple levels deep. (Example: "HaydenPierce\\SandboxAppMulti\\": ["multi/Bop", "multi/Bot"] )' 'ClassFinder should be able to find 1st party classes when a provided namespace root maps to multiple directories multiple levels deep. (Example: "danog\\SandboxAppMulti\\": ["multi/Bop", "multi/Bot"] )'
), ),
array( array(
'HaydenPierce\SandboxApp', 'danog\SandboxApp',
array( array(
'HaydenPierce\SandboxApp\Foy' 'danog\SandboxApp\Foy'
), ),
'ClassFinder should be able to find 3rd party classes' 'ClassFinder should be able to find 3rd party classes'
), ),
array( array(
'HaydenPierce\SandboxApp\Foo\Bar', 'danog\SandboxApp\Foo\Bar',
array( array(
'HaydenPierce\SandboxApp\Foo\Bar\Barc', 'danog\SandboxApp\Foo\Bar\Barc',
'HaydenPierce\SandboxApp\Foo\Bar\Barp' 'danog\SandboxApp\Foo\Bar\Barp'
), ),
'ClassFinder should be able to find 3rd party classes multiple namespaces deep.' 'ClassFinder should be able to find 3rd party classes multiple namespaces deep.'
), ),
array( array(
'HaydenPierce\SandboxAppMulti', 'danog\SandboxAppMulti',
array( array(
'HaydenPierce\SandboxAppMulti\Zip', 'danog\SandboxAppMulti\Zip',
'HaydenPierce\SandboxAppMulti\Zop', 'danog\SandboxAppMulti\Zop',
'HaydenPierce\SandboxAppMulti\Zap', 'danog\SandboxAppMulti\Zap',
'HaydenPierce\SandboxAppMulti\Zit' 'danog\SandboxAppMulti\Zit'
), ),
'ClassFinder should be able to find 3rd party classes when a provided namespace root maps to multiple directories (Example: "HaydenPierce\\SandboxAppMulti\\": ["multi/Bop", "multi/Bot"] )' 'ClassFinder should be able to find 3rd party classes when a provided namespace root maps to multiple directories (Example: "danog\\SandboxAppMulti\\": ["multi/Bop", "multi/Bot"] )'
), ),
array( array(
'TestApp1\Foo\Empty', 'TestApp1\Foo\Empty',
@ -118,10 +118,10 @@ class PSR4Test extends \PHPUnit_Framework_TestCase
} }
// ClassFinder has the ability to find itself. This ability, while intended, is incontinent for tests // ClassFinder has the ability to find itself. This ability, while intended, is incontinent for tests
// because of the 'HaydenPierce' test case. Whenever ClassFinder would be updated, we would need to update the // because of the 'danog' test case. Whenever ClassFinder would be updated, we would need to update the
// test. To prevent the flakiness, we just remove ClassFinder's classes. // test. To prevent the flakiness, we just remove ClassFinder's classes.
$classes = array_filter($classes, function($class) { $classes = array_filter($classes, function($class) {
return strpos($class, 'HaydenPierce\ClassFinder') !== 0; return strpos($class, 'danog\ClassFinder') !== 0;
}); });
ClassFinder::enableClassmapSupport(); ClassFinder::enableClassmapSupport();
@ -165,20 +165,20 @@ class PSR4Test extends \PHPUnit_Framework_TestCase
'TestApp1\Multi\Yop\Eij', 'TestApp1\Multi\Yop\Eij',
'TestApp1\Multi\Yop\Rij' 'TestApp1\Multi\Yop\Rij'
), ),
'ClassFinder should be able to find 1st party classes recursively when a provided namespace root maps to multiple directories (Example: "HaydenPierce\\SandboxAppMulti\\": ["multi/Bop", "multi/Bot"] )' 'ClassFinder should be able to find 1st party classes recursively when a provided namespace root maps to multiple directories (Example: "danog\\SandboxAppMulti\\": ["multi/Bop", "multi/Bot"] )'
), ),
array( array(
'HaydenPierce', 'danog',
array( array(
'HaydenPierce\SandboxApp\Foy', 'danog\SandboxApp\Foy',
'HaydenPierce\SandboxApp\Fob\Soz', 'danog\SandboxApp\Fob\Soz',
'HaydenPierce\SandboxApp\Foo\Larc', 'danog\SandboxApp\Foo\Larc',
'HaydenPierce\SandboxApp\Foo\Bar\Barc', 'danog\SandboxApp\Foo\Bar\Barc',
'HaydenPierce\SandboxApp\Foo\Bar\Barp', 'danog\SandboxApp\Foo\Bar\Barp',
'HaydenPierce\SandboxAppMulti\Zip', 'danog\SandboxAppMulti\Zip',
'HaydenPierce\SandboxAppMulti\Zop', 'danog\SandboxAppMulti\Zop',
'HaydenPierce\SandboxAppMulti\Zap', 'danog\SandboxAppMulti\Zap',
'HaydenPierce\SandboxAppMulti\Zit' 'danog\SandboxAppMulti\Zit'
), ),
'ClassFinder should be able to find 3rd party classes' 'ClassFinder should be able to find 3rd party classes'
) )
@ -188,13 +188,13 @@ class PSR4Test extends \PHPUnit_Framework_TestCase
public function testForClassesInNamespace() public function testForClassesInNamespace()
{ {
$this->assertFalse(ClassFinder::namespaceHasClasses('DoesNotExist')); $this->assertFalse(ClassFinder::namespaceHasClasses('DoesNotExist'));
$this->assertTrue(ClassFinder::namespaceHasClasses('HaydenPierce\ClassFinder')); $this->assertTrue(ClassFinder::namespaceHasClasses('danog\ClassFinder'));
} }
public function testCanFindSelf() public function testCanFindSelf()
{ {
try { try {
$classes = ClassFinder::getClassesInNamespace('HaydenPierce\ClassFinder', ClassFinder::RECURSIVE_MODE); $classes = ClassFinder::getClassesInNamespace('danog\ClassFinder', ClassFinder::RECURSIVE_MODE);
} catch (\Exception $e) { } catch (\Exception $e) {
$this->assertFalse(true, 'An exception occurred: ' . $e->getMessage()); $this->assertFalse(true, 'An exception occurred: ' . $e->getMessage());
$classes = array(); $classes = array();

View File

@ -4,7 +4,7 @@ namespace TestApp2;
require_once __DIR__ . '/vendor/autoload.php'; require_once __DIR__ . '/vendor/autoload.php';
use HaydenPierce\ClassFinder\ClassFinder; use danog\ClassFinder\ClassFinder;
class ClassmapNoAutoloadTest extends \PHPUnit_Framework_TestCase class ClassmapNoAutoloadTest extends \PHPUnit_Framework_TestCase
{ {
@ -32,22 +32,22 @@ class ClassmapNoAutoloadTest extends \PHPUnit_Framework_TestCase
{ {
return array( return array(
array( array(
'HaydenPierce\Classmap', 'danog\Classmap',
array( array(
'HaydenPierce\Classmap\Classmap2ClassmapINC', 'danog\Classmap\Classmap2ClassmapINC',
'HaydenPierce\Classmap\Classmap2ClassmapPHP', 'danog\Classmap\Classmap2ClassmapPHP',
'HaydenPierce\Classmap\Classmap3ClassesPHP', 'danog\Classmap\Classmap3ClassesPHP',
'HaydenPierce\Classmap\ClassmapClassmap2PHP' 'danog\Classmap\ClassmapClassmap2PHP'
), ),
'Classfinder should be able to load classes based on a classmap from 3rd party packages.' 'Classfinder should be able to load classes based on a classmap from 3rd party packages.'
), ),
array( array(
'HaydenPierce\Classmap2', 'danog\Classmap2',
array( array(
'HaydenPierce\Classmap2\Classmap2ClassmapINC', 'danog\Classmap2\Classmap2ClassmapINC',
'HaydenPierce\Classmap2\Classmap2ClassmapPHP', 'danog\Classmap2\Classmap2ClassmapPHP',
'HaydenPierce\Classmap2\Classmap3ClassesPHP', 'danog\Classmap2\Classmap3ClassesPHP',
'HaydenPierce\Classmap2\ClassmapClassmap2PHP' 'danog\Classmap2\ClassmapClassmap2PHP'
), ),
'Classfinder should be able to handle multiple namespaces in a single file for a classmap.' 'Classfinder should be able to handle multiple namespaces in a single file for a classmap.'
) )
@ -77,16 +77,16 @@ class ClassmapNoAutoloadTest extends \PHPUnit_Framework_TestCase
{ {
return array( return array(
array( array(
'HaydenPierce', 'danog',
array( array(
'HaydenPierce\Classmap2\Classmap2ClassmapINC', 'danog\Classmap2\Classmap2ClassmapINC',
'HaydenPierce\Classmap2\Classmap2ClassmapPHP', 'danog\Classmap2\Classmap2ClassmapPHP',
'HaydenPierce\Classmap2\Classmap3ClassesPHP', 'danog\Classmap2\Classmap3ClassesPHP',
'HaydenPierce\Classmap2\ClassmapClassmap2PHP', 'danog\Classmap2\ClassmapClassmap2PHP',
'HaydenPierce\Classmap\Classmap2ClassmapINC', 'danog\Classmap\Classmap2ClassmapINC',
'HaydenPierce\Classmap\Classmap2ClassmapPHP', 'danog\Classmap\Classmap2ClassmapPHP',
'HaydenPierce\Classmap\Classmap3ClassesPHP', 'danog\Classmap\Classmap3ClassesPHP',
'HaydenPierce\Classmap\ClassmapClassmap2PHP', 'danog\Classmap\ClassmapClassmap2PHP',
), ),
'Classfinder should be able to load third party classes recursively based on a classmap.' 'Classfinder should be able to load third party classes recursively based on a classmap.'
) )

View File

@ -4,7 +4,7 @@ namespace TestApp2;
require_once __DIR__ . '/vendor/autoload.php'; require_once __DIR__ . '/vendor/autoload.php';
use HaydenPierce\ClassFinder\ClassFinder; use danog\ClassFinder\ClassFinder;
class PSR4NoAutoloadTest extends \PHPUnit_Framework_TestCase class PSR4NoAutoloadTest extends \PHPUnit_Framework_TestCase
{ {
@ -35,46 +35,46 @@ class PSR4NoAutoloadTest extends \PHPUnit_Framework_TestCase
{ {
return array( return array(
array( array(
'HaydenPierce\SandboxApp', 'danog\SandboxApp',
array( array(
'HaydenPierce\SandboxApp\Foy' 'danog\SandboxApp\Foy'
), ),
'ClassFinder should be able to find 3rd party classes' 'ClassFinder should be able to find 3rd party classes'
), ),
array( array(
'HaydenPierce\SandboxApp\Foo\Bar', 'danog\SandboxApp\Foo\Bar',
array( array(
'HaydenPierce\SandboxApp\Foo\Bar\Barc', 'danog\SandboxApp\Foo\Bar\Barc',
'HaydenPierce\SandboxApp\Foo\Bar\Barp' 'danog\SandboxApp\Foo\Bar\Barp'
), ),
'ClassFinder should be able to find 3rd party classes multiple namespaces deep.' 'ClassFinder should be able to find 3rd party classes multiple namespaces deep.'
), ),
array( array(
'HaydenPierce\SandboxAppMulti', 'danog\SandboxAppMulti',
array( array(
'HaydenPierce\SandboxAppMulti\Zip', 'danog\SandboxAppMulti\Zip',
'HaydenPierce\SandboxAppMulti\Zop', 'danog\SandboxAppMulti\Zop',
'HaydenPierce\SandboxAppMulti\Zap', 'danog\SandboxAppMulti\Zap',
'HaydenPierce\SandboxAppMulti\Zit' 'danog\SandboxAppMulti\Zit'
), ),
'ClassFinder should be able to find 3rd party classes when a provided namespace root maps to multiple directories (Example: "HaydenPierce\\SandboxAppMulti\\": ["multi/Bop", "multi/Bot"] )' 'ClassFinder should be able to find 3rd party classes when a provided namespace root maps to multiple directories (Example: "danog\\SandboxAppMulti\\": ["multi/Bop", "multi/Bot"] )'
) )
); );
} }
public function testGetClassesInNamespaceRecursively() public function testGetClassesInNamespaceRecursively()
{ {
$namespace = 'HaydenPierce'; $namespace = 'danog';
$expected = array( $expected = array(
'HaydenPierce\SandboxApp\Foy', 'danog\SandboxApp\Foy',
'HaydenPierce\SandboxApp\Fob\Soz', 'danog\SandboxApp\Fob\Soz',
'HaydenPierce\SandboxApp\Foo\Larc', 'danog\SandboxApp\Foo\Larc',
'HaydenPierce\SandboxApp\Foo\Bar\Barc', 'danog\SandboxApp\Foo\Bar\Barc',
'HaydenPierce\SandboxApp\Foo\Bar\Barp', 'danog\SandboxApp\Foo\Bar\Barp',
'HaydenPierce\SandboxAppMulti\Zip', 'danog\SandboxAppMulti\Zip',
'HaydenPierce\SandboxAppMulti\Zop', 'danog\SandboxAppMulti\Zop',
'HaydenPierce\SandboxAppMulti\Zap', 'danog\SandboxAppMulti\Zap',
'HaydenPierce\SandboxAppMulti\Zit' 'danog\SandboxAppMulti\Zit'
); );
$message = 'ClassFinder should be able to find 3rd party classes'; $message = 'ClassFinder should be able to find 3rd party classes';
@ -88,10 +88,10 @@ class PSR4NoAutoloadTest extends \PHPUnit_Framework_TestCase
} }
// ClassFinder has the ability to find itself. This ability, while intended, is incontinent for tests // ClassFinder has the ability to find itself. This ability, while intended, is incontinent for tests
// because of the 'HaydenPierce' test case. Whenever ClassFinder would be updated, we would need to update the // because of the 'danog' test case. Whenever ClassFinder would be updated, we would need to update the
// test. To prevent the flakiness, we just remove ClassFinder's classes. // test. To prevent the flakiness, we just remove ClassFinder's classes.
$classes = array_filter($classes, function($class) { $classes = array_filter($classes, function($class) {
return strpos($class, 'HaydenPierce\ClassFinder') !== 0; return strpos($class, 'danog\ClassFinder') !== 0;
}); });
ClassFinder::enableClassmapSupport(); ClassFinder::enableClassmapSupport();

View File

@ -1,5 +1,5 @@
{ {
"name": "HaydenPierce/testApp", "name": "danog/testApp",
"type": "project", "type": "project",
"license": "MIT", "license": "MIT",
"authors": [ "authors": [

View File

@ -81,7 +81,7 @@
"type": "library", "type": "library",
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"HaydenPierce\\ClassFinder\\": "src/" "danog\\ClassFinder\\": "src/"
} }
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
@ -113,8 +113,8 @@
"type": "library", "type": "library",
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"HaydenPierce\\SandboxApp\\": "src/", "danog\\SandboxApp\\": "src/",
"HaydenPierce\\SandboxAppMulti\\": [ "danog\\SandboxAppMulti\\": [
"multi/Bop", "multi/Bop",
"multi/Bot" "multi/Bot"
] ]

View File

@ -1,9 +1,9 @@
<?php <?php
namespace HaydenPierce\ClassFinder\UnitTest\Classmap; namespace danog\ClassFinder\UnitTest\Classmap;
use HaydenPierce\ClassFinder\ClassFinder; use danog\ClassFinder\ClassFinder;
use HaydenPierce\ClassFinder\Classmap\ClassmapEntry; use danog\ClassFinder\Classmap\ClassmapEntry;
class ClassmapEntryTest extends \PHPUnit_Framework_TestCase class ClassmapEntryTest extends \PHPUnit_Framework_TestCase
{ {

View File

@ -1,9 +1,9 @@
<?php <?php
namespace HaydenPierce\ClassFinder\UnitTest\Files; namespace danog\ClassFinder\UnitTest\Files;
use HaydenPierce\ClassFinder\ClassFinder; use danog\ClassFinder\ClassFinder;
use HaydenPierce\ClassFinder\Files\FilesEntry; use danog\ClassFinder\Files\FilesEntry;
use org\bovigo\vfs\vfsStream; use org\bovigo\vfs\vfsStream;
use org\bovigo\vfs\vfsStreamDirectory; use org\bovigo\vfs\vfsStreamDirectory;

View File

@ -1,8 +1,8 @@
<?php <?php
namespace HaydenPierce\ClassFinder\UnitTest\PSR4; namespace danog\ClassFinder\UnitTest\PSR4;
use HaydenPierce\ClassFinder\PSR4\PSR4Namespace; use danog\ClassFinder\PSR4\PSR4Namespace;
use org\bovigo\vfs\vfsStream; use org\bovigo\vfs\vfsStream;
use org\bovigo\vfs\vfsStreamDirectory; use org\bovigo\vfs\vfsStreamDirectory;
@ -73,7 +73,7 @@ EOL;
public function testKnowsNamespace() public function testKnowsNamespace()
{ {
$namespace = $this->getMockBuilder('\HaydenPierce\ClassFinder\PSR4\PSR4Namespace') $namespace = $this->getMockBuilder('\danog\ClassFinder\PSR4\PSR4Namespace')
->setConstructorArgs(array( ->setConstructorArgs(array(
'MyPSR4Root\\Foot\\', 'MyPSR4Root\\Foot\\',
array($this->root->getChild('Baz')->path()) array($this->root->getChild('Baz')->path())