OroPlatform Forums

Covering OroPlatform topics, including community updates and company announcements.

Forums Forums OroPlatform OroPlatform – Programming Questions Functional Tests 401

This topic contains 42 replies, has 4 voices, and was last updated by  archy_bold 6 years, 1 month ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
    Topic
  • #33722

    jakabadambalazs
    Participant

    Hi,

    I followed your guide about setting up the test environment and writting functional tests. I am stuck on my very first testIndex action because I get 401 (authentication failure) where I am expecting 200.

    I did:

    configured config_test.yml

    I see my db populated and user exists with username “admin”

    and this my my test:

    … and this is what i get:

    :-(

    I even tried without luck:

    Where do you think I made a mistake out something?


    oro/platform(1.6.2) + oro/doctrine-extensions(1.0.7) + symfony/symfony(v2.3.27)

Viewing 15 replies - 16 through 30 (of 42 total)
  • Author
    Replies
  • #33738

    jakabadambalazs
    Participant

    I am on oro/platform 1.6.0 (composer installed)

    in CLI I have Zend OPcache disabled:
    Opcode Caching => Disabled
    Optimization => Disabled
    Startup Failed => Opcode Caching is disabled for CLI

    Did fresh install on newly created db. No cookies! 401!
    same error


    oro/platform(1.6.2) + oro/doctrine-extensions(1.0.7) + symfony/symfony(v2.3.27)

    #33739

    Yevhen Shyshkin
    Participant

    (wall)

    401 with error “Property Oro\Bundle\UserBundle\Entity\User::$avatar does not exist”?

    #33740

    jakabadambalazs
    Participant

    After narly 24hrs of trying to make this work I did something really ugly (not a solution) but I wanted to see if this was the only error I have or if I can expect others.

    I brutally pasted:

    inside Oro/Bundle/UserBundle/Entity/User

    you know what? I get 200 and all the test pass!!!

    so this is the only error – for some reason however I cannot get my head around it

    it is as if the extendEntity properties and methods were not present – I tried and the class does get loaded but there is something fishy…


    oro/platform(1.6.2) + oro/doctrine-extensions(1.0.7) + symfony/symfony(v2.3.27)

    #33741

    Yevhen Shyshkin
    Participant

    Thank you so much for reporting!!!
    I’ll create new bug for that – we’ll fix it.

    #33742

    jakabadambalazs
    Participant

    No, thanks to you!

    Just for reference:


    oro/platform(1.6.2) + oro/doctrine-extensions(1.0.7) + symfony/symfony(v2.3.27)

    #33743

    jakabadambalazs
    Participant

    I’ll create new bug for that – we’ll fix it.

    Can you create it with SUPER-HIGH priority, pls? This makes platform and anything built on platform untestable!

    Thanks
    a\


    oro/platform(1.6.2) + oro/doctrine-extensions(1.0.7) + symfony/symfony(v2.3.27)

    #33744

    Yevhen Shyshkin
    Participant

    It’s “critical” now. Unfornunately, there is no stable steps to reproduce for this bug (on our CI and local env there are no errors), so it might take some time.

    #33745

    jakabadambalazs
    Participant

    How is that possible? Do you mean that this might be something related to my dev environment?

    I’ll make a new deployment and try to reproduce the problem and document the steps.


    oro/platform(1.6.2) + oro/doctrine-extensions(1.0.7) + symfony/symfony(v2.3.27)

    #33746

    Yevhen Shyshkin
    Participant

    I believe that’s combination of environment (php, optcache, maybe something else) + cache + installation. We randomly faced this issue, but we thought it’s fixed.

    #33747

    jakabadambalazs
    Participant

    I have just checked out the platform @ commit 66565d741b4b1db0ea792c61bce1cb22d6e75e88 (1.6 stable) and as you said all tests are green!

    My other project based on the same commit (same apache/php platform and same config has the above problems). Even though I don’t really fancy doing this I’ll try to confront the two deployments – maybe I can find what is wrong.

    If I have unwantedly modified some of the files in the OroPlatform composer should tell me I did, right? well, this does not happen.

    So I am thinking about some difference in the config files under app/config that I might have changed.
    I really don’t know at this point.
    I’ll let you know if I have found something and if it is a real bug or not.

    Thanks for assisting me @yshyshkin!

    a\


    oro/platform(1.6.2) + oro/doctrine-extensions(1.0.7) + symfony/symfony(v2.3.27)

    #33748

    jakabadambalazs
    Participant

    Good news and Bad news! (good for you and bad for me);)

    I have tried them all! At the end, given that functional tests on oroPlatform by itself do work but on the deployment with my bundles (with same OroPlatform and identical vendors folder) fail the functional tests I started to think that there was something in my code causing the problem. (actually, this is where I should have started)

    In fact, if I remove the entire src folder where my codebase is, the oroPlatform functional tests work!

    So this leaves us with:

    1) You can remove the critical bug because whatever it is – it is not related to your code – the bug is not yours but mine.

    2) Now, one by one I’ll put back my bundles and I’ll try to track down which bundle/class/entity/whatever causes this havoc

    I’ll keep you posted
    a\


    oro/platform(1.6.2) + oro/doctrine-extensions(1.0.7) + symfony/symfony(v2.3.27)

    #33749

    jakabadambalazs
    Participant

    Dear @yshyshkin – sorry that I am making you crazy about this stuff but I really want to make functional tests work.

    This is the current situation:
    1) clear oroBundle 1.6 stable
    2) one own bundle to test testing – no entities, simple controller with:
    /**
    * @Route(
    * "/{_format}",
    * name="mekit_playground_index",
    * requirements={"_format"="html|json"},
    * defaults={"_format" = "html"}
    * )
    * @Template
    * @return array
    */
    public function indexAction() {
    $data = [
    'dumpdata' => 'Nothing here'
    ];
    return $data;
    }

    3) and in twig I have:

    When I test this route with:
    public function testIndexAction() {
    $crawler = $this->client->request('GET', $this->getUrl('mekit_playground_index',[]));
    //$request = $this->client->getRequest();
    $result = $this->client->getResponse();
    $resCode = $result->getStatusCode();

    echo "\n\nRESULT($resCode): ";
    if(!$result->isOk()) {
    $exception = $crawler->filter('div.text-exception')->extract(['_text']);
    print_r($exception);
    } else {
    $exception = $crawler->filter('p.environment')->extract(['_text']);
    print_r($exception);
    }
    }

    I get 500! This is a real move forward!!!

    The exception I get is:

    The function “dump” does not exist in /home/jack/domains/master.mekitcrm.bradipo/MekitCrmApplication/src/Mekit/Bundle/PlaygroundBundle/Resources/views/Playground/index.html.twig at line 7

    So I checked on this and in my config_test.yml i have

    looking on some sf2 blogs I noticed that people suggest to use the class “Twig_Extension_Debug”

    so modifying the above yml to:

    I get green lights!!! 200!!! OK!

    So what is this Twig_Extensions_Extension_Debug class for and why do we not have the debug function in test environment (as we do in dev)?


    oro/platform(1.6.2) + oro/doctrine-extensions(1.0.7) + symfony/symfony(v2.3.27)

    #33750

    Yevhen Shyshkin
    Participant

    > what is this Twig_Extensions_Extension_Debug class
    It adds debug tag (not function) – e.g. {% debug var %} instead of {{ debug(var) }}.

    > why do we not have the debug function in test environment (as we do in dev)?
    Because test env for functinal tests should be similar to prod as much as possible.

    In fact both expressions can be used, it’s up to you to decide – that’s what config*.yml files is used for.

    #33751

    jakabadambalazs
    Participant

    THIS IS CRAZY! You won’t believe this!!!

    This is my phpunit.xml file in the project root:

    As you can see I have divided the test suites into Unit and Functional.

    If I remove the “MekitCRM Functional Test Suite” testsuite block, the unit test run and I get OK.

    If I remove the “MekitCRM Unit Test Suite” testsuite block, the functional tests run and I get OK.

    If I leave in both, my functional tests fail and I get 401!!!

    I have, since the very beginning, had this file like this – it’s been nearly 2 weeks I am trying to make this work, I have double checked and debugged nearly all files involved in this – just to realize that there is nothing wrong with neither oroPlatform neither with my code!!!

    Do you know why this happens?
    a\


    oro/platform(1.6.2) + oro/doctrine-extensions(1.0.7) + symfony/symfony(v2.3.27)

    #33752

    Yevhen Shyshkin
    Participant

    Somehow tests affects testing environment, i.e. tests are not completely isolated. Need to find a difference between these environments and check what exactly triggers this error.

    IMHO, these test sutes should be executed in differenct testsuites because they have different responsibilities.

Viewing 15 replies - 16 through 30 (of 42 total)

The forum ‘OroPlatform – Programming Questions’ is closed to new topics and replies.

You will be redirected to [title]. Would you like to continue?

Yes No