/** @test * */
 public function getAsset_ReturnAttachmentKeyWhenValueIsNotPresent()
 {
     // Arrange
     $assetKey = "an/image.jpeg";
     $themeId = 828155753;
     $expectedContent = base64_encode("This is some image content");
     $payload = ["asset" => ["key" => $assetKey, "public_url" => "https://cdn.myshopify.com/s/files/1/0006/9093/3842/t/1/assets/an/image.jpeg", "attachment" => $expectedContent, "created_at" => "2000-01-01T00:00:00-00:00", "updated_at" => "2000-01-01T00:00:00-00:00", "content_type" => "image\\jpeg", "size" => sizeof($expectedContent), "theme_id" => $themeId]];
     $this->wrapperFake->setResponse("GET", ShopifyEndpoints::getAsset($assetKey, $themeId), $payload);
     // Act
     $actual = $this->clientWithFake->getAsset($assetKey, $themeId);
     // Assert
     $this->assertEquals($expectedContent, $actual);
 }
Example #2
0
 /**
  * @param int    $themeId
  * @param string $filePath
  * @param string $asset
  * @return void
  */
 public function execute($themeId, $filePath, $asset)
 {
     $assetType = $this->isImage($filePath) ? AssetType::Image : AssetType::Text;
     $this->shopify->updateAsset($asset, $assetType, file_get_contents($filePath), $themeId);
 }