Exemplo n.º 1
0
 /**
  * @throws Exception\EmptyHeadersException
  * @throws Exception\InvalidArgumentTypeException
  * @throws Exception\OutputPathNotWritableException
  */
 public function validateOutput()
 {
     $headers = $this->config->getHeaders();
     if (empty($headers)) {
         throw new Exception\EmptyHeadersException();
     }
     if (!is_writable($this->config->getOutputDir())) {
         throw new Exception\OutputPathNotWritableException();
     }
     if (!is_string($this->config->getFilename())) {
         throw new Exception\InvalidArgumentTypeException();
     }
     $data = $this->config->getData();
     if (empty($data)) {
         throw new Exception\DataNotFoundException();
     }
 }
Exemplo n.º 2
0
 public function testGetSetHeaderParams()
 {
     $config = new ExportSettings();
     $this->assertFalse($config->isHeaderKeysAsParams());
     $this->assertNull($config->getHeaders());
     $config->setHeaders(['foo', 'bar']);
     $this->assertSame(['foo', 'bar'], $config->getHeaderParams());
     $this->assertSame($config->getHeaders(), $config->getHeaderParams());
     $config->setHeaderKeysAsParams(true);
     $this->assertTrue($config->isHeaderKeysAsParams());
     $this->assertSame([0, 1], $config->getHeaderParams());
     $this->assertSame(['foo', 'bar'], $config->getHeaders());
     $config->setHeaders(['this' => 'is', 'associative' => 'array']);
     $this->assertTrue($config->isHeaderKeysAsParams());
     $this->assertSame(['this', 'associative'], $config->getHeaderParams());
     $this->assertSame(['this' => 'is', 'associative' => 'array'], $config->getHeaders());
 }