Skip to content

Conversation

@sreichel
Copy link
Collaborator

@sreichel sreichel commented Aug 7, 2024

WIP

@sreichel sreichel marked this pull request as draft August 7, 2024 03:47
@sreichel sreichel changed the title Update list commands (php8-only) Update list commands Aug 7, 2024
@sreichel sreichel changed the title Update list commands Updated list commands Aug 7, 2024
@sreichel
Copy link
Collaborator Author

@cmuench would like to here your opinion on it.

This interface should make it easier to write "list"-commands with different output (text, json, xml).

  • getListHeader ... for the table headers
  • getListData ... to collect the data
  • getSectionTitle ... to have unified output (maybe not needed)

You dont have to care about the output, since everything all done in abstract::execute().

@sreichel
Copy link
Collaborator Author

@cmuench i am blind. I dont see whre this error is comming from. Any ideas?

Copy link
Member

@cmuench cmuench left a comment

Choose a reason for hiding this comment

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

Found the issue with the tests...

Copy link
Member

Choose a reason for hiding this comment

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

I was able to reproduce the issue with the failing unit tests on my machine.

The problem is that several calls of the filter method caus the issue.
If we split the findInstalledModulesAndFilterThem method in serveral test cases it's working.

/**
     * @test
     */
    public function findInstalledModulesAndCount()
    {
        $this->getApplication()->initMagento();

        $modules = new Modules();
        self::assertCount(0, $modules);
        $total = count($modules->findInstalledModules());
        self::assertGreaterThan(10, $total);

    }

    public function findInsalledModulesAndFilterByCodepool()
    {
        $this->getApplication()->initMagento();
        $modules = new Modules();
        $total = count($modules->findInstalledModules());

        $filtered = $modules->filterModules($this->filter('codepool', 'core'));
        self::assertLessThan($total, count($filtered));

    }

    public function findInstalledModulesAndFilterByStatus()
    {
        $this->getApplication()->initMagento();
        $modules = new Modules();
        $total = count($modules->findInstalledModules());

        $filtered = $modules->filterModules($this->filter('status', 'active'));
        self::assertLessThan($total, count($filtered));
    }

    public function findInstalledModulesAndFilterByVendor()
    {
        $this->getApplication()->initMagento();
        $modules = new Modules();
        $total = count($modules->findInstalledModules());

        $filtered = $modules->filterModules($this->filter('vendor', 'Mage_'));
        self::assertLessThan($total, count($filtered));
    }
    ```
    
    

# Conflicts:
#	composer.lock
#	src/N98/Magento/Command/Developer/EmailTemplate/UsageCommand.php
#	src/N98/Magento/Command/Script/Repository/ListCommand.php
@sreichel sreichel mentioned this pull request Feb 25, 2025
@sreichel sreichel mentioned this pull request Nov 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants