0
votes

So i have a composer package i am developing and i want to unit test the package without creating a new composer package for actually unit testing it. Is there any way to load the files in the autoload_classmap.php so they are accessible without creating a new package and including it there and then testing it?

For when i just have one package the files in the src folder is not load in the autoload_classmap.php at the path vendor/composer

What is strange here is that when i include the package in another repo it loads all the files correctly into the autoload_classmap.php file.

The autoload_psr4 package looks like this :

'Nyranith\' => array($baseDir . '/src')

But there is still no files from the $basedir in the autoload_classmap.php.

On of the classes is like this:

namespace Nyranith\Models;


trait CompositPrimaryKey
{

the path to this file is: src/Models/CompositPrimaryKey.php

The autoload in the composer.json looks like this:

"autoload": {
        "psr-4": { "Nyranith\\": "src/"
        }
    },
1

1 Answers

0
votes

In case of psr4, composer just uses path's listened in autoload_psr4.php to load all files from specified folder. So there is no need to have those classes in autoload_classmap.php

If you have already configured your composer.json for psr4 files, then just include vendor/autoload.php in the front controller of your application (usually index.php)