Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
CustomerId.php
Go to the documentation of this file.
1 <?php
8 
10 use Magento\Mtf\Fixture\FixtureFactory;
11 use Magento\Mtf\Fixture\DataSource;
12 
16 class CustomerId extends DataSource
17 {
24  public function __construct(FixtureFactory $fixtureFactory, array $params, array $data = [])
25  {
26  $this->params = $params;
27  if (isset($data['customer']) && $data['customer'] instanceof Customer) {
28  $this->data = $data['customer'];
29  return;
30  }
31  if (isset($data['dataset'])) {
32  $customer = $fixtureFactory->createByCode('customer', ['dataset' => $data['dataset']]);
33  if ($customer->hasData('id') === false) {
34  $customer->persist();
35  }
36  $this->data = $customer;
37  }
38  }
39 
45  public function getCustomer()
46  {
47  return $this->data;
48  }
49 }
$customer
Definition: customers.php:11
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
Definition: website.php:18
__construct(FixtureFactory $fixtureFactory, array $params, array $data=[])
Definition: CustomerId.php:24