Esempio n. 1
0
 /**
  * @expectedException \Thelia\Exception\FileNotFoundException
  * @expectedExceptionMessage Your archive must contain one of these file and doesn't:
  */
 public function testGetFileContentInArchiveFail()
 {
     /** @var ZipArchiveBuilder $archive */
     $archive = $this->getArchiveBuilderManager($this->container)->get("ZIP");
     $formatter = new XMLFormatter();
     $archive->addFileFromString("foo", "bar");
     $this->controller->getFileContentInArchive($archive, $this->getFormatterManager($this->container), [$formatter->getHandledType()]);
 }
Esempio n. 2
0
 public function testComplexDecode()
 {
     $expectedData = [["name" => "foo", "value" => "bar"], "row" => [["name" => "fruit", "value" => "banana"], ["name" => "type", "value" => "fruit"], "orange" => [["name" => "type", "value" => "fruit"]], "banana" => [["name" => "like", "value" => "Yes"]]]];
     $dom = new \DOMDocument("1.0");
     $base = $dom->appendChild(new \DOMElement($this->formatter->root));
     /** @var \DOMElement $node */
     $node = $base->appendChild(new \DOMElement($this->formatter->nodeName));
     $node->setAttribute("name", "foo");
     $node->setAttribute("value", "bar");
     $baz = $base->appendChild(new \DOMElement($this->formatter->rowName));
     $node = $baz->appendChild(new \DOMElement($this->formatter->nodeName));
     $node->setAttribute("name", "fruit");
     $node->setAttribute("value", "banana");
     $node = $baz->appendChild(new \DOMElement($this->formatter->nodeName));
     $node->setAttribute("name", "type");
     $node->setAttribute("value", "fruit");
     $baz = $base->appendChild(new \DOMElement($this->formatter->rowName));
     $orange = $baz->appendChild(new \DOMElement("orange"));
     $node = $orange->appendChild(new \DOMElement($this->formatter->nodeName));
     $node->setAttribute("name", "type");
     $node->setAttribute("value", "fruit");
     $banana = $baz->appendChild(new \DOMElement("banana"));
     $node = $banana->appendChild(new \DOMElement($this->formatter->nodeName));
     $node->setAttribute("name", "like");
     $node->setAttribute("value", "Yes");
     $data = $this->formatter->rawDecode($dom->saveXML());
     $this->assertEquals($expectedData, $data);
     $expectedData = ["foo" => "bar", "row" => ["fruit" => "banana", "type" => "fruit", "orange" => ["type" => "fruit"], "banana" => ["like" => "Yes"]]];
     $data = $this->formatter->decode($dom->saveXML());
     $this->assertEquals($expectedData, $data->getData());
 }