Skip to content

Commit

Permalink
Introduce Bindable trait
Browse files Browse the repository at this point in the history
  • Loading branch information
g105b committed Dec 22, 2017
1 parent a41d545 commit 723d3ac
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Bindable.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php
namespace Gt\DomTemplate;

trait Bindable {
public function bind(iterable $data):void {

}
}
1 change: 1 addition & 0 deletions src/Element.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@

class Element extends BaseElement {
use TemplateParent;
use Bindable;
}
1 change: 1 addition & 0 deletions src/HTMLDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

class HTMLDocument extends BaseHTMLDocument {
use TemplateParent;
use Bindable;

protected $templateDirectory;

Expand Down
22 changes: 22 additions & 0 deletions test/unit/BindableTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
namespace Gt\DomTemplate\Test;

use Gt\DomTemplate\HTMLDocument;
use Gt\DomTemplate\Test\Helper\Helper;
use PHPUnit\Framework\TestCase;

class BindableTest extends TestCase {
public function testBindMethodAvailable() {
$document = new HTMLDocument(Helper::HTML_TEMPLATES);
$outputTo = $document->querySelector("dl");

self::assertTrue(
method_exists($document, "bind"),
"HTMLDocument is not bindable"
);
self::assertTrue(
method_exists($outputTo, "bind"),
"Template container element (dl) is not bindable"
);
}
}

0 comments on commit 723d3ac

Please sign in to comment.