Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
phpUnit is the standard base for doing unit tests in the php world. When used in Magento Context it most times includes the usage of the EcomDev_PHPUnit Magento module.
8
votes
2
answers
2k
views
How to mock a Context object
I am trying to test a module which contains a context object as follows:
public function __construct(
\Magento\Framework\App\Helper\Context $context,
\Magento\Catalog\Model\Product\ImageFacto …
5
votes
4
answers
6k
views
ObjectManager is unusable for me in Magento 2 Unit Tests
I am following Vinai Kopp's Series on Mage2CodeKata but it gives me an error message when I declare the $objectManager. After seeing these treads:
Object Manager in Unit Testing in magento 2
Magento …
3
votes
1
answer
906
views
How to mock a class property in Magento 2 Unit Test
How can I mock a class attribute such as a particular object (Ex: \Magento\Catalog\Model\Product)
1
vote
1
answer
727
views
How to mock an external resource in Magento 2?
I want to write unit test for a module which contains these functions:
public function abc($Str)
{
$n = $this->def();
...
return x;
}
public function def()
{
...
$productRepo= $ …
0
votes
1
answer
1k
views
How to write Unit Test for a function which uses a variable defined in Constructor
I'm trying to write a Unit Test in Magento 2 which uses a variable defined in __construct(). The variable gets its value in another function. Thus when I run my test it gives me an error that the vari …