Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [ecomdev-phpunit]

The tag has no usage guidance.

0
votes
1answer
30 views

Unable to load Fixtures couse of foreign key constraint fails EComDev PHPUnit

i want to add a complete order in my Test by a fixture. The file looks like that: eav: #================================================== # Customers #=================================...
4
votes
1answer
103 views

Magento1 - tests - phpunit compatibility

I am currently working on a project (magento 1.9) where tests are developed using PHPUnit 4.8, ECOMDev and TechDivision/magento unit testing (https://packagist.org/packages/techdivision/...
2
votes
1answer
95 views

How to enable payment/shipping method via fixture EComDev PHPUnit

My purpose is to check whether certain values are properly set after I place an Order. As I am using a complete separate databse for unit testing purpose I don't have the Magento configuration ...
1
vote
1answer
417 views

Magento 1: module integration test without Ecomdev module

What would be the most simple setup to create controller integration tests for Magento 1 custom module without the Ecomdev module ?
1
vote
1answer
181 views

how to reset or delete request params in EcomDev_PHPUnit?

How to completely reset a request params between dispatches ? In Ecomdev_Phpunit I did an upload test, set request like this: $this->getRequest()->setParam('upload', ""); and params becomes: ...
0
votes
0answers
53 views

pass created model object in one test method to next one in EcomDev PHPUnit

Need to create test for custom creating product and custom editing product methods. I use fixtures for both methods with same user data and want to pass freshly created product in first method to ...
1
vote
1answer
266 views

how to properly do EcomDev PHPUnit file upload test with $_FILES?

I want to test file uploading function in my module, but i stuck with limitation of is_uploaded_file and move_uploaded_file over CLI. Trying to emulate user uploading files actions by crafting ...
0
votes
2answers
124 views

Cannot retrieve EAV product data

I'm facing a strange issue (on Magento EE 1.14.2.1) where I cannot retrieve EAV product data after setting up a fixture. My test: /** * @loadFixture */ public function testExample() { $product ...
1
vote
1answer
176 views

Fixture for a product's group price not working

I'm using EcomDev_PHPUnit on Magento EE 1.14.2.1, and am trying to set up a simple unit test for a configurable and simple product which have group prices associated, but I'm not having any luck ...
3
votes
1answer
391 views

EComDev PHPUnit get and set session data

How do you test setting and getting a session variable in PHPUnit/EComDev? This is what I've so far in my test method: $checkoutSession = $this->getModelMock('checkout/session'); $checkoutSession-&...
12
votes
0answers
190 views

Testing SOAP API's using EcomDev_PHPUnit

We just started working on a Magento project where there is a need for some complicated changes to the Magento SOAP API. Since we never properly worked with unit tests, this looked like a good case to ...
3
votes
1answer
527 views

How to test correctly an observer in admin area?

I have to test an observer in adminhtml area on the event sales_order_item_collection_load_before (I declared it on adminhtml/events). I found two different ways to test it, the first one loading the ...
1
vote
0answers
67 views

How to use mage-ci tool to build matrix for CI?

I was looking for a better way to install and test Magento modules and I found here an entry point: Test magento module using mage-ci I need further information on: How to build such Matrix for CI ...
1
vote
1answer
508 views

How to mock Mage_Admin_Model_Session to use getUser method?

I'd like to test a method with different admin-user, I mocked the admin session with this code: $stubAdminSession = $this->getModelMockBuilder('admin/session') ->...
2
votes
1answer
268 views

EcomDev PHPUnit: How to get product price including tax?

I'm trying to get product price both excluding and including tax in EcomDev_PHPUnit. I have a fixture based on the one provided in official manual. I've put the following between scope and eav: ...
2
votes
1answer
243 views

EcomDev_PHPUnit - product price is null

I am trying to run the priceCalculation test from Ecomdev_PHPUnit manual (http://www.ecomdev.org/wp-content/uploads/2011/05/EcomDev_PHPUnit-0.2.0-Manual.pdf) but I get the following error: PHP Fatal ...
1
vote
1answer
1k views

Can you use EcomDev PHPUnit to unit test magento CE 1.9.x? [duplicate]

On https://github.com/ecomdev/ecomdev_phpunit it says they support up to ce 1.7.x and ee 1.12.x. If the answer is no are there any tools to unit test magento 1.9.x?
6
votes
1answer
725 views

How to test magento module without magento core?

Imagine, that you creating new module (for example) and you have only your module files without magento core files. How do you run unit tests? What is the best build-process to run tests on this ...
1
vote
1answer
447 views

Anybody have working example of test case in EcomDevPHPUnit with Magento Enterprise?

I have installed EcomDEV PHPUnit extension in Magento Enterprise. I have created Test Case as well. like "Mymage_Myutest_Test_Model_Product" with the proper folder structure. class ...
4
votes
1answer
90 views

Writing unit tests: refactor the original vs deal with difficult code to test

Given that I am using EcomDev's PHPUnit framework to write unit tests for my Magento modules, sometimes I come across a controller action that has too much logic within it. It would mean mocking lots ...
4
votes
1answer
279 views

How to use multiple databases in EcomDev PHPUnit fixtures

I set up unit tests for Magento 1.9.1.0 using EcomDev PHPUnit. I was able to make almost everything working properly. The only thing which I haven't figured out is how to use fixtures in multiple ...
2
votes
1answer
176 views

EcomDev PHPUnit Translation not Working with Mocked Helper

I noticed that translations are not working with the EcomDev_PHPUnit Unit Test framework if you replace a helper with a mocked helper, using mockHelper() and replaceByMock(). Shouldn't any call to the ...
1
vote
1answer
298 views

EComDev_PHPUnit EAV Attribute Fixture Yaml Format

I need to create a dummy customer attribute in the eav/attributes table using an fixture provided by EcomDev_PHPUnit. I tried using the tables fixture also this is the data I need to provide, but ...
3
votes
1answer
123 views

EcomDev PHPUnit - test that URL is secure

I have configured my custom router/controller/frontname to be forced to use SSL using the "secure_url" node in my config.xml. Does anyone know how I can write a test using EcomDev PHPUnit to confirm ...
0
votes
2answers
350 views

EcomDev PHPUnit Not Running

I'm working on trying to refactor an old module someone had built and wanted to have unit tests in place so I could make sure the refactored version was working correctly, so I installed ...
1
vote
1answer
120 views

EcomDev_PHPUnit assert block property contains

I am having a problem asserting that a blocks property contains an array key. I have added a link to the my customer account area using the following XML: <customer_account> <reference ...
4
votes
1answer
759 views

How to fixture a product with attribute options in EcomDev PHPUnit?

I want to write a fixture for some products. The attribute my_attribute is of type eav/entity_attribute_source_table. The Options are not created by install scripts, so they are not in the test ...
4
votes
1answer
322 views

EcomDev_PHPUnit fixtures: set config XML attributes

Sometimes I need to set up config XML attributes for automated testing. For example: <?xml version="1.0" encoding="UTF-8"?> <config> <global> <somenode foo="bar" /&...
7
votes
1answer
291 views

Make sure no products are in database before running integration tests

I am unit- and integration-testing an import/export extension using EcomDev_PHPUnit. For some of the tests I have to make sure that no products are in the database. The problem is that some 3rd party ...
1
vote
1answer
157 views

Testing Parent-Child Self Relationship With EcomDev_PHPUnit

I am working on my first extension that uses TDD principles and I am having trouble figuring out how best to write this particular test. In the module's database table, I have a column called ...
4
votes
3answers
1k views

EcomDev PHPUnit: Test if data is written to db

I want to test if the following method writes ( or deletes ) the data in the expected way: Method: protected function saveInstanceRelations( Mage_Core_Model_Abstract $object ) { $oldInstances = ...
2
votes
1answer
359 views

Ecomdev_PHPUnit not loading custom attributes

I am dropping the test database before invoking phpunit in Ecomdev_PHPUnit. It creates the database and it's not importing user attributes from eav_attribute. Is it safe to just clone the real ...
1
vote
2answers
563 views

EcomDev_PHPUnit displaying errors after setup

I have set up EcomDevs' Magento testing solution using this manual. I have found it a bit of a struggle to get everything that I need to work, so when I ran phpunit in the root of my project and it ...
4
votes
3answers
486 views

setting up ecomdev install error 'host is not set for base url'

I am trying to install ecomdevs' unit testing with my copy of magento. I have added the folders manually to the relevant directories and added the below in app/etc/local.xml.phpunit <default> ...
6
votes
1answer
962 views

EcomDev PHPUnit Fixtures Magento

I am creating a fixtures yaml file to create a sample product for my unit tests - using the EcomDev phpunit plugin for Magento. The issue is that I need to set store specific values for price. I ...
14
votes
3answers
994 views

Composer installed Ecomdev_PhpUnit skips tests due to missing vfsstream

I'm working with an Enterprise Edition 1.13.1 install (although Community Edition would have the same issue), and we're installing dependencies via composer where they're available. I've installed ...
14
votes
1answer
1k views

Unit Testing Observers in Magento

How do you approach unit testing Observers in Magento? (working with EcomDev_PHPUnit) What kind of assertions do include? check if the event is being dispatched (assertEventDispatched()) check the ...
3
votes
1answer
650 views

Problem creating mock method for “core/store” with ecomdev phpunit

I'm trying to mock this method: getCurrentCurrency() from "core/store" (Mage_Core_Model_Store) in my unit test. Just a simple stub, nothing more. private function _stubGetCurrentCurrency() { $...
22
votes
4answers
3k views

Tools for Unit Testing in Magento

What do you use for Unit Testing in Magento? Or what do you know about Unit Testing and Magento? Whether you do TDD or you just want to have unit test coverage for your project components, you need ...
5
votes
1answer
839 views

Test Driven Development with Magento

I am interested in unit testing in magento and have started looking at the ecomdev module. However, i dont think it is going to be possible to do full tdd with magento. For the following scenarios ...
3
votes
2answers
719 views

Partial Mocking with Ecom Dev

I'm trying to partially mock a helper that runs the code below public function formatPostcode($postcode, $country_code) { if ( $country_code === "AU" ) { return $this->...
1
vote
1answer
944 views

Pointers to write unit test cases using EcomDev_PHPUnit

I am trying to implement a web service client for one of my module and I would like to test it using EcomDev_PHPUnit. So, I have a "Test" folder inside my module with following structure... - ...
18
votes
3answers
783 views

EcomDev_PHPUnit set up in Magento EE 1.13

I am trying to set up EComDev_PHPUnit in EE 1.13 as per the instructions in https://github.com/EcomDev/EcomDev_PHPUnit Well first hurdle was to get modman working but I gave up and copied over the ...
2
votes
1answer
1k views

Loading data (fixtures) for PHPUnit tests from the database

I am following the latest official manual for EcomDev_PHPUnit with the latest version of that module and Magento CE. I understand that a fixture is a set of data in a YAML format that is used to ...
2
votes
2answers
3k views

How run unittest using EcomDev_PHPUnit module?

Here is described old version: http://www.ecomdev.org/2011/02/01/phpunit-and-magento-yes-you-can.html And they wrote that I need call phpunit UnitTests.php But I have magento v.1.7. I downloaded ...
0
votes
1answer
167 views

new product type image of bundled product - price_index not insert into catalog_product_entity

I created a new product type image of bundled product and everything is work except the children product cannot insert the price into database table salt_flat_quote_item and sale_flat_order_item. This ...
6
votes
1answer
2k views

Magento and PHPUnit Mocking Mage::getStoreConfig()

I am writing unit tests using the EcomDev PHPUnit extension. When trying to provide values to the Mage::getStoreConfig() method using a fixture, I am not getting the value from my fixture, but the ...
5
votes
2answers
494 views

Combine Magento TAF with EcomDev_PHPUnit fixtures

I want to use the Magento Test Automation Framework to create a Smoke Test Suite, i.e. a test suite that quickly tests a cross section of the store to check for serious errors, not to test the correct ...
6
votes
2answers
2k views

How to avoid redirection to “enable-cookies” page during controller unit test?

I'm doing a very simple controller test using Ecomdev_PHPUnit: class Foo_BarWishlist_Test_Controller_IndexController extends EcomDev_PHPUnit_Test_Case_Controller { /** * @test * @...
1
vote
1answer
84 views

Run CSS queries against result in controller tests

In Ecomdev_PHPUnit is there already the possibility to run CSS queries (assertions) against the output in controller tests or do I have to utilize Zend_Dom_Query manually?