createCustomers example

 {
    }

    public function getDefinition(): string
    {
        return CustomerDefinition::class;
    }

    public function generate(int $numberOfItems, DemodataContext $context, array $options = []): void
    {
        $this->faker = $context->getFaker();
        $this->createCustomers($numberOfItems$context);

        try {
            $this->createDefaultCustomer($context->getContext());
        } catch (\Exception $e) {
            $context->getConsole()->warning('Could not create default customer: ' . $e->getMessage());
        }
    }

    private function createNetCustomerGroup(Context $context): string
    {
        $id = Uuid::randomHex();
        
protected function setUp(): void
    {
        parent::setUp();

        $this->customerRepository = $this->getContainer()->get('customer.repository');

        $this->addressId = Uuid::randomHex();
    }

    public function testDeleteAddressOfOtherCustomer(): void
    {
        [$id1$id2] = $this->createCustomers();

        $context = $this->getContainer()->get(SalesChannelContextFactory::class)
            ->create(Uuid::randomHex(), TestDefaults::SALES_CHANNEL, [SalesChannelContextService::CUSTOMER_ID => $id1]);

        $customer = $context->getCustomer();
        static::assertInstanceOf(CustomerEntity::class$customer);
        static::assertSame($id1$customer->getId());

        $controller = $this->getContainer()->get(AddressController::class);

        $request = new Request();
        
Home | Imprint | This part of the site doesn't use cookies.