Skip to content

Commit

Permalink
Found the secret to nesting
Browse files Browse the repository at this point in the history
  • Loading branch information
SMillerDev committed Apr 6, 2020
1 parent 4392416 commit d06fe67
Show file tree
Hide file tree
Showing 4 changed files with 594 additions and 530 deletions.
2 changes: 1 addition & 1 deletion src/PHPDraft/Model/Elements/ObjectStructureElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ protected function parse_value_structure($value, array &$dependencies)
break;
default:
case 'object':
$value = $value->content->value->content ?? null;
$value = $value->content->value ?? null;
$struct = $this->new_instance();
break;
}
Expand Down
24 changes: 0 additions & 24 deletions src/PHPDraft/Parse/Tests/HtmlGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ public function setUp(): void
$data = json_decode(file_get_contents(TEST_STATICS . '/drafter/json/index.json'));
$this->class = new HtmlGenerator();
$this->reflection = new ReflectionClass('PHPDraft\Parse\HtmlGenerator');

$this->mock_function('microtime', function () { return 'sometime'; });
$this->class->init($data);

$this->class->sorting = -1;
Expand All @@ -53,7 +51,6 @@ public function setUp(): void
*/
public function tearDown(): void
{
$this->unmock_function('microtime');
uopz_undefine('ID_STATIC');
unset($this->class);
unset($this->reflection);
Expand All @@ -74,38 +71,17 @@ public function testSetupCorrectly(): void
*/
public function testGetHTML(): void
{
$old = THIRD_PARTY_ALLOWED;
$this->constant_redefine('THIRD_PARTY_ALLOWED', true);
$this->expectOutputString(file_get_contents(TEST_STATICS . '/drafter/html/basic.html'));
$this->class->get_html();
$this->constant_redefine('THIRD_PARTY_ALLOWED', $old);
}

/**
* Tests if the constructor sets the property correctly
*/
public function testGetHTMLInheritance(): void
{
$this->markTestSkipped('Not testing.');
$old = THIRD_PARTY_ALLOWED;
$this->constant_redefine('THIRD_PARTY_ALLOWED', true);
$class = new HtmlGenerator();
$class->init(json_decode(file_get_contents(TEST_STATICS . '/drafter/json/inheritance.json')));
$this->expectOutputString(file_get_contents(TEST_STATICS . '/drafter/html/inheritance.html'));
$class->get_html();
$this->constant_redefine('THIRD_PARTY_ALLOWED', $old);
}

/**
* Tests if the constructor sets the property correctly
*/
public function testGetHTMLMaterial(): void
{
$old = THIRD_PARTY_ALLOWED;
$this->constant_redefine('THIRD_PARTY_ALLOWED', true);
$this->expectOutputString(file_get_contents(TEST_STATICS . '/drafter/html/material.html'));
$this->class->get_html('material');
$this->constant_redefine('THIRD_PARTY_ALLOWED', $old);
}

/**
Expand Down
Loading

0 comments on commit d06fe67

Please sign in to comment.