Example #1
0
 public function testLoadByCustomerId()
 {
     $customerId = 1;
     $customerIdFieldName = 'customer_id';
     $sharingCode = 'expected_sharing_code';
     $this->eventDispatcher->expects($this->any())->method('dispatch');
     $this->resource->expects($this->any())->method('getCustomerIdFieldName');
     $this->resource->expects($this->once())->method('load')->with($this->logicalOr($this->wishlist, $customerId, $customerIdFieldName));
     $this->mathRandom->expects($this->once())->method('getUniqueHash')->will($this->returnValue($sharingCode));
     $this->assertInstanceOf('Magento\\Wishlist\\Model\\Wishlist', $this->wishlist->loadByCustomerId($customerId, true));
     $this->assertEquals($customerId, $this->wishlist->getCustomerId());
     $this->assertEquals($sharingCode, $this->wishlist->getSharingCode());
 }