|
@@ 35-55 (lines=21) @@
|
| 32 |
|
*/ |
| 33 |
|
class UserContextFactoryTest extends TestCase |
| 34 |
|
{ |
| 35 |
|
public function testFromConfig() |
| 36 |
|
{ |
| 37 |
|
$config = new ClientConfig([ |
| 38 |
|
'organizations' => [ |
| 39 |
|
[ |
| 40 |
|
'name' => 'peerOrg1', |
| 41 |
|
'mspid' => 'Org1MSP', |
| 42 |
|
'adminCerts' => __FILE__, |
| 43 |
|
], |
| 44 |
|
], |
| 45 |
|
]); |
| 46 |
|
|
| 47 |
|
$result = UserContextFactory::fromConfig($config, 'peerOrg1'); |
| 48 |
|
|
| 49 |
|
self::assertInstanceOf(UserContext::class, $result); |
| 50 |
|
self::assertInstanceOf(SerializedIdentity::class, $result->getIdentity()); |
| 51 |
|
self::assertInstanceOf(OrganizationOptionsInterface::class, $result->getOrganization()); |
| 52 |
|
self::assertSame('peerOrg1', $result->getOrganization()->getName()); |
| 53 |
|
self::assertSame('Org1MSP', $result->getOrganization()->getMspId()); |
| 54 |
|
self::assertSame(__FILE__, $result->getOrganization()->getAdminCerts()); |
| 55 |
|
} |
| 56 |
|
|
| 57 |
|
public function testFromConfigWithDefaultOrganization() |
| 58 |
|
{ |
|
@@ 57-77 (lines=21) @@
|
| 54 |
|
self::assertSame(__FILE__, $result->getOrganization()->getAdminCerts()); |
| 55 |
|
} |
| 56 |
|
|
| 57 |
|
public function testFromConfigWithDefaultOrganization() |
| 58 |
|
{ |
| 59 |
|
$config = new ClientConfig([ |
| 60 |
|
'organizations' => [ |
| 61 |
|
[ |
| 62 |
|
'name' => 'peerOrg1', |
| 63 |
|
'mspid' => 'Org1MSP', |
| 64 |
|
'adminCerts' => __FILE__, |
| 65 |
|
], |
| 66 |
|
], |
| 67 |
|
]); |
| 68 |
|
|
| 69 |
|
$result = UserContextFactory::fromConfig($config); |
| 70 |
|
|
| 71 |
|
self::assertInstanceOf(UserContext::class, $result); |
| 72 |
|
self::assertInstanceOf(SerializedIdentity::class, $result->getIdentity()); |
| 73 |
|
self::assertInstanceOf(OrganizationOptionsInterface::class, $result->getOrganization()); |
| 74 |
|
self::assertSame('peerOrg1', $result->getOrganization()->getName()); |
| 75 |
|
self::assertSame('Org1MSP', $result->getOrganization()->getMspId()); |
| 76 |
|
self::assertSame(__FILE__, $result->getOrganization()->getAdminCerts()); |
| 77 |
|
} |
| 78 |
|
|
| 79 |
|
public function testFromConfigWithMultipleOrganizations() |
| 80 |
|
{ |