21 private $groupFactory;
25 $this->groupFactory = $this->getMockBuilder(\
Magento\
Customer\Model\GroupFactory::class)
26 ->disableOriginalConstructor()
27 ->setMethods([
'create'])
29 $this->unit = new \Magento\Customer\Model\GroupRegistry($this->groupFactory);
41 ->setMethods([
'load',
'getId',
'__wakeup'])
42 ->disableOriginalConstructor()
44 $group->expects($this->once())
47 ->will($this->returnValue(
$group));
48 $group->expects($this->exactly(2))
50 ->will($this->returnValue(
$groupId));
51 $this->groupFactory->expects($this->once())
53 ->will($this->returnValue(
$group));
54 $actual = $this->unit->retrieve(
$groupId);
55 $this->assertEquals(
$group, $actual);
56 $actualCached = $this->unit->retrieve(
$groupId);
57 $this->assertSame(
$group, $actualCached);
70 ->setMethods([
'load',
'getId',
'__wakeup'])
71 ->disableOriginalConstructor()
73 $group->expects($this->once())
76 ->will($this->returnValue(
$group));
77 $group->expects($this->once())
79 ->will($this->returnValue(
null));
80 $this->groupFactory->expects($this->once())
82 ->will($this->returnValue(
$group));
95 ->disableOriginalConstructor()
96 ->setMethods([
'load',
'getId',
'__wakeup'])
98 $group->expects($this->exactly(2))
101 ->will($this->returnValue(
$group));
102 $group->expects($this->exactly(4))
104 ->will($this->returnValue(
$groupId));
105 $this->groupFactory->expects($this->exactly(2))
107 ->will($this->returnValue(
$group));
108 $actual = $this->unit->retrieve(
$groupId);
109 $this->assertSame(
$group, $actual);
111 $actual = $this->unit->retrieve(
$groupId);
112 $this->assertSame(
$group, $actual);