コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function getById($id)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getById');
     if (!$pluginInfo) {
         return parent::getById($id);
     } else {
         return $this->___callPlugins('getById', func_get_args(), $pluginInfo);
     }
 }
コード例 #2
0
 /**
  * Create a test group.
  *
  * @param CustomerGroup $group The group to create and save.
  * @return int The group Id of the group that was created.
  */
 private function createGroup($group)
 {
     $groupId = $this->groupRepository->save($group)->getId();
     $this->assertNotNull($groupId);
     $newGroup = $this->groupRepository->getById($groupId);
     $this->assertEquals($groupId, $newGroup->getId(), 'The group id does not match.');
     $this->assertEquals($group->getCode(), $newGroup->getCode(), 'The group code does not match.');
     $this->assertEquals($group->getTaxClassId(), $newGroup->getTaxClassId(), 'The group tax class id does not match.');
     $this->groupRegistry->remove($groupId);
     return $groupId;
 }
コード例 #3
0
 public function testGetById()
 {
     $groupId = 86;
     $this->groupRegistry->expects($this->once())->method('retrieve')->with($groupId)->willReturn($this->groupModel);
     $this->groupDataFactory->expects($this->once())->method('create')->willReturn($this->group);
     $this->group->expects($this->once())->method('setId')->with($groupId)->willReturnSelf();
     $this->group->expects($this->once())->method('setCode')->with('Code')->willReturnSelf();
     $this->group->expects($this->once())->method('setTaxClassId')->with(234)->willReturnSelf();
     $this->group->expects($this->once())->method('setTaxClassName')->with('Tax class name')->willReturnSelf();
     $this->groupModel->expects($this->atLeastOnce())->method('getId')->willReturn($groupId);
     $this->groupModel->expects($this->atLeastOnce())->method('getCode')->willReturn('Code');
     $this->groupModel->expects($this->atLeastOnce())->method('getTaxClassId')->willReturn(234);
     $this->groupModel->expects($this->atLeastOnce())->method('getTaxClassName')->willReturn('Tax class name');
     $this->assertSame($this->group, $this->model->getById($groupId));
 }