Skip to content

Commit

Permalink
Make tests still work on PHP 7
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominick Johnson committed Apr 12, 2024
1 parent e202d34 commit 79bcc19
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tests/EngineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public function testResolveAsTemplate(){
)
);

$this->assertInstanceOf('DMJohnson\Contemplate\Template\Template', $this->engine->resolve('template', class:Template::class));
$this->assertInstanceOf('DMJohnson\Contemplate\Template\Template', $this->engine->resolve('template', null, Template::class));
}

public function testGetTemplatePath()
Expand Down
23 changes: 22 additions & 1 deletion tests/Template/ControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,27 @@ public function testCallDoesNotLeakVariables()
$this->assertSame([], $this->controller->call());
}

public function testAddData()
{
$this->controller->addData(array('name' => 'Jonathan'));
$data = $this->controller->getEngine()->getData();
$this->assertSame('Jonathan', $data['name']);
}

public function testAddDataAssociated()
{
$this->controller->addDataAssociated(array('name' => 'Jonathan'));
$data = $this->controller->getEngine()->getData('controller');
$this->assertSame('Jonathan', $data['name']);
}

public function testAddDataWithTemplate()
{
$this->controller->addData(array('name' => 'Jonathan'), 'template');
$data = $this->controller->getEngine()->getData('template');
$this->assertSame('Jonathan', $data['name']);
}

public function testDelegate()
{
vfsStream::create(
Expand Down Expand Up @@ -124,7 +145,7 @@ public function testDelegateAssociatedWithType()
)
);

$this->assertSame('Delegate to the delegate', $this->controller->delegateAssociated(type:Resolvable::TYPE_CONTROLLER_GET));
$this->assertSame('Delegate to the delegate', $this->controller->delegateAssociated([], Resolvable::TYPE_CONTROLLER_GET));
}

public function testDelegateWithParams()
Expand Down
2 changes: 1 addition & 1 deletion tests/Template/ResolvableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,6 @@ public function testImportAssociated()
)
);

$this->assertSame('Hello World', $this->resolvable->importAssociated(type:Resolvable::TYPE_CONTROLLER_GET));
$this->assertSame('Hello World', $this->resolvable->importAssociated([], Resolvable::TYPE_CONTROLLER_GET));
}
}

0 comments on commit 79bcc19

Please sign in to comment.