Skip to content

Magento 2 Unit Test With CustomerFactory

I’m trying to write a test for a function and having the issue:

There was 1 error:

1) ***********TestUnitApiShopperDataManagementTest::testGetShopperDataReturnArray
Error: Call to a member function getCollection() on null

You can see the method and everything related below, on screenshots. Right now I’m just trying to pass this step. If someone could suggest how can I assert (make sure) this function returns array.

Thank you!

Class for testing

Test

Error