Code Monkey home page Code Monkey logo

Comments (3)

IvanChepurnyi avatar IvanChepurnyi commented on May 20, 2024

I tried to reproduce your bug but with no luck:
Here is my test case agains default home page:

    public function testDispatch()
    {

         $this->dispatch('');
         $this->assertRequestRoute('cms/index/index');

         $this->assertLayoutBlockCreated('left');
         $this->assertLayoutBlockCreated('right');
         $this->assertLayoutBlockRendered('content');
         $this->assertLayoutBlockTypeOf('left', 'core/text_list');
         $this->assertLayoutBlockNotTypeOf('left', 'core/links');

         $this->assertResponseBodyContains('Magento');
         $this->assertResponseBodyContains('Home Page');
         $this->assertResponseBodyContains('Compare Products');
         $this->assertResponseBodyNotContains('Non existing text');

         // This will fail!
         # $this->assertResponseBodyContains('Non existing text');
    }

However I have some thoughts about your problem in general, it might be possible that you haven't specified your design/theme configuration for test case, since tests are executed agains default database, which design settings are:

  • default/default.

So don't forget to specify your design in fixture, it is very easy:

config:
   default/design/package/name: your_package
   default/design/theme/default: your_theme

from ecomdev_phpunit.

thomasvs avatar thomasvs commented on May 20, 2024

I'm not sure I follow 100%.

Why is it necessary to specify any fixtures at all for a test like
this ? Wouldn't it make more sense if it worked out of the box ?

If I don't have any custom design or theme, what are good values to use
for your_package and your_theme that will work out of the box with 1.7 ?

On Fri, 2013-01-04 at 11:18 -0800, Ivan Chepurnyi wrote:

I tried to reproduce your bug but with no luck:
Here is my test case agains default home page:

public function testDispatch()
{

     $this->dispatch('');
     $this->assertRequestRoute('cms/index/index');

     $this->assertLayoutBlockCreated('left');
     $this->assertLayoutBlockCreated('right');
     $this->assertLayoutBlockRendered('content');
     $this->assertLayoutBlockTypeOf('left', 'core/text_list');
     $this->assertLayoutBlockNotTypeOf('left', 'core/links');

     $this->assertResponseBodyContains('Magento');
     $this->assertResponseBodyContains('Home Page');
     $this->assertResponseBodyContains('Compare Products');
     $this->assertResponseBodyNotContains('Non existing text');

     // This will fail!
     # $this->assertResponseBodyContains('Non existing text');
}

However I have some thoughts about your problem in general, it might
be possible that you haven't specified your design/theme configuration
for test case, since tests are executed agains default database, which
design settings are:

  * default/default.

So don't forget to specify your design in fixture, it is very easy:

config:
default/design/package/name: your_package
default/design/theme/default: your_theme

Reply to this email directly or view it on GitHub.

The coming out tells the story.

savon - Saving your work to svn
https://apestaart.org/thomas/trac/

from ecomdev_phpunit.

IvanChepurnyi avatar IvanChepurnyi commented on May 20, 2024

You mentioned in the title of your ticket "load custom layout template", that supposed to mean that you have a custom layout file in custom theme that is somehow cannot not load template on particular page. That's why I suggested you to change current design package theme via fixture. It is mostly because test database is not a copy of your live db instance it is clean install though db upgrade scripts. If you haven't specified your theme in XML file or db upgrade, then it uses default Magento theme and your test case will not work!

Test framework is not affecting in any way the layout XML building and template file inclusion procedure and if you checked the following test case I provided to you, you'll see that assertResponseBodyContains() method is working without any problems.

from ecomdev_phpunit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.