Tagged Questions
0
votes
0answers
21 views
phpunit command return “phpunit --help” screen
I'm trying to make some PhpUnit test on Magento with using ecomdev (https://github.com/EcomDev/EcomDev_PHPUnit).
I've correctly installed modman, PEAR and related packages dependencies (I'm on Ubuntu ...
0
votes
0answers
12 views
Failed tests after installing EcomDev_PHPUnit
For setting up EcomDev_PHPUnit, I installed PHPUnit and relevant modules via PEAR and when I ran "phpunit" for a magento instance, out of 32 tests, 14 were failures and all the failed tests have a ...
1
vote
0answers
32 views
PHPUnit Mock does not filter or ignores calls
I got a factory so this mock method is called "getModelMock".
It rewrites the setData method when the first argument is "template_text" to another function "fetchArgs" that stores the given arguments.
...
1
vote
1answer
55 views
Magento EcomDev_UnitTest can not access adminhtml
I installed EcomDev_UnitTest as described in the readme.md
php ecomdev-phpunit.php -a magento-config --db-name mage_test --base-url http://localhost.foo/
And used this class to access adminhtml ...
1
vote
1answer
64 views
I cannot run PHPUNIT
i have a problem with PHPUnit. I installed it using PEAR, no problems there, but when i try to run a test (which should work because it works for a friend) i get an error which i cannot resolve:
...
0
votes
0answers
79 views
Global fixtures for PHPUnit in EcomDev for Magento
I got a test and want to make the fixture work always and be global.
Is there a way to have fixtures always present without @loadFixture?
Is there a way to say @loadFixture default in every class ...
1
vote
0answers
69 views
EcomDev Phpunit tests called twice during execution
I am trying to run few unit test cases and I see that they are being run twice in each run, I am not sure of the reason though.
The following is my test case structure -
class ...
2
votes
1answer
96 views
Magento phpunit assertion - assertEquals(true, false)
I am trying to use EcomDev_PHPUnit package for unit testing on Magento, and I had some issues in configuring it. I have posted the issue and the solution that worked for me here -
...
2
votes
1answer
257 views
Testing constructor args in phpunit
We use Varien_Http_Client to make http requests from a Magento extension, like this:
public function callApi(…)
{
<SNIP>
// Set default factory adapter to socket in case curl isn't ...
1
vote
1answer
123 views
ecomdev phpunit fixture for website specific configuration
I'm trying to understand PHPUNIT + MAGENTO and I found this extension https://github.com/EcomDev/EcomDev_PHPUnit which seems to be great tool.
I want have a fixture which set shipping method ...
0
votes
0answers
95 views
Can I teach PHPUnit that Mage::throwException *always* throws an exception?
Magento has a static method that does some extra reporting just before throwing an exception.
/**
* Throw Exception
*
* @param string $message
* @param string $messageStorage
* @throws ...
4
votes
0answers
132 views
Jenkins build multi-configuration project with MTAF not working on Sauce Labs
I configured the Magento Test Automation Framework (MTAF) with Jenkins and Sauce Labs and everything is working well. However, when building a multi-configuration project, I have selected two more ...
0
votes
0answers
100 views
How do i change from the backend to the front end after a test
i have a test that runs on the backend of magento however, it runs after a number of tests that run on the front end and after it are 2 more tests that run on the backend
when this test runs and ...
0
votes
0answers
101 views
Magento Test Automation Framework (MTAF)
The magento site is setup on machineA. The test framework and selenium are setup on machineB. The tests works fine from machineB. But is it possible to run the test from another machineC or browser. ...
0
votes
1answer
222 views
Magento EcomDev PHPUnit Customer fixtures are not being loaded
I have a case where i want to check if a customer already exists in the database. I have created a fixture file for this:
scope:
website:
- website_id: 1
code: main
name: Main ...
1
vote
2answers
216 views
EcomDev_PHPUnit mock Magento model in collection
I have successfully used getModelMock() and replaceByMock('model', $model_path, $mock). Today I was trying to reuse this code to override "save" but it was not working. After some digging I now see ...
1
vote
0answers
219 views
Magento integration testing: How to use fixtures instead of config.xml defaults?
We're using IvanChepurnyi's EcomDev_PHPUnit, which seems to have some good features for writing unit and integration tests with Magento, including stated features about loading data to and from the ...
0
votes
1answer
132 views
How do i test for 404 errors in PHPUnit using Selenium Server
I'm trying to write tests with PHP Unit using Selenieum Server, one test i got to make is checking for 404 error pages for images and hyperlinks
the hard part to this is that the tests are for a ...
3
votes
1answer
706 views
can't get session singleton in EcomDev PHPUnit test
After some serious debugging I have found I can't call to get a session object in Magento when running a test with EcomDev_PHPUnit module
any singleton/model call i.e. ...
0
votes
1answer
72 views
Unit Testing magento config
When unit testing in magento, shoul I be using mocks for config tests?
I now there is the ecomdev module etc out there so please no answers directing me to this :)
I'm simply wondering whether any ...
3
votes
1answer
329 views
Magento/PHPUnit - force an exception
I'm using phpunit and the ecomdev module to unit test Magento. For a particular class the last code that needs to be tested is an exception on attempting to save a model in a try/catch. The only way I ...
3
votes
1answer
160 views
Magento unit testing how to mock/load/use a product
I am using some very basic unit testing in a magento module and do not want to use any of the two main testing modules/frameworks for magento.
My question is relatively simple though. In a unit test ...
0
votes
1answer
572 views
How to test a Magento Block
I want to test a Magento block function. I don't know, how to call the function outside .phtml files. Does anybody know a function like getModel() for blocks?
I found
getBlockSingleton()
But, ...
0
votes
0answers
90 views
Magento module examples that have unit tests
Are there any modules on github that have completed unit tests with them?
I am looking to start using unit test with some modules but it seems a little more tricky in magento.
I am using modman so ...
1
vote
1answer
1k views
How to test Magento POST controller action - using (or not) EcomDev PHPUnit module
Is there way to test Magento POST controllers actions? E.g. customer login:
Mage_Customer_AccountController::loginPostAction()
I'm using EcomDev_PHPUnit module for test. It works great with basic ...
1
vote
2answers
201 views
PHPUnit with clover: class PHP_Token_OPEN_TAG not found
I am running PHP unit as follows:
phpunit --debug --verbose --coverage-clover=/tmp/test.xml
and get the following error:
Fatal error: Class 'PHP_Token_OPEN_TAG' not found in ...
0
votes
1answer
209 views
Use the Magento Test Automation Framework (MTAF) on a site with htaccess protection?
I want to run a test on a Magento installation that is protected with a htaccess password. How can I do that without entering the password each time the test is started?
Thanks!
1
vote
1answer
912 views
Fixtures in Magento & the eComDev Test Suite (discard one fixture and use a new one)
I writing a Magento plugin and try to test it with the PHPUnit Testing Integration from http://www.ecomdev.org. Right now I'm trying to test a method which two different sets of config settings but ...
1
vote
1answer
80 views
How to apply upgrades programmatically in phpunit tests?
I have developed module with sql script upgrade and after that my phpunit tests got not success, these break in place of call new attribute for customer.
I have investigated this case and concluded ...
1
vote
1answer
439 views
Magento PHPUnit Testing with EcomDev Module, gives SQL error when inserting Invoice Items
I have the YAML for the invoice data to go into the testing database:
After The Scope data for the website, the Customer Data, Product Data, and Order Data, there is the Invoice Data, and I will only ...
10
votes
2answers
571 views
Examples of open source php projects that ship with comprehensive test coverage
There are a series of prior questions that tangentially ask this question, but not directly regarding PHP, and none with actual answers, so I hope you can accommodate this iteration of the question.
...
3
votes
1answer
1k views
How to begin and rollback a database transaction to wrap a PHPUnit suite for Magento
I'd like to use a transaction rollback method to isolate my database for unit testing purposes. Ideally, I would use a structure something like this:
public static function setUpBeforeClass(){
...
1
vote
2answers
608 views
How to change database connection on the fly for PhpUnit tests
I am working on a Magento 1.4.1 project, and I want to use PhpUnit to test my models.
I am able to run my PhpUnit test using the default connection, but I want to use a different database connection ...