/**
  * testSetGet
  *
  * @return void
  */
 public function testSetGet()
 {
     $resources = ['1' => 'some', '2' => 'res'];
     $providerId = 'someprovider';
     $resourceProvider = new ResourceProvider($resources);
     $resourceProvider->setProviderId($providerId);
     $this->assertEquals($providerId, $resourceProvider->getProviderId(), 'Setter or getter failed.');
     $this->assertEquals($resources, $resourceProvider->getResources(), 'Setter or getter failed.');
     $this->assertEquals($resources['1'], $resourceProvider->getResource('1'), 'Setter or getter failed.');
     $this->assertNull($resourceProvider->getResource('NOPE'), 'Unset reaource should return null');
 }
 /**
  * build
  *
  * @param mixed  $providerData
  * @param string $providerId
  *
  * @return ResourceProviderInterface
  * @throws RcmUserException
  */
 public function build($providerData, $providerId = null)
 {
     $provider = null;
     if ($providerData instanceof ResourceProviderInterface) {
         $provider = $providerData;
     }
     if (is_string($providerData)) {
         $provider = $this->getServiceLocator()->get($providerData);
     }
     if (is_array($providerData)) {
         $provider = new \RcmUser\Acl\Provider\ResourceProvider($providerData);
     }
     if ($provider instanceof ResourceProvider) {
         $provider->setProviderId($providerId);
     }
     if ($provider === null) {
         throw new RcmUserException('ResourceProvider is not valid: ' . var_export($providerData, true));
     }
     if ($provider->getProviderId() === null) {
         throw new RcmUserException('ResourceProvider is not valid, provider ID missing: ' . var_export($providerData, true));
     }
     return $provider;
 }