actions gitea and github + more tests
This commit is contained in:
@@ -44,7 +44,7 @@ class AddressesControllerTest extends BaseControllerTest
|
||||
{
|
||||
parent::setUp();
|
||||
$this->Addresses = $this->getTableLocator()->get('CakeAddresses.Addresses');
|
||||
$this->enableCsrfToken();
|
||||
// $this->enableCsrfToken();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -69,31 +69,8 @@ class AddressesControllerTest extends BaseControllerTest
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testIndexGetUnauthenticated(): void
|
||||
public function testIndexGet(): void
|
||||
{
|
||||
$url = [
|
||||
'plugin' => 'CakeAddresses',
|
||||
'controller' => 'Addresses',
|
||||
'action' => 'index',
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(302);
|
||||
$this->assertRedirectContains('login');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test index method
|
||||
*
|
||||
* Tests the index action with a logged in user
|
||||
*
|
||||
* @uses \CakeAddresses\Controller\AddressesController::index()
|
||||
* @throws Exception
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testIndexGetLoggedIn(): void
|
||||
{
|
||||
$this->loginUserByRole();
|
||||
$url = [
|
||||
'plugin' => 'CakeAddresses',
|
||||
'controller' => 'Addresses',
|
||||
@@ -113,7 +90,7 @@ class AddressesControllerTest extends BaseControllerTest
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testViewGetUnauthenticated(): void
|
||||
public function testViewGet(): void
|
||||
{
|
||||
$id = 1;
|
||||
$url = [
|
||||
@@ -123,31 +100,6 @@ class AddressesControllerTest extends BaseControllerTest
|
||||
$id,
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(302);
|
||||
$this->assertRedirectContains('login');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test view method
|
||||
*
|
||||
* Tests the view action with a logged in user
|
||||
*
|
||||
* @uses \CakeAddresses\Controller\AddressesController::view()
|
||||
* @throws Exception
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testViewGetLoggedIn(): void
|
||||
{
|
||||
$id = 1;
|
||||
$this->loginUserByRole();
|
||||
$url = [
|
||||
'plugin' => 'CakeAddresses',
|
||||
'controller' => 'Addresses',
|
||||
'action' => 'view',
|
||||
$id,
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(200);
|
||||
}
|
||||
|
||||
@@ -161,7 +113,7 @@ class AddressesControllerTest extends BaseControllerTest
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testAddGetUnauthenticated(): void
|
||||
public function testAddGet(): void
|
||||
{
|
||||
$cntBefore = $this->Addresses->find()->count();
|
||||
$url = [
|
||||
@@ -170,34 +122,6 @@ class AddressesControllerTest extends BaseControllerTest
|
||||
'action' => 'add',
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(302);
|
||||
$this->assertRedirectContains('login');
|
||||
|
||||
$cntAfter = $this->Addresses->find()->count();
|
||||
$this->assertEquals($cntBefore, $cntAfter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test add method
|
||||
*
|
||||
* Tests the add action with a logged in user
|
||||
*
|
||||
* @uses \CakeAddresses\Controller\AddressesController::add()
|
||||
* @throws Exception
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testAddGetLoggedIn(): void
|
||||
{
|
||||
$cntBefore = $this->Addresses->find()->count();
|
||||
|
||||
$this->loginUserByRole();
|
||||
$url = [
|
||||
'plugin' => 'CakeAddresses',
|
||||
'controller' => 'Addresses',
|
||||
'action' => 'add',
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(200);
|
||||
|
||||
$cntAfter = $this->Addresses->find()->count();
|
||||
@@ -214,7 +138,7 @@ class AddressesControllerTest extends BaseControllerTest
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testAddPostLoggedInSuccess(): void
|
||||
public function testAddPostSuccess(): void
|
||||
{
|
||||
$cntBefore = $this->Addresses->find()->count();
|
||||
|
||||
@@ -256,7 +180,7 @@ class AddressesControllerTest extends BaseControllerTest
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testAddPostLoggedInFailure(): void
|
||||
public function testAddPostFailure(): void
|
||||
{
|
||||
$cntBefore = $this->Addresses->find()->count();
|
||||
|
||||
@@ -297,7 +221,7 @@ class AddressesControllerTest extends BaseControllerTest
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testEditGetUnauthenticated(): void
|
||||
public function testEditGet(): void
|
||||
{
|
||||
$id = 1;
|
||||
$url = [
|
||||
@@ -307,31 +231,6 @@ class AddressesControllerTest extends BaseControllerTest
|
||||
$id,
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(302);
|
||||
$this->assertRedirectContains('login');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test edit method
|
||||
*
|
||||
* Tests the edit action with a logged in user
|
||||
*
|
||||
* @uses \CakeAddresses\Controller\AddressesController::edit()
|
||||
* @throws Exception
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testEditGetLoggedIn(): void
|
||||
{
|
||||
$id = 1;
|
||||
$this->loginUserByRole();
|
||||
$url = [
|
||||
'plugin' => 'CakeAddresses',
|
||||
'controller' => 'Addresses',
|
||||
'action' => 'edit',
|
||||
$id,
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(200);
|
||||
}
|
||||
|
||||
@@ -345,7 +244,7 @@ class AddressesControllerTest extends BaseControllerTest
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testEditPutLoggedInSuccess(): void
|
||||
public function testEditPutSuccess(): void
|
||||
{
|
||||
$this->loginUserByRole();
|
||||
$id = 1;
|
||||
@@ -390,9 +289,8 @@ class AddressesControllerTest extends BaseControllerTest
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testEditPutLoggedInFailure(): void
|
||||
public function testEditPutFailure(): void
|
||||
{
|
||||
$this->loginUserByRole();
|
||||
$id = 1;
|
||||
$before = $this->Addresses->get($id);
|
||||
$url = [
|
||||
@@ -432,7 +330,7 @@ class AddressesControllerTest extends BaseControllerTest
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testDeleteUnauthenticated(): void
|
||||
public function testDelete(): void
|
||||
{
|
||||
$cntBefore = $this->Addresses->find()->count();
|
||||
|
||||
@@ -444,36 +342,6 @@ class AddressesControllerTest extends BaseControllerTest
|
||||
];
|
||||
$this->delete($url);
|
||||
$this->assertResponseCode(302);
|
||||
$this->assertRedirectContains('login');
|
||||
|
||||
$cntAfter = $this->Addresses->find()->count();
|
||||
$this->assertEquals($cntBefore, $cntAfter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test delete method
|
||||
*
|
||||
* Tests the delete action with a logged in user
|
||||
*
|
||||
* @uses \CakeAddresses\Controller\AddressesController::delete()
|
||||
* @throws Exception
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testDeleteLoggedIn(): void
|
||||
{
|
||||
$cntBefore = $this->Addresses->find()->count();
|
||||
|
||||
$this->loginUserByRole();
|
||||
$url = [
|
||||
'plugin' => 'CakeAddresses',
|
||||
'controller' => 'Addresses',
|
||||
'action' => 'delete',
|
||||
1,
|
||||
];
|
||||
$this->delete($url);
|
||||
$this->assertResponseCode(302);
|
||||
$this->assertRedirectContains('addresses');
|
||||
|
||||
$cntAfter = $this->Addresses->find()->count();
|
||||
$this->assertEquals($cntBefore - 1, $cntAfter);
|
||||
|
||||
Reference in New Issue
Block a user