public function testFindAllByCustomer()
 {
     $customer = $this->prophesize(Customer::class);
     $customer->getId()->willReturn(1234);
     $events = [$this->prophesize(CustomerEvent::class)->reveal()];
     $this->storage->findAllBy(['type' => OrderEvent::TYPE, 'customerId' => 1234], null, null)->willReturn($events);
     self::assertSame($events, $this->object->findAllByCustomer($customer->reveal()));
 }
 /**
  * @dataProvider findAllByCustomerProvider
  */
 public function testFindAllByCustomer($criteria, $customerId, $isAnonymousCustomer)
 {
     $result = [$this->createEventProphet()->reveal(), $this->createEventProphet()->reveal()];
     $this->storage->findAllBy($criteria, null, null)->willReturn($result);
     $customer = $this->prophesize(Customer::class);
     $customer->getId()->willReturn($customerId);
     $customer->isAnonymous()->willReturn($isAnonymousCustomer);
     self::assertSame($result, $this->object->findAllByCustomer($customer->reveal()));
 }
 /**
  * @dataProvider findAllWithReferrerProvider
  */
 public function testFindAllWithReferrer($customerIdField, $customerId, $isAnonymous)
 {
     $customer = $this->prophesize(Customer::class);
     $customer->getId()->willReturn($customerId);
     $customer->isAnonymous()->willReturn($isAnonymous);
     $events = [$this->prophesize(CustomerEvent::class)->reveal()];
     $this->storage->findAllBy(['type' => PageviewEvent::TYPE, 'data' => new ArrayValuesContains([PageviewEvent::REFERRER_FIELD => new NotEmpty()]), $customerIdField => $customerId])->willReturn($events);
     self::assertSame($events, $this->object->findAllWithReferrer($customer->reveal()));
 }