Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Member Functions | Protected Attributes
GroupManagementTest Class Reference
Inheritance diagram for GroupManagementTest:

Public Member Functions

 testGetDefaultGroupWithStoreId ($testGroup, $storeId)
 
 testGetDefaultGroupWithInvalidStoreId ()
 
 testIsReadonlyWithGroupId ()
 
 testIsReadonlyWithInvalidGroupId ()
 
 testGetNotLoggedInGroup ()
 
 testGetLoggedInGroups ()
 
 testGetAllGroup ()
 

Protected Member Functions

 setUp ()
 

Protected Attributes

 $objectManager
 
 $groupManagement
 

Detailed Description

Test for Magento\Customer\Model\GroupManagement

Definition at line 15 of file GroupManagementTest.php.

Member Function Documentation

◆ setUp()

setUp ( )
protected

Definition at line 27 of file GroupManagementTest.php.

28  {
29  $this->objectManager = Bootstrap::getObjectManager();
30  $this->groupManagement = $this->objectManager->get(\Magento\Customer\Api\GroupManagementInterface::class);
31  }

◆ testGetAllGroup()

testGetAllGroup ( )

Definition at line 104 of file GroupManagementTest.php.

105  {
106  $allGroup = $this->groupManagement->getAllCustomersGroup();
107  $this->assertEquals(32000, $allGroup->getId());
108  }

◆ testGetDefaultGroupWithInvalidStoreId()

testGetDefaultGroupWithInvalidStoreId ( )

@expectedException \Magento\Framework\Exception\NoSuchEntityException

Definition at line 68 of file GroupManagementTest.php.

69  {
70  $storeId = 1234567;
71  $this->groupManagement->getDefaultGroup($storeId);
72  }

◆ testGetDefaultGroupWithStoreId()

testGetDefaultGroupWithStoreId (   $testGroup,
  $storeId 
)
Parameters
$testGroup
$storeId@dataProvider getDefaultGroupDataProvider

Definition at line 39 of file GroupManagementTest.php.

40  {
41  $this->assertDefaultGroupMatches($testGroup, $storeId);
42  }

◆ testGetLoggedInGroups()

testGetLoggedInGroups ( )

Definition at line 95 of file GroupManagementTest.php.

96  {
97  $loggedInGroups = $this->groupManagement->getLoggedInGroups();
98  foreach ($loggedInGroups as $group) {
99  $this->assertNotEquals(GroupManagement::NOT_LOGGED_IN_ID, $group->getId());
100  $this->assertNotEquals(GroupManagement::CUST_GROUP_ALL, $group->getId());
101  }
102  }
$group
Definition: sections.phtml:16

◆ testGetNotLoggedInGroup()

testGetNotLoggedInGroup ( )

Definition at line 89 of file GroupManagementTest.php.

90  {
91  $notLoggedInGroup = $this->groupManagement->getNotLoggedInGroup();
92  $this->assertEquals(GroupManagement::NOT_LOGGED_IN_ID, $notLoggedInGroup->getId());
93  }

◆ testIsReadonlyWithGroupId()

testIsReadonlyWithGroupId ( )

Definition at line 74 of file GroupManagementTest.php.

75  {
76  $testGroup = ['id' => 3, 'code' => 'General', 'tax_class_id' => 3, 'tax_class_name' => 'Retail Customer'];
77  $this->assertEquals(false, $this->groupManagement->isReadonly($testGroup['id']));
78  }

◆ testIsReadonlyWithInvalidGroupId()

testIsReadonlyWithInvalidGroupId ( )

@expectedException \Magento\Framework\Exception\NoSuchEntityException

Definition at line 83 of file GroupManagementTest.php.

84  {
85  $testGroup = ['id' => 4, 'code' => 'General', 'tax_class_id' => 3, 'tax_class_name' => 'Retail Customer'];
86  $this->groupManagement->isReadonly($testGroup['id']);
87  }

Field Documentation

◆ $groupManagement

$groupManagement
protected

Definition at line 25 of file GroupManagementTest.php.

◆ $objectManager

$objectManager
protected

Definition at line 20 of file GroupManagementTest.php.


The documentation for this class was generated from the following file: