Last active
December 17, 2015 08:38
-
-
Save gwoo/5580947 to your computer and use it in GitHub Desktop.
Revisions
-
gwoo revised this gist
May 15, 2013 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -40,7 +40,7 @@ public function testAdd() { $response = $Users($request, array('action' => 'add')); $expected = 201; $result = $response->status('code'); $this->assertEqual($expected, $result); $user = Users::first(); @@ -51,11 +51,12 @@ public function testAdd() { } public function testIndex() { $request = new Request(); $Users = new UsersController(compact('request')); $response = $Users($request, array('action' => 'index')); $expected = 400; $result = $response->status('code'); $this->assertEqual($expected, $result); } } -
gwoo renamed this gist
May 15, 2013 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
gwoo created this gist
May 15, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,63 @@ <?php namespace app\tests\cases\controllers; use app\controllers\UsersController; use app\models\Users; use lithium\action\Request; use lithium\data\Connections; class UsersControllerTest extends \lithium\test\Integration { private $_data = array( array( "name" => "Bob the Builder" ), array( "name" => "Frank the Tank" ), array( "name" => "Mack the Truck" ) ); public function skip() { $isAvailable = ( Connections::get('test', array('config' => true)) && Connections::get('test')->isConnected(array('autoConnect' => true)) ); $this->skipIf(!$isAvailable, "No test connection available."); } public function setUp() { Users::config(array('connection' => 'test')); Users::all()->delete(); } public function testAdd() { $request = new Request(array('data' => $this->_data[0])); $Users = new UsersController(compact('request')); $response = $Users($request, array('action' => 'add')); $expected = 201; $result = $response->status(); $this->assertEqual($expected, $result); $user = Users::first(); $expected = 'Bob the Builder'; $result = $user->name; $this->assertEqual($expected, $result); } public function testIndex() { $Users = new UsersController(compact('request')); $response = $Users($request, array('action' => 'index')); $expected = 400; $result = $response->status(); $this->assertEqual($expected, $result); } } ?>