public function testNameValueAttributeValueArray() { $attribute = new NameValueAttribute('list', ['FOO', 'BAR']); $expectedXml = $this->buildExpectedXml(['name' => 'list', 'value' => ['FOO', 'BAR'], 'type' => 'STRING']); $this->assertEquals($expectedXml, $attribute->render()); }
/** * Only urls need passing, the type is automatically set to PRIMARY for the first url, SECONDARY for others * If all urls share the same prefix, can pass that in as an optional parameter (so only need to pass unique ids) * * @param array $urls * @param string $urlPrefix */ public function setAssets(array $urls, $urlPrefix = '') { $urls = array_filter($urls); foreach ($urls as $index => $asset) { $asset = Xml::escape($urlPrefix . $asset); $type = $index > 0 ? 'SECONDARY' : 'PRIMARY'; $attribute = new NameValueAttribute('provider_name', 'asda.scene7.com'); $this->assets .= <<<XML <Asset> <assetURL>{$asset}</assetURL> <usageType>{$type}</usageType> <rank>1</rank> <AssetAttributes>{$attribute->render()}</AssetAttributes> </Asset> XML; } }