13 private $customerStructure = [
22 'addresses-count' => 10
28 private $addressGeneratorMock;
33 private $customerGenerator;
37 $this->groupCollectionFactoryMock =
38 $this->createPartialMock(
40 [
'create',
'getAllIds']
43 $this->groupCollectionFactoryMock
44 ->expects($this->once())
46 ->willReturn($this->groupCollectionFactoryMock);
48 $this->groupCollectionFactoryMock
49 ->expects($this->once())
53 $this->addressGeneratorMock = $this->createMock(\
Magento\
Setup\Model\Address\AddressDataGenerator::class);
55 $this->customerGenerator = new \Magento\Setup\Model\Customer\CustomerDataGenerator(
56 $this->groupCollectionFactoryMock,
57 $this->addressGeneratorMock,
64 $customer = $this->customerGenerator->generate(42);
71 $this->addressGeneratorMock
72 ->expects($this->exactly(10))
73 ->method(
'generateAddress');
75 $customer = $this->customerGenerator->generate(42);
77 $this->assertCount($this->config[
'addresses-count'],
$customer[
'addresses']);
82 $customer = $this->customerGenerator->generate(1);
83 $this->assertEquals(1,
$customer[
'customer'][
'group_id']);
88 $customer = $this->customerGenerator->generate(42);
90 foreach ($this->customerStructure as $customerField) {
91 $this->assertTrue(array_key_exists($customerField,
$customer));