Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Autoloader::initialize() #5592

Merged
merged 3 commits into from
Jan 19, 2022
Merged

Conversation

kenjis
Copy link
Member

@kenjis kenjis commented Jan 19, 2022

Description

  • reset the state when initialize() is called
$ ./phpunit --exclude-group DatabaseLive,CacheLive 

Memory: 188.00 MB <- before
Memory: 186.00 MB <- after

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • [] User guide updated
  • Conforms to style guide

If not, namespaces are added again and again.
'Tests\Support\MigrationTestMigrations' is a special place for migration files.
When using it, you must clean up the after state.
@kenjis kenjis force-pushed the fix-autoloader-init branch from 32764a7 to 8f23692 Compare January 19, 2022 07:09
@kenjis kenjis added the refactor Pull requests that refactor code label Jan 19, 2022
@kenjis kenjis mentioned this pull request Jan 19, 2022
6 tasks
Copy link
Member

@MGatner MGatner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not actually sure what all the implications of this are but it seems like the right thing to do. Tests all look good.

@kenjis
Copy link
Member Author

kenjis commented Jan 19, 2022

@MGatner Without this PR, the paths are added again and again in testing.

        $loader = new Autoloader();
        $loader->initialize(new Autoload(), new Modules());
        $loader->initialize(new Autoload(), new Modules());
        dd($loader->getNamespace());
array (45) [
    'CodeIgniter' => array (2) [
        0 => string (50) "/Users/kenji/work/codeigniter/CodeIgniter4/system/"
        1 => string (50) "/Users/kenji/work/codeigniter/CodeIgniter4/system/"
    ]
    'App' => array (2) [
        0 => string (47) "/Users/kenji/work/codeigniter/CodeIgniter4/app/"
        1 => string (47) "/Users/kenji/work/codeigniter/CodeIgniter4/app/"
    ]
...

@kenjis kenjis merged commit da58ec1 into codeigniter4:develop Jan 19, 2022
@kenjis kenjis deleted the fix-autoloader-init branch January 19, 2022 23:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Pull requests that refactor code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants