Magento 2 Developement

Magento 2 Setup Compile Errors

Magento 2.0 magento setup:di:compile command gives me following errors:

[ErrorException] Declaration of
Magento\Newsletter\Test\Unit\Model\Queue\TransportBuilderTest::testGetTransport()
should be compatible with
Magento\Framework\Mail\Test\Unit\Template\TransportBuilderTest::testGetTransport($templateType, $messageType, $bodyText, $templateNamespace)

FIX:

Update app/code/Magento/Newsletter/Test/Unit/Model/Queue/TransportBuilderTest.php

public function testGetTransport($templateType = TemplateTypesInterface::TYPE_HTML,
        $messageType = MessageInterface::TYPE_HTML,
        $bodyText = '<h1>Html message</h1>'
    )

to

public function testGetTransport(
    $templateType = TemplateTypesInterface::TYPE_HTML,
    $messageType = MessageInterface::TYPE_HTML,
    $bodyText = '<h1>Html message</h1>',
    $templateNamespace ='Magento\Newsletter\Test\Unit\Model\Queue'
)

[ReflectionException]
Class Not_Existing_Class does not exist

FIX:

Update setup/src/Magento/Setup/Module/Di/Code/Reader/ClassesScanner.php

if (preg_match($pattern, $fileItem->getRealPath())) {

to

if (preg_match($pattern, str_replace('\\', '/', $fileItem->getRealPath()))) {

Hope this helps you to run the compile successfully!

Check our article about magento 2 complete cli commands list

Leave a Reply

Your email address will not be published. Required fields are marked *