Legacy tests comprise fragments of libraries that help developers port their modules to a new version of Magento.
We can trigger legacy tests specifically from the root of the Magento installation by using the following command:
php bin/magento dev:tests:run legacy
When this is executed, Magento first internally changes the directory to
/dev/tests/static and then executes a command, which is similar to the following one:
php /Users/branko/www/magento2/./vendor/phpunit/phpunit/phpunit testsuite/Magento/Test/Legacy
Once this is triggered, the code runs a check for obsolete access lists, connections, menus, responses, system configuration, and a few other things.