diff --git a/tests/TestCase/View/Input/InputRegistryTest.php b/tests/TestCase/View/Input/InputRegistryTest.php index e48625fdbc2..0f3bd2e4f11 100644 --- a/tests/TestCase/View/Input/InputRegistryTest.php +++ b/tests/TestCase/View/Input/InputRegistryTest.php @@ -33,13 +33,31 @@ public function setUp() { $this->templates = new StringTemplate(); } +/** + * Test adding new widgets. + * + * @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); } /**