You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is unclear how the FileInput driver is supposed to work when using the config file outside of a Laravel application. For example, building another composer package which has Archetype as a dependency.
When using Archetype this way, 'root' gets set to base_name(), which is returned as ".../vendor/orchestra/testbench-core/laravel/" in my package development environment.
There does not appear to be a way to set a custom config array without publishing the config file -- which I would rather not do within a package like this.
The other solution was to write my own custom FileInput driver which implements InputInterface. Using reflection it is trivial to find the filename of a given class, so I was going to use that and skip all of the root/absolutePath logic in the included FileInput driver.
classArchetypeInputDriverimplementsInputInterface
{
publicfunctionload(string$className = null)
{
return (newPHPFileStorage())->get($this->getClassFilePath($className));
}
/** * @throws \Exception */protectedfunctiongetClassFilePath($className)
{
try {
$reflection = new \ReflectionClass($className);
return$reflection->getFileName();
} catch (\ReflectionException$e) {
thrownew \Exception("Archetype Input Driver: Class {$className} could not be found.");
}
}
}
This approach almost worked, except it appears the InputInterface is incomplete. It shows the interface only requiring a single method, however there are multiple other methods and properties used within the codebase. So when my implementation did not have them, there were many errors to fix.
It is unclear how the FileInput driver is supposed to work when using the config file outside of a Laravel application. For example, building another composer package which has Archetype as a dependency.
When using Archetype this way, 'root' gets set to base_name(), which is returned as ".../vendor/orchestra/testbench-core/laravel/" in my package development environment.
There does not appear to be a way to set a custom config array without publishing the config file -- which I would rather not do within a package like this.
The other solution was to write my own custom FileInput driver which implements InputInterface. Using reflection it is trivial to find the filename of a given class, so I was going to use that and skip all of the root/absolutePath logic in the included FileInput driver.
This approach almost worked, except it appears the InputInterface is incomplete. It shows the interface only requiring a single method, however there are multiple other methods and properties used within the codebase. So when my implementation did not have them, there were many errors to fix.
Ex.
The text was updated successfully, but these errors were encountered: