Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Implement remaining tests for InputRegistry.

  • Loading branch information...
commit 64a932da51a25f394190e9ce6c69763e496e9c1b 1 parent 08920aa
@markstory markstory authored
Showing with 36 additions and 4 deletions.
  1. +36 −4 tests/TestCase/View/Input/InputRegistryTest.php
View
40 tests/TestCase/View/Input/InputRegistryTest.php
@@ -38,8 +38,26 @@ public function setUp() {
*
* @return void
*/
+ public function testAddInConstructor() {
+ $widgets = [
+ 'text' => ['Cake\View\Input\Text'],
+ ];
+ $inputs = new InputRegistry($this->templates, $widgets);
+ $result = $inputs->get('text');
+ $this->assertInstanceOf('Cake\View\Input\Text', $result);
+ }
+
+/**
+ * Test adding new widgets.
+ *
+ * @return void
+ */
public function testAdd() {
- $this->markTestIncomplete();
+ $inputs = new InputRegistry($this->templates);
+ $result = $inputs->add([
+ 'text' => ['Cake\View\Input\Text'],
+ ]);
+ $this->assertNull($result);
}
/**
@@ -48,7 +66,13 @@ public function testAdd() {
* @return void
*/
public function testGet() {
- $this->markTestIncomplete();
+ $inputs = new InputRegistry($this->templates);
+ $inputs->add([
+ 'text' => ['Cake\View\Input\Text'],
+ ]);
+ $result = $inputs->get('text');
+ $this->assertInstanceOf('Cake\View\Input\Text', $result);
+ $this->assertSame($result, $inputs->get('text'));
}
/**
@@ -57,7 +81,15 @@ public function testGet() {
* @return void
*/
public function testGetFallback() {
- $this->markTestIncomplete();
+ $inputs = new InputRegistry($this->templates);
+ $inputs->add([
+ '_default' => ['Cake\View\Input\Text'],
+ ]);
+ $result = $inputs->get('text');
+ $this->assertInstanceOf('Cake\View\Input\Text', $result);
+
+ $result2 = $inputs->get('hidden');
+ $this->assertSame($result, $result2);
}
/**
@@ -84,7 +116,7 @@ public function testGetResolveDependency() {
'multicheckbox' => ['Cake\View\Input\MultiCheckbox', 'label']
]);
$result = $inputs->get('multicheckbox');
- $this->assertInstanceOf('CakeView\Input\MultiCheckbox', $result);
+ $this->assertInstanceOf('Cake\View\Input\MultiCheckbox', $result);
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.