public function testAddResources()
 {
     $resource = $this->getMock('Certificationy\\Component\\Certy\\Collector\\ResourceInterface');
     $resources = [['fooProvider', 'fooCertification', [$resource, $resource, $resource]], ['fooProvider', 'fooCertification', [$resource]], ['fooProvider', 'fooCertification', [$resource]], ['barProvider', 'fooCertification', [$resource]], ['barProvider', 'fooCertification', [$resource]], ['barProvider', 'fooCertification', [$resource]], ['barProvider', 'fooCertification', [$resource]], ['barProvider', 'fooCertification', [$resource]], ['barProvider', 'barCertification', [$resource]], ['barProvider', 'barCertification', [$resource]], ['barProvider', 'barCertification', [$resource]], ['bazProvider', 'fooCertification', [$resource]]];
     foreach ($resources as $resourceNode) {
         list($providerName, $certificationName, $resources) = $resourceNode;
         $this->collector->addResource($providerName, $certificationName, $resources);
     }
     $resources = $this->collector->getResources();
     /**
      * We have 3 diffrent providers
      * fooProvider contains 1 certification (fooCertification) with 5 resources
      * barProvider contains 2 certification fooCertification => 5 resources, barCertification => 3 resources
      * bazProvider contains 1 certification fooCertification => 1 resource
      */
     //Check provider structure
     $this->assertCount(3, $resources);
     $this->assertArrayHasKey('fooProvider', $resources);
     $this->assertArrayHasKey('barProvider', $resources);
     $this->assertArrayHasKey('bazProvider', $resources);
     //Check inner provider structure
     $fooProvider = $resources['fooProvider'];
     $barProvider = $resources['barProvider'];
     $bazProvider = $resources['bazProvider'];
 }
 /**
  * @param CertificationContextInterface $context
  *
  * @return Certification
  */
 public function build(CertificationContextInterface $context)
 {
     if ($this->collector->isDirty()) {
         $this->collector->release();
     }
     if (null !== $this->logger) {
         $this->logger->debug(sprintf('Build certification %s', $context->getName()));
     }
     $oid = md5(serialize($context));
     //It's not based of object instance, but on his content.
     if (!isset($this->cache[$oid])) {
         foreach ($this->builderPass as $pass) {
             $pass->setCollector($this->collector);
             $pass->execute($this, $context);
         }
         $this->cache[$oid] = $this->normalize($context);
     }
     return $this->cache[$oid];
 }