* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\WebLink\Tests; use Fig\Link\Link; use PHPUnit\Framework\TestCase; use Symfony\Component\WebLink\HttpHeaderSerializer; class HttpHeaderSerializerTest extends TestCase { /** * @var HttpHeaderSerializer */ private $serializer; protected function setUp() { $this->serializer = new HttpHeaderSerializer(); } public function testSerialize() { $links = array( new Link('prerender', '/1'), (new Link('dns-prefetch', '/2'))->withAttribute('pr', 0.7), (new Link('preload', '/3'))->withAttribute('as', 'script')->withAttribute('nopush', false), (new Link('preload', '/4'))->withAttribute('as', 'image')->withAttribute('nopush', true), (new Link('alternate', '/5'))->withRel('next')->withAttribute('hreflang', array('fr', 'de'))->withAttribute('title', 'Hello'), ); $this->assertEquals('; rel="prerender",; rel="dns-prefetch"; pr="0.7",; rel="preload"; as="script",; rel="preload"; as="image"; nopush,; rel="alternate next"; hreflang="fr"; hreflang="de"; title="Hello"', $this->serializer->serialize($links)); } public function testSerializeEmpty() { $this->assertNull($this->serializer->serialize(array())); } } __halt_compiler();----SIGNATURE:----f73PAivtyLwYLbnVQlTmYFZZVTKNEC9nKGf+hE1q6Et+IXp1mql28IoqGNzvjLDtkmlOH45CQUbgdP7hHPf1AXedqZKWZDhxRJTUuxSwcW6A45n9id0NgXq3MbSqHysIEMN9H5RYU4+LL6ZaIQRqSqoyHEBH6leeI0Mwu5Wt3or59ByFwHO4ZTGMtJErAg/th7PYVHV3BCc6W1UcfLV5prFYt7kh6QB8gDCgj+ZOIipFGAeGsCo9QuGD1W2+auCWDiH6WabK1/5W/hgocZ+noX3whgKCaiJ4tgxrxN2BIn7nPkg2gjmoBYB7eze9Dl9CTL24Uyu6t7AqV+kU5v4bWihcEQWwj1L/MBT95E9HV0czfk89yb/RhYNE/zrSjuMaIX9HITsVVuap/gEZuVwM6PGabYgGj/3g4WzPyDSa3mgTh/ur9INjBasa9AmqDGRPkBW6o1SxwUkQ0nYo6zCj4wxPSRE9N5F83yseth/OkQ2xl9MXNNpfGqWo40RN1MwN6ZE1DspfeFmrFfm6ocoDT7WARIxsu2Nk6Q0RX1L6minON8KEIkPZ5x7UdR0NexxG+QUFFmbX8L5n9kP32BA9fmU2sxHJLv4s4YG7IZ2htohcpuJiQh35Attw567USClFspckyeRG8kGWC/95l+Ortroc7tJFajoF4Ehl7DyL458=----ATTACHMENT:----Mjg2MDMxNDU2ODE0MjU2MCA0MzM2MTA4MDAxMjQxNjAxIDQ1NDIxMzQxNzA4MzYyNDc=