Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
christian cannata authored and christian cannata committed Nov 4, 2016
1 parent 3d5b91b commit 161b438
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
12 changes: 6 additions & 6 deletions src/Smalot/PdfParser/Header.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ class Header
protected $elements = null;

/**
* @param Element[] $elements List of elements.
* @param Document $document Document.
* @param Element[] $elements List of elements.
* @param Document $document Document.
*/
public function __construct($elements = array(), Document $document = null)
{
Expand Down Expand Up @@ -99,7 +99,7 @@ public function getElementTypes()
*/
public function getDetails($deep = true)
{
$values = array();
$values = array();
$elements = $this->getElements();

foreach ($elements as $key => $element) {
Expand All @@ -112,7 +112,7 @@ public function getDetails($deep = true)
$values[$key] = $element->getDetails();
}
} elseif ($element instanceof Element) {
$values[$key] = (string)$element;
$values[$key] = (string) $element;
}
}

Expand Down Expand Up @@ -175,9 +175,9 @@ protected function resolveXRef($name)
}

/**
* @param string $content The content to parse
* @param string $content The content to parse
* @param Document $document The document
* @param int $position The new position of the cursor after parsing
* @param int $position The new position of the cursor after parsing
*
* @return Header
*/
Expand Down
13 changes: 5 additions & 8 deletions src/Smalot/PdfParser/Tests/Units/Header.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,9 @@ public function testGet()
$this->assert->object($header->get('SubType'))->isInstanceOf('\Smalot\PdfParser\Element\ElementName');
$this->assert->object($header->get('Font'))->isInstanceOf('\Smalot\PdfParser\Page');
$this->assert->object($header->get('Image'))->isInstanceOf('\Smalot\PdfParser\Element\ElementMissing');
$resources = $header->get('Resources');

try {
$resources = $header->get('Resources');
$this->assert->boolean(true)->isEqualTo(false);
} catch (\Exception $e) {
$this->assert->exception($e)->hasMessage('Missing object reference #8_0.');
}
$this->assert->variable($resources)->isNull();
}

public function testResolveXRef()
Expand All @@ -138,11 +134,12 @@ public function testResolveXRef()

$this->assert->object($header->get('Font'))->isInstanceOf('\Smalot\PdfParser\Object');

$header=$header->get('Resources');
try {
$this->assert->object($header->get('Resources'))->isInstanceOf('\Smalot\PdfParser\Element\ElementMissing');
$this->assert->variable($header)->isInstanceOf('\Smalot\PdfParser\Element\ElementMissing');
$this->assert->boolean(true)->isEqualTo(false);
} catch (\Exception $e) {
$this->assert->exception($e)->hasMessage('Missing object reference #8_0.');
$this->assert->variable($header)->isNull();
}
}
}

0 comments on commit 161b438

Please sign in to comment.