diff --git a/Test/Case/View/Helper/FormShimHelperTest.php b/Test/Case/View/Helper/FormShimHelperTest.php new file mode 100644 index 0000000..cb89e0f --- /dev/null +++ b/Test/Case/View/Helper/FormShimHelperTest.php @@ -0,0 +1,31 @@ +Form = new FormShimHelper(new View(null)); + + parent::setUp(); + } + + /** + * @return void + */ + public function testEnd() { + $result = $this->Form->end(); + $this->assertSame('', $result); + } + + /** + * @expectedException PHPUNIT_FRAMEWORK_ERROR_DEPRECATED + * @return void + */ + public function testEndInvalid() { + $this->Form->end('Click me'); + } + +} diff --git a/docs/README.md b/docs/README.md index def083b..e9b3e20 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,32 +1,18 @@ ## Shim plugin Documentation ### Installation -usin composer and `composer require dereuromark/cakephp-shim:[version].*`: - -``` -"require": { - "dereuromark/cakephp-tools": "[version].*" -} -``` -This will install the plugin into APP/Vendor. - -Make sure you have `CakePlugin::load('Tools')` or `CakePlugin::loadAll()` in your bootstrap. - -If you want to leverage the defaults regarding query strings, use -``` -CakePlugin::load('Tools', ['bootstrap' => true]); -``` +See [Setup docs](SETUP.md). ### Basics To profit from the basics, you can extend the controller and model class and include the component. -``` +```php App::uses('ShimModel', 'Shim.Model'); class AppModel extends ShimModel { } ``` -``` +```php App::uses('ShimController', 'Shim.Controller'); class AppController extends ShimController { @@ -38,7 +24,7 @@ class AppController extends ShimController { For test cases you can extend the test case: -``` +```php App::uses('ShimTestCase', 'Shim.TestSuite'); class MyNameModelTest extends ShimTestCase { @@ -46,7 +32,7 @@ class MyNameModelTest extends ShimTestCase { ``` For controller tests you can extend the 3.x backport of IntegrationTestCase: -``` +```php App::uses('ShimIntegrationTestCase', 'Shim.TestSuite'); class MyNameControllerTest extends ShimIntegrationTestCase { @@ -57,6 +43,7 @@ class MyNameControllerTest extends ShimIntegrationTestCase { $this->get(['controller' => 'my_name', 'action' => 'index']); $this->assertResponseCode(200); $this->assertNoRedirect(); + $this->assertResponseContains('Some HTML snippet or text.'); } public function testAddPost() { @@ -73,6 +60,8 @@ class MyNameControllerTest extends ShimIntegrationTestCase { } ``` +This uses the same syntax as in 3.x then. When upgrading your 2.x app you will +not have to touch this much then. A real time saver when doing a lot of integration testing. ### Auth and Password Hashing See [Auth](Auth.md) diff --git a/docs/SETUP.md b/docs/SETUP.md index bd694bd..6b51601 100644 --- a/docs/SETUP.md +++ b/docs/SETUP.md @@ -5,14 +5,14 @@ Installing the Plugin is pretty much as with every other CakePHP Plugin. Install using Packagist/Composer: ``` -composer require dereuromark/cakephp-shim:dev-master +composer require dereuromark/cakephp-shim:0.1.* ``` or manually via ``` "require": { - "dereuromark/cakephp-shim": "dev-master" + "dereuromark/cakephp-shim": "0.1.*" } ``` and