예제 #1
0
 public function testCreateAsset()
 {
     $url = 'http://acquia.com/sites/default/files/foo.png';
     $replaceToken = '[acquia-logo]';
     $asset = new Asset();
     $asset->setUrl($url);
     $asset->setReplaceToken($replaceToken);
     $this->assertEquals($url, $asset->getUrl());
     $this->assertEquals($replaceToken, $asset->getReplaceToken());
 }
예제 #2
0
 /**
  * Adds an Asset to the Entity.
  *
  * @param Asset $asset
  * @return $this
  */
 public function addAsset(Asset $asset)
 {
     $assets = $this->getAssets();
     foreach ($assets as $myasset) {
         if ($myasset->getReplaceToken() == $asset->getReplaceToken()) {
             // Make sure not to add an asset with the same token.
             return $this;
         }
     }
     $this['assets'][] = $asset;
     return $this;
 }