test fixes - dont bother with auth in the plugin tests thats the app responsible
This commit is contained in:
parent
74f95a2f91
commit
a39001d174
|
@ -1,10 +1,11 @@
|
|||
/composer.lock
|
||||
/composer.phar
|
||||
/phpunit.xml
|
||||
/.phpunit.result.cache
|
||||
/.phpunit.cache
|
||||
/phpunit.phar
|
||||
/config/Migrations/schema-dump-default.lock
|
||||
/vendor/
|
||||
/.idea/
|
||||
config/app_local.php
|
||||
composer.lock
|
||||
composer.phar
|
||||
phpunit.xml
|
||||
.phpunit.result.cache
|
||||
.phpunit.cache
|
||||
phpunit.phar
|
||||
config/Migrations/schema-dump-default.lock
|
||||
vendor/
|
||||
.idea/
|
||||
config/app_local.php
|
||||
tmp
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/CakeAccounting.iml" filepath="$PROJECT_DIR$/.idea/CakeAccounting.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
"name": "hi-powered-dev/cake-accounting",
|
||||
"description": "CakeAccounting plugin for CakePHP",
|
||||
"description": "A CakePHP plugin for double entry accounting/bookkeeping",
|
||||
"type": "cakephp-plugin",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"cakephp"
|
||||
],
|
||||
|
@ -15,11 +15,14 @@
|
|||
],
|
||||
"require": {
|
||||
"php": ">=8.1",
|
||||
"dereuromark/cakephp-tools": "^3.9",
|
||||
"hi-powered-dev/cheese-cake": "dev-prod",
|
||||
"cakephp/cakephp": "^5.0.1",
|
||||
"ext-bcmath" : "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^10.1"
|
||||
"phpunit/phpunit": "^10.1",
|
||||
"cakephp/migrations": "^4.0.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
@ -29,7 +32,8 @@
|
|||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"CakeAccounting\\Test\\": "tests/",
|
||||
"Cake\\Test\\": "vendor/cakephp/cakephp/tests/"
|
||||
"Cake\\Test\\": "vendor/cakephp/cakephp/tests/",
|
||||
"TestApp\\": "tests/test_app/src/"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -6,6 +6,7 @@ namespace CakeAccounting\Test\TestCase\Controller;
|
|||
use Cake\ORM\Table;
|
||||
use CakeAccounting\Controller\DeAccountStatementsController;
|
||||
use CakeAccounting\Model\Table\DeAccountStatementsTable;
|
||||
use CakeAccounting\Model\Table\DeExternalAccountsTable;
|
||||
use PHPUnit\Exception;
|
||||
|
||||
/**
|
||||
|
@ -37,7 +38,11 @@ class DeAccountStatementsControllerTest extends BaseControllerTest
|
|||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->DeAccountStatements = $this->getTableLocator()->get('DeAccountStatements');
|
||||
// $this->enableCsrfToken();
|
||||
// $this->enableSecurityToken();
|
||||
$this->disableErrorHandlerMiddleware();
|
||||
$config = $this->getTableLocator()->exists('DeAccountStatements') ? [] : ['className' => DeAccountStatementsTable::class];
|
||||
$this->DeAccountStatements = $this->getTableLocator()->get('DeAccountStatements', $config);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -52,28 +57,6 @@ class DeAccountStatementsControllerTest extends BaseControllerTest
|
|||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test index method
|
||||
*
|
||||
* Tests the index action with an unauthenticated user (not logged in)
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*
|
||||
* @uses DeAccountStatementsController::index
|
||||
*/
|
||||
public function testIndexGetUnauthenticated(): void
|
||||
{
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeAccountStatements',
|
||||
'action' => 'index',
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(302);
|
||||
$this->assertRedirectContains('login');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test index method
|
||||
*
|
||||
|
@ -86,7 +69,7 @@ class DeAccountStatementsControllerTest extends BaseControllerTest
|
|||
*/
|
||||
public function testIndexGetLoggedIn(): void
|
||||
{
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeAccountStatements',
|
||||
|
@ -96,30 +79,6 @@ class DeAccountStatementsControllerTest extends BaseControllerTest
|
|||
$this->assertResponseCode(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test view method
|
||||
*
|
||||
* Tests the view action with an unauthenticated user (not logged in)
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*
|
||||
* @uses DeAccountStatementsController::view
|
||||
*/
|
||||
public function testViewGetUnauthenticated(): void
|
||||
{
|
||||
$id = '4614401e-fe0c-45cf-9f17-c45c7848960e';
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeAccountStatements',
|
||||
'action' => 'view',
|
||||
$id,
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(302);
|
||||
$this->assertRedirectContains('login');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test view method
|
||||
*
|
||||
|
@ -133,7 +92,7 @@ class DeAccountStatementsControllerTest extends BaseControllerTest
|
|||
public function testViewGetLoggedIn(): void
|
||||
{
|
||||
$id = '4614401e-fe0c-45cf-9f17-c45c7848960e';
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeAccountStatements',
|
||||
|
|
|
@ -49,11 +49,18 @@ class DeAccountTemplatesControllerTest extends BaseControllerTest
|
|||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->DeAccountTemplates = $this->getTableLocator()->get('DeAccountTemplates');
|
||||
$this->DeAccounts = $this->getTableLocator()->get('DeAccounts');
|
||||
$this->DeTemplatedAccounts = $this->getTableLocator()->get('DeTemplatedAccounts');
|
||||
$this->enableCsrfToken();
|
||||
$this->enableSecurityToken();
|
||||
// $this->enableCsrfToken();
|
||||
// $this->enableSecurityToken();
|
||||
$this->disableErrorHandlerMiddleware();
|
||||
|
||||
$configDeAccountTemplates = $this->getTableLocator()->exists('DeAccountTemplates') ? [] : ['className' => DeAccountTemplatesTable::class];
|
||||
$this->DeAccountTemplates = $this->getTableLocator()->get('DeAccountTemplates', $configDeAccountTemplates);
|
||||
|
||||
$configDeAccounts = $this->getTableLocator()->exists('DeAccounts') ? [] : ['className' => DeAccountsTable::class];
|
||||
$this->DeAccounts = $this->getTableLocator()->get('DeAccounts', $configDeAccounts);
|
||||
|
||||
$configDeTemplatedAccounts = $this->getTableLocator()->exists('DeTemplatedAccounts') ? [] : ['className' => DeTemplatedAccountsTable::class];
|
||||
$this->DeTemplatedAccounts = $this->getTableLocator()->get('DeTemplatedAccounts', $configDeTemplatedAccounts);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -68,28 +75,6 @@ class DeAccountTemplatesControllerTest extends BaseControllerTest
|
|||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test index method
|
||||
*
|
||||
* Tests the index action with an unauthenticated user (not logged in)
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*
|
||||
* @uses DeAccountTemplatesController::index
|
||||
*/
|
||||
public function testIndexGetUnauthenticated(): void
|
||||
{
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeAccountTemplates',
|
||||
'action' => 'index',
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(302);
|
||||
$this->assertRedirectContains('login');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test index method
|
||||
*
|
||||
|
@ -102,7 +87,7 @@ class DeAccountTemplatesControllerTest extends BaseControllerTest
|
|||
*/
|
||||
public function testIndexGetLoggedIn(): void
|
||||
{
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeAccountTemplates',
|
||||
|
@ -112,30 +97,6 @@ class DeAccountTemplatesControllerTest extends BaseControllerTest
|
|||
$this->assertResponseCode(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test view method
|
||||
*
|
||||
* Tests the view action with an unauthenticated user (not logged in)
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*
|
||||
* @uses DeAccountTemplatesController::view
|
||||
*/
|
||||
public function testViewGetUnauthenticated(): void
|
||||
{
|
||||
$id = 1;
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeAccountTemplates',
|
||||
'action' => 'view',
|
||||
$id,
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(302);
|
||||
$this->assertRedirectContains('login');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test view method
|
||||
*
|
||||
|
@ -149,7 +110,7 @@ class DeAccountTemplatesControllerTest extends BaseControllerTest
|
|||
public function testViewGetLoggedIn(): void
|
||||
{
|
||||
$id = 1;
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeAccountTemplates',
|
||||
|
@ -160,33 +121,6 @@ class DeAccountTemplatesControllerTest extends BaseControllerTest
|
|||
$this->assertResponseCode(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test select method
|
||||
*
|
||||
* Tests the select method which should import templated accounts as real accounts
|
||||
*
|
||||
* @throws Exception
|
||||
* @return void
|
||||
*
|
||||
* @uses DeAccountTemplatesController::select
|
||||
*/
|
||||
public function testSelectPostUnauthenticated(): void
|
||||
{
|
||||
$cntBefore = $this->DeAccounts->find()->count();
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeAccountTemplates',
|
||||
'action' => 'select',
|
||||
1,
|
||||
];
|
||||
$this->post($url);
|
||||
$this->assertResponseCode(302);
|
||||
$this->assertRedirectContains('login');
|
||||
|
||||
$cntAfter = $this->DeAccounts->find()->count();
|
||||
$this->assertEquals($cntBefore, $cntAfter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test select method
|
||||
*
|
||||
|
@ -214,7 +148,7 @@ class DeAccountTemplatesControllerTest extends BaseControllerTest
|
|||
'action' => 'select',
|
||||
1,
|
||||
];
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$this->post($url);
|
||||
$this->assertResponseCode(302);
|
||||
$this->assertRedirectContains('de-accounts');
|
||||
|
@ -237,7 +171,7 @@ class DeAccountTemplatesControllerTest extends BaseControllerTest
|
|||
{
|
||||
$cntBefore = $this->DeAccountTemplates->find()->count();
|
||||
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeAccountTemplates',
|
||||
|
@ -264,7 +198,7 @@ class DeAccountTemplatesControllerTest extends BaseControllerTest
|
|||
{
|
||||
$cntBefore = $this->DeAccountTemplates->find()->count();
|
||||
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeAccountTemplates',
|
||||
|
@ -295,7 +229,7 @@ class DeAccountTemplatesControllerTest extends BaseControllerTest
|
|||
{
|
||||
$cntBefore = $this->DeAccountTemplates->find()->count();
|
||||
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeAccountTemplates',
|
||||
|
@ -311,29 +245,6 @@ class DeAccountTemplatesControllerTest extends BaseControllerTest
|
|||
$this->assertEquals($cntBefore, $cntAfter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test edit method
|
||||
*
|
||||
* Tests the edit action with an unauthenticated user (not logged in)
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*
|
||||
* @uses DeAccountTemplatesController::edit
|
||||
*/
|
||||
public function testEditGetUnauthenticated(): void
|
||||
{
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeAccountTemplates',
|
||||
'action' => 'edit',
|
||||
1,
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(302);
|
||||
$this->assertRedirectContains('login');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test edit method
|
||||
*
|
||||
|
@ -346,7 +257,7 @@ class DeAccountTemplatesControllerTest extends BaseControllerTest
|
|||
*/
|
||||
public function testEditGetLoggedIn(): void
|
||||
{
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeAccountTemplates',
|
||||
|
@ -369,7 +280,7 @@ class DeAccountTemplatesControllerTest extends BaseControllerTest
|
|||
*/
|
||||
public function testEditPutLoggedInSuccess(): void
|
||||
{
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$id = 1;
|
||||
$before = $this->DeAccountTemplates->get($id);
|
||||
$url = [
|
||||
|
@ -404,7 +315,7 @@ class DeAccountTemplatesControllerTest extends BaseControllerTest
|
|||
*/
|
||||
public function testEditPutLoggedInFailure(): void
|
||||
{
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$id = 1;
|
||||
$before = $this->DeAccountTemplates->get($id);
|
||||
$url = [
|
||||
|
@ -423,34 +334,6 @@ class DeAccountTemplatesControllerTest extends BaseControllerTest
|
|||
// assert save failed below
|
||||
}
|
||||
|
||||
/**
|
||||
* Test delete method
|
||||
*
|
||||
* Tests the delete action with an unauthenticated user (not logged in)
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*
|
||||
* @uses DeAccountTemplatesController::delete
|
||||
*/
|
||||
public function testDeleteUnauthenticated(): void
|
||||
{
|
||||
$cntBefore = $this->DeAccountTemplates->find()->count();
|
||||
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeAccountTemplates',
|
||||
'action' => 'delete',
|
||||
1,
|
||||
];
|
||||
$this->delete($url);
|
||||
$this->assertResponseCode(302);
|
||||
$this->assertRedirectContains('login');
|
||||
|
||||
$cntAfter = $this->DeAccountTemplates->find()->count();
|
||||
$this->assertEquals($cntBefore, $cntAfter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test delete method
|
||||
*
|
||||
|
@ -465,7 +348,7 @@ class DeAccountTemplatesControllerTest extends BaseControllerTest
|
|||
{
|
||||
$cntBefore = $this->DeAccountTemplates->find()->count();
|
||||
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeAccountTemplates',
|
||||
|
|
|
@ -38,9 +38,11 @@ class DeAccountsControllerTest extends BaseControllerTest
|
|||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->DeAccounts = $this->getTableLocator()->get('DeAccounts');
|
||||
$this->enableCsrfToken();
|
||||
$this->enableSecurityToken();
|
||||
// $this->enableCsrfToken();
|
||||
// $this->enableSecurityToken();
|
||||
$this->disableErrorHandlerMiddleware();
|
||||
$config = $this->getTableLocator()->exists('DeAccounts') ? [] : ['className' => DeAccountsTable::class];
|
||||
$this->DeAccounts = $this->getTableLocator()->get('DeAccounts', $config);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -55,28 +57,6 @@ class DeAccountsControllerTest extends BaseControllerTest
|
|||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test index method
|
||||
*
|
||||
* Tests the index action with an unauthenticated user (not logged in)
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*
|
||||
* @uses DeAccountsController::index
|
||||
*/
|
||||
public function testIndexGetUnauthenticated(): void
|
||||
{
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeAccounts',
|
||||
'action' => 'index',
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(302);
|
||||
$this->assertRedirectContains('login');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test index method
|
||||
*
|
||||
|
@ -89,7 +69,7 @@ class DeAccountsControllerTest extends BaseControllerTest
|
|||
*/
|
||||
public function testIndexGetLoggedIn(): void
|
||||
{
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeAccounts',
|
||||
|
@ -99,30 +79,6 @@ class DeAccountsControllerTest extends BaseControllerTest
|
|||
$this->assertResponseCode(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test view method
|
||||
*
|
||||
* Tests the view action with an unauthenticated user (not logged in)
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*
|
||||
* @uses DeAccountsController::view
|
||||
*/
|
||||
public function testViewGetUnauthenticated(): void
|
||||
{
|
||||
$id = 41200;
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeAccounts',
|
||||
'action' => 'view',
|
||||
$id,
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(302);
|
||||
$this->assertRedirectContains('login');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test view method
|
||||
*
|
||||
|
@ -136,7 +92,7 @@ class DeAccountsControllerTest extends BaseControllerTest
|
|||
public function testViewGetLoggedIn(): void
|
||||
{
|
||||
$id = 41200;
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeAccounts',
|
||||
|
@ -147,32 +103,6 @@ class DeAccountsControllerTest extends BaseControllerTest
|
|||
$this->assertResponseCode(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test add method
|
||||
*
|
||||
* Tests the add action with an unauthenticated user (not logged in)
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*
|
||||
* @uses DeAccountsController::add
|
||||
*/
|
||||
public function testAddGetUnauthenticated(): void
|
||||
{
|
||||
$cntBefore = $this->DeAccounts->find()->count();
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeAccounts',
|
||||
'action' => 'add',
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(302);
|
||||
$this->assertRedirectContains('login');
|
||||
|
||||
$cntAfter = $this->DeAccounts->find()->count();
|
||||
$this->assertEquals($cntBefore, $cntAfter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test add method
|
||||
*
|
||||
|
@ -187,7 +117,7 @@ class DeAccountsControllerTest extends BaseControllerTest
|
|||
{
|
||||
$cntBefore = $this->DeAccounts->find()->count();
|
||||
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeAccounts',
|
||||
|
@ -214,7 +144,7 @@ class DeAccountsControllerTest extends BaseControllerTest
|
|||
{
|
||||
$cntBefore = $this->DeAccounts->find()->count();
|
||||
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeAccounts',
|
||||
|
@ -252,7 +182,7 @@ class DeAccountsControllerTest extends BaseControllerTest
|
|||
{
|
||||
$cntBefore = $this->DeAccounts->find()->count();
|
||||
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeAccounts',
|
||||
|
@ -266,29 +196,6 @@ class DeAccountsControllerTest extends BaseControllerTest
|
|||
$this->assertEquals($cntBefore, $cntAfter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test edit method
|
||||
*
|
||||
* Tests the edit action with an unauthenticated user (not logged in)
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*
|
||||
* @uses DeAccountsController::edit
|
||||
*/
|
||||
public function testEditGetUnauthenticated(): void
|
||||
{
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeAccounts',
|
||||
'action' => 'edit',
|
||||
41200,
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(302);
|
||||
$this->assertRedirectContains('login');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test edit method
|
||||
*
|
||||
|
@ -301,7 +208,7 @@ class DeAccountsControllerTest extends BaseControllerTest
|
|||
*/
|
||||
public function testEditGetLoggedIn(): void
|
||||
{
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeAccounts',
|
||||
|
@ -324,7 +231,7 @@ class DeAccountsControllerTest extends BaseControllerTest
|
|||
*/
|
||||
public function testEditPutLoggedInSuccess(): void
|
||||
{
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$id = 41200;
|
||||
$before = $this->DeAccounts->find()->where(['account_number' => $id])->firstOrFail();
|
||||
$url = [
|
||||
|
@ -365,7 +272,7 @@ class DeAccountsControllerTest extends BaseControllerTest
|
|||
*/
|
||||
public function testEditPutLoggedInFailure(): void
|
||||
{
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$id = 41200;
|
||||
$before = $this->DeAccounts->find()->where(['account_number' => $id])->firstOrFail();
|
||||
$url = [
|
||||
|
@ -388,34 +295,6 @@ class DeAccountsControllerTest extends BaseControllerTest
|
|||
// assert save failed below
|
||||
}
|
||||
|
||||
/**
|
||||
* Test delete method
|
||||
*
|
||||
* Tests the delete action with an unauthenticated user (not logged in)
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*
|
||||
* @uses DeAccountsController::delete
|
||||
*/
|
||||
public function testDeleteUnauthenticated(): void
|
||||
{
|
||||
$cntBefore = $this->DeAccounts->find()->count();
|
||||
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeAccounts',
|
||||
'action' => 'delete',
|
||||
41200,
|
||||
];
|
||||
$this->delete($url);
|
||||
$this->assertResponseCode(302);
|
||||
$this->assertRedirectContains('login');
|
||||
|
||||
$cntAfter = $this->DeAccounts->find()->count();
|
||||
$this->assertEquals($cntBefore, $cntAfter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test delete method
|
||||
*
|
||||
|
@ -430,7 +309,7 @@ class DeAccountsControllerTest extends BaseControllerTest
|
|||
{
|
||||
$cntBefore = $this->DeAccounts->find()->count();
|
||||
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeAccounts',
|
||||
|
|
|
@ -8,6 +8,7 @@ use Cake\TestSuite\IntegrationTestTrait;
|
|||
use Cake\TestSuite\TestCase;
|
||||
use CakeAccounting\Controller\DeExternalAccountStatementsController;
|
||||
use CakeAccounting\Model\Table\DeExternalAccountStatementsTable;
|
||||
use CakeAccounting\Model\Table\DeJournalEntriesTable;
|
||||
use PHPUnit\Exception;
|
||||
|
||||
/**
|
||||
|
@ -38,7 +39,11 @@ class DeExternalAccountStatementsControllerTest extends BaseControllerTest
|
|||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->DeExternalAccountStatements = $this->getTableLocator()->get('DeExternalAccountStatements');
|
||||
// $this->enableCsrfToken();
|
||||
// $this->enableSecurityToken();
|
||||
$this->disableErrorHandlerMiddleware();
|
||||
$config = $this->getTableLocator()->exists('DeExternalAccountStatements') ? [] : ['className' => DeExternalAccountStatementsTable::class];
|
||||
$this->DeExternalAccountStatements = $this->getTableLocator()->get('DeExternalAccountStatements', $config);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -53,28 +58,6 @@ class DeExternalAccountStatementsControllerTest extends BaseControllerTest
|
|||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test index method
|
||||
*
|
||||
* Tests the index action with an unauthenticated user (not logged in)
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*
|
||||
* @uses DeExternalAccountStatementsController::index
|
||||
*/
|
||||
public function testIndexGetUnauthenticated(): void
|
||||
{
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeExternalAccountStatements',
|
||||
'action' => 'index',
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(302);
|
||||
$this->assertRedirectContains('login');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test index method
|
||||
*
|
||||
|
@ -87,7 +70,7 @@ class DeExternalAccountStatementsControllerTest extends BaseControllerTest
|
|||
*/
|
||||
public function testIndexGetLoggedIn(): void
|
||||
{
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeExternalAccountStatements',
|
||||
|
@ -97,30 +80,6 @@ class DeExternalAccountStatementsControllerTest extends BaseControllerTest
|
|||
$this->assertResponseCode(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test view method
|
||||
*
|
||||
* Tests the view action with an unauthenticated user (not logged in)
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*
|
||||
* @uses DeExternalAccountStatementsController::view
|
||||
*/
|
||||
public function testViewGetUnauthenticated(): void
|
||||
{
|
||||
$id = '2f83162b-2bec-4826-8853-fbda2fac3a95';
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeExternalAccountStatements',
|
||||
'action' => 'view',
|
||||
$id,
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(302);
|
||||
$this->assertRedirectContains('login');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test view method
|
||||
*
|
||||
|
@ -134,7 +93,7 @@ class DeExternalAccountStatementsControllerTest extends BaseControllerTest
|
|||
public function testViewGetLoggedIn(): void
|
||||
{
|
||||
$id = '2f83162b-2bec-4826-8853-fbda2fac3a95';
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeExternalAccountStatements',
|
||||
|
|
|
@ -4,8 +4,6 @@ declare(strict_types=1);
|
|||
namespace CakeAccounting\Test\TestCase\Controller;
|
||||
|
||||
use Cake\ORM\Table;
|
||||
use Cake\TestSuite\IntegrationTestTrait;
|
||||
use Cake\TestSuite\TestCase;
|
||||
use CakeAccounting\Controller\DeExternalAccountsController;
|
||||
use CakeAccounting\Model\Table\DeExternalAccountsTable;
|
||||
use PHPUnit\Exception;
|
||||
|
@ -39,9 +37,11 @@ class DeExternalAccountsControllerTest extends BaseControllerTest
|
|||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->DeExternalAccounts = $this->getTableLocator()->get('DeExternalAccounts');
|
||||
$this->enableCsrfToken();
|
||||
$this->enableSecurityToken();
|
||||
// $this->enableCsrfToken();
|
||||
// $this->enableSecurityToken();
|
||||
$this->disableErrorHandlerMiddleware();
|
||||
$config = $this->getTableLocator()->exists('DeExternalAccounts') ? [] : ['className' => DeExternalAccountsTable::class];
|
||||
$this->DeExternalAccounts = $this->getTableLocator()->get('DeExternalAccounts', $config);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -56,28 +56,6 @@ class DeExternalAccountsControllerTest extends BaseControllerTest
|
|||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test index method
|
||||
*
|
||||
* Tests the index action with an unauthenticated user (not logged in)
|
||||
*
|
||||
* @uses \CakeAccounting\Controller\DeExternalAccountsController::index()
|
||||
* @throws Exception
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testIndexGetUnauthenticated(): void
|
||||
{
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeExternalAccounts',
|
||||
'action' => 'index',
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(302);
|
||||
$this->assertRedirectContains('login');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test index method
|
||||
*
|
||||
|
@ -90,7 +68,7 @@ class DeExternalAccountsControllerTest extends BaseControllerTest
|
|||
*/
|
||||
public function testIndexGetLoggedIn(): void
|
||||
{
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeExternalAccounts',
|
||||
|
@ -100,30 +78,6 @@ class DeExternalAccountsControllerTest extends BaseControllerTest
|
|||
$this->assertResponseCode(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test view method
|
||||
*
|
||||
* Tests the view action with an unauthenticated user (not logged in)
|
||||
*
|
||||
* @uses \CakeAccounting\Controller\DeExternalAccountsController::view()
|
||||
* @throws Exception
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testViewGetUnauthenticated(): void
|
||||
{
|
||||
$id = '2463dc4f-6f38-4492-8c8e-918f11e13748';
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeExternalAccounts',
|
||||
'action' => 'view',
|
||||
$id,
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(302);
|
||||
$this->assertRedirectContains('login');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test view method
|
||||
*
|
||||
|
@ -137,7 +91,7 @@ class DeExternalAccountsControllerTest extends BaseControllerTest
|
|||
public function testViewGetLoggedIn(): void
|
||||
{
|
||||
$id = '2463dc4f-6f38-4492-8c8e-918f11e13748';
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeExternalAccounts',
|
||||
|
@ -148,32 +102,6 @@ class DeExternalAccountsControllerTest extends BaseControllerTest
|
|||
$this->assertResponseCode(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test add method
|
||||
*
|
||||
* Tests the add action with an unauthenticated user (not logged in)
|
||||
*
|
||||
* @uses \CakeAccounting\Controller\DeExternalAccountsController::add()
|
||||
* @throws Exception
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testAddGetUnauthenticated(): void
|
||||
{
|
||||
$cntBefore = $this->DeExternalAccounts->find()->count();
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeExternalAccounts',
|
||||
'action' => 'add',
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(302);
|
||||
$this->assertRedirectContains('login');
|
||||
|
||||
$cntAfter = $this->DeExternalAccounts->find()->count();
|
||||
$this->assertEquals($cntBefore, $cntAfter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test add method
|
||||
*
|
||||
|
@ -188,7 +116,7 @@ class DeExternalAccountsControllerTest extends BaseControllerTest
|
|||
{
|
||||
$cntBefore = $this->DeExternalAccounts->find()->count();
|
||||
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeExternalAccounts',
|
||||
|
@ -215,7 +143,7 @@ class DeExternalAccountsControllerTest extends BaseControllerTest
|
|||
{
|
||||
$cntBefore = $this->DeExternalAccounts->find()->count();
|
||||
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeExternalAccounts',
|
||||
|
@ -248,7 +176,7 @@ class DeExternalAccountsControllerTest extends BaseControllerTest
|
|||
{
|
||||
$cntBefore = $this->DeExternalAccounts->find()->count();
|
||||
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeExternalAccounts',
|
||||
|
@ -262,31 +190,6 @@ class DeExternalAccountsControllerTest extends BaseControllerTest
|
|||
$this->assertEquals($cntBefore, $cntAfter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test edit method
|
||||
*
|
||||
* Tests the edit action with an unauthenticated user (not logged in)
|
||||
*
|
||||
* @uses \CakeAccounting\Controller\DeExternalAccountsController::edit()
|
||||
* @throws Exception
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testEditGetUnauthenticated(): void
|
||||
{
|
||||
$id = '2463dc4f-6f38-4492-8c8e-918f11e13748';
|
||||
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeExternalAccounts',
|
||||
'action' => 'edit',
|
||||
$id,
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(302);
|
||||
$this->assertRedirectContains('login');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test edit method
|
||||
*
|
||||
|
@ -301,7 +204,7 @@ class DeExternalAccountsControllerTest extends BaseControllerTest
|
|||
{
|
||||
$id = '2463dc4f-6f38-4492-8c8e-918f11e13748';
|
||||
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeExternalAccounts',
|
||||
|
@ -324,7 +227,7 @@ class DeExternalAccountsControllerTest extends BaseControllerTest
|
|||
*/
|
||||
public function testEditPutLoggedInSuccess(): void
|
||||
{
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$id = '2463dc4f-6f38-4492-8c8e-918f11e13748';
|
||||
$before = $this->DeExternalAccounts->get($id);
|
||||
$url = [
|
||||
|
@ -359,7 +262,7 @@ class DeExternalAccountsControllerTest extends BaseControllerTest
|
|||
*/
|
||||
public function testEditPutLoggedInFailure(): void
|
||||
{
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$id = '2463dc4f-6f38-4492-8c8e-918f11e13748';
|
||||
$before = $this->DeExternalAccounts->get($id);
|
||||
$url = [
|
||||
|
@ -378,35 +281,6 @@ class DeExternalAccountsControllerTest extends BaseControllerTest
|
|||
// assert save failed below
|
||||
}
|
||||
|
||||
/**
|
||||
* Test delete method
|
||||
*
|
||||
* Tests the delete action with an unauthenticated user (not logged in)
|
||||
*
|
||||
* @uses \CakeAccounting\Controller\DeExternalAccountsController::delete()
|
||||
* @throws Exception
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testDeleteUnauthenticated(): void
|
||||
{
|
||||
$cntBefore = $this->DeExternalAccounts->find()->count();
|
||||
$id = '2463dc4f-6f38-4492-8c8e-918f11e13748';
|
||||
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeExternalAccounts',
|
||||
'action' => 'delete',
|
||||
$id,
|
||||
];
|
||||
$this->delete($url);
|
||||
$this->assertResponseCode(302);
|
||||
$this->assertRedirectContains('login');
|
||||
|
||||
$cntAfter = $this->DeExternalAccounts->find()->count();
|
||||
$this->assertEquals($cntBefore, $cntAfter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test delete method
|
||||
*
|
||||
|
@ -422,7 +296,7 @@ class DeExternalAccountsControllerTest extends BaseControllerTest
|
|||
$cntBefore = $this->DeExternalAccounts->find()->count();
|
||||
$id = '2463dc4f-6f38-4492-8c8e-918f11e13748';
|
||||
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeExternalAccounts',
|
||||
|
|
|
@ -40,9 +40,11 @@ class DeJournalEntriesControllerTest extends BaseControllerTest
|
|||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->DeJournalEntries = $this->getTableLocator()->get('DeJournalEntries');
|
||||
$this->enableCsrfToken();
|
||||
$this->enableSecurityToken();
|
||||
// $this->enableCsrfToken();
|
||||
// $this->enableSecurityToken();
|
||||
$this->disableErrorHandlerMiddleware();
|
||||
$config = $this->getTableLocator()->exists('DeJournalEntries') ? [] : ['className' => DeJournalEntriesTable::class];
|
||||
$this->DeJournalEntries = $this->getTableLocator()->get('DeJournalEntries', $config);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -57,28 +59,6 @@ class DeJournalEntriesControllerTest extends BaseControllerTest
|
|||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test index method
|
||||
*
|
||||
* Tests the index action with an unauthenticated user (not logged in)
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*
|
||||
* @uses DeJournalEntriesController::index
|
||||
*/
|
||||
public function testIndexGetUnauthenticated(): void
|
||||
{
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeJournalEntries',
|
||||
'action' => 'index',
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(302);
|
||||
$this->assertRedirectContains('login');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test index method
|
||||
*
|
||||
|
@ -91,7 +71,7 @@ class DeJournalEntriesControllerTest extends BaseControllerTest
|
|||
*/
|
||||
public function testIndexGetLoggedIn(): void
|
||||
{
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeJournalEntries',
|
||||
|
@ -101,30 +81,6 @@ class DeJournalEntriesControllerTest extends BaseControllerTest
|
|||
$this->assertResponseCode(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test view method
|
||||
*
|
||||
* Tests the view action with an unauthenticated user (not logged in)
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*
|
||||
* @uses DeJournalEntriesController::view
|
||||
*/
|
||||
public function testViewGetUnauthenticated(): void
|
||||
{
|
||||
$id = 1;
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeJournalEntries',
|
||||
'action' => 'view',
|
||||
$id,
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(302);
|
||||
$this->assertRedirectContains('login');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test view method
|
||||
*
|
||||
|
@ -138,7 +94,7 @@ class DeJournalEntriesControllerTest extends BaseControllerTest
|
|||
public function testViewGetLoggedIn(): void
|
||||
{
|
||||
$id = 1;
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeJournalEntries',
|
||||
|
@ -149,32 +105,6 @@ class DeJournalEntriesControllerTest extends BaseControllerTest
|
|||
$this->assertResponseCode(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test add method
|
||||
*
|
||||
* Tests the add action with an unauthenticated user (not logged in)
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*
|
||||
* @uses DeJournalEntriesController::add
|
||||
*/
|
||||
public function testAddGetUnauthenticated(): void
|
||||
{
|
||||
$cntBefore = $this->DeJournalEntries->find()->count();
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeJournalEntries',
|
||||
'action' => 'add',
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(302);
|
||||
$this->assertRedirectContains('login');
|
||||
|
||||
$cntAfter = $this->DeJournalEntries->find()->count();
|
||||
$this->assertEquals($cntBefore, $cntAfter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test add method
|
||||
*
|
||||
|
@ -189,7 +119,7 @@ class DeJournalEntriesControllerTest extends BaseControllerTest
|
|||
{
|
||||
$cntBefore = $this->DeJournalEntries->find()->count();
|
||||
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeJournalEntries',
|
||||
|
@ -216,7 +146,7 @@ class DeJournalEntriesControllerTest extends BaseControllerTest
|
|||
{
|
||||
$cntBefore = $this->DeJournalEntries->find()->count();
|
||||
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeJournalEntries',
|
||||
|
@ -257,7 +187,7 @@ class DeJournalEntriesControllerTest extends BaseControllerTest
|
|||
{
|
||||
$cntBefore = $this->DeJournalEntries->find()->count();
|
||||
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeJournalEntries',
|
||||
|
|
|
@ -7,6 +7,7 @@ use Cake\ORM\Table;
|
|||
use CakeAccounting\Controller\DeJournalItemsController;
|
||||
use CakeAccounting\Model\Table\DeAccountsTable;
|
||||
use CakeAccounting\Model\Table\DeJournalItemsTable;
|
||||
use CakeAccounting\Model\Table\DeJournalsTable;
|
||||
use PHPUnit\Exception;
|
||||
|
||||
/**
|
||||
|
@ -45,8 +46,14 @@ class DeJournalItemsControllerTest extends BaseControllerTest
|
|||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->DeJournalItems = $this->getTableLocator()->get('DeJournalItems');
|
||||
$this->DeAccounts = $this->getTableLocator()->get('DeAccounts');
|
||||
// $this->enableCsrfToken();
|
||||
// $this->enableSecurityToken();
|
||||
$this->disableErrorHandlerMiddleware();
|
||||
$config = $this->getTableLocator()->exists('DeAccounts') ? [] : ['className' => DeAccountsTable::class];
|
||||
$this->DeAccounts = $this->getTableLocator()->get('DeAccounts', $config);
|
||||
|
||||
$config = $this->getTableLocator()->exists('DeJournalItems') ? [] : ['className' => DeJournalItemsTable::class];
|
||||
$this->DeJournalItems = $this->getTableLocator()->get('DeJournalItems', $config);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -61,28 +68,6 @@ class DeJournalItemsControllerTest extends BaseControllerTest
|
|||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test index method
|
||||
*
|
||||
* Tests the index action with an unauthenticated user (not logged in)
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*
|
||||
* @uses DeJournalItemsController::index
|
||||
*/
|
||||
public function testIndexGetUnauthenticated(): void
|
||||
{
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeJournalItems',
|
||||
'action' => 'index',
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(302);
|
||||
$this->assertRedirectContains('login');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test index method
|
||||
*
|
||||
|
@ -95,7 +80,7 @@ class DeJournalItemsControllerTest extends BaseControllerTest
|
|||
*/
|
||||
public function testIndexGetLoggedIn(): void
|
||||
{
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeJournalItems',
|
||||
|
@ -105,30 +90,6 @@ class DeJournalItemsControllerTest extends BaseControllerTest
|
|||
$this->assertResponseCode(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test view method
|
||||
*
|
||||
* Tests the view action with an unauthenticated user (not logged in)
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*
|
||||
* @uses DeJournalItemsController::view
|
||||
*/
|
||||
public function testViewGetUnauthenticated(): void
|
||||
{
|
||||
$id = 1;
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeJournalItems',
|
||||
'action' => 'view',
|
||||
$id,
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(302);
|
||||
$this->assertRedirectContains('login');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test view method
|
||||
*
|
||||
|
@ -142,7 +103,7 @@ class DeJournalItemsControllerTest extends BaseControllerTest
|
|||
public function testViewGetLoggedIn(): void
|
||||
{
|
||||
$id = 1;
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeJournalItems',
|
||||
|
|
|
@ -42,9 +42,11 @@ class DeJournalsControllerTest extends BaseControllerTest
|
|||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->DeJournals = $this->getTableLocator()->get('DeJournals');
|
||||
$this->enableCsrfToken();
|
||||
$this->enableSecurityToken();
|
||||
// $this->enableCsrfToken();
|
||||
// $this->enableSecurityToken();
|
||||
$this->disableErrorHandlerMiddleware();
|
||||
$config = $this->getTableLocator()->exists('DeJournals') ? [] : ['className' => DeJournalsTable::class];
|
||||
$this->DeJournals = $this->getTableLocator()->get('DeJournals', $config);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -59,28 +61,6 @@ class DeJournalsControllerTest extends BaseControllerTest
|
|||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test index method
|
||||
*
|
||||
* Tests the index action with an unauthenticated user (not logged in)
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*
|
||||
* @uses DeJournalsController::index
|
||||
*/
|
||||
public function testIndexGetUnauthenticated(): void
|
||||
{
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeJournals',
|
||||
'action' => 'index',
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(302);
|
||||
$this->assertRedirectContains('login');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test index method
|
||||
*
|
||||
|
@ -93,7 +73,7 @@ class DeJournalsControllerTest extends BaseControllerTest
|
|||
*/
|
||||
public function testIndexGetLoggedIn(): void
|
||||
{
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeJournals',
|
||||
|
@ -103,30 +83,6 @@ class DeJournalsControllerTest extends BaseControllerTest
|
|||
$this->assertResponseCode(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test view method
|
||||
*
|
||||
* Tests the view action with an unauthenticated user (not logged in)
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*
|
||||
* @uses DeJournalsController::view
|
||||
*/
|
||||
public function testViewGetUnauthenticated(): void
|
||||
{
|
||||
$id = 1;
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeJournals',
|
||||
'action' => 'view',
|
||||
$id,
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(302);
|
||||
$this->assertRedirectContains('login');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test view method
|
||||
*
|
||||
|
@ -140,7 +96,7 @@ class DeJournalsControllerTest extends BaseControllerTest
|
|||
public function testViewGetLoggedIn(): void
|
||||
{
|
||||
$id = 1;
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeJournals',
|
||||
|
@ -151,32 +107,6 @@ class DeJournalsControllerTest extends BaseControllerTest
|
|||
$this->assertResponseCode(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test add method
|
||||
*
|
||||
* Tests the add action with an unauthenticated user (not logged in)
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*
|
||||
* @uses DeJournalsController::add
|
||||
*/
|
||||
public function testAddGetUnauthenticated(): void
|
||||
{
|
||||
$cntBefore = $this->DeJournals->find()->count();
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeJournals',
|
||||
'action' => 'add',
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(302);
|
||||
$this->assertRedirectContains('login');
|
||||
|
||||
$cntAfter = $this->DeJournals->find()->count();
|
||||
$this->assertEquals($cntBefore, $cntAfter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test add method
|
||||
*
|
||||
|
@ -191,7 +121,7 @@ class DeJournalsControllerTest extends BaseControllerTest
|
|||
{
|
||||
$cntBefore = $this->DeJournals->find()->count();
|
||||
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeJournals',
|
||||
|
@ -218,7 +148,7 @@ class DeJournalsControllerTest extends BaseControllerTest
|
|||
{
|
||||
$cntBefore = $this->DeJournals->find()->count();
|
||||
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeJournals',
|
||||
|
@ -253,7 +183,7 @@ class DeJournalsControllerTest extends BaseControllerTest
|
|||
{
|
||||
$cntBefore = $this->DeJournals->find()->count();
|
||||
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeJournals',
|
||||
|
@ -273,29 +203,6 @@ class DeJournalsControllerTest extends BaseControllerTest
|
|||
$this->assertEquals($cntBefore, $cntAfter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test edit method
|
||||
*
|
||||
* Tests the edit action with an unauthenticated user (not logged in)
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*
|
||||
* @uses DeJournalsController::edit
|
||||
*/
|
||||
public function testEditGetUnauthenticated(): void
|
||||
{
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeJournals',
|
||||
'action' => 'edit',
|
||||
1,
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(302);
|
||||
$this->assertRedirectContains('login');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test edit method
|
||||
*
|
||||
|
@ -308,7 +215,7 @@ class DeJournalsControllerTest extends BaseControllerTest
|
|||
*/
|
||||
public function testEditGetLoggedIn(): void
|
||||
{
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeJournals',
|
||||
|
@ -331,7 +238,7 @@ class DeJournalsControllerTest extends BaseControllerTest
|
|||
*/
|
||||
public function testEditPutLoggedInSuccess(): void
|
||||
{
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$id = 1;
|
||||
$before = $this->DeJournals->get($id);
|
||||
$url = [
|
||||
|
@ -364,7 +271,7 @@ class DeJournalsControllerTest extends BaseControllerTest
|
|||
*/
|
||||
public function testEditPutLoggedInFailure(): void
|
||||
{
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$id = 1;
|
||||
$before = $this->DeJournals->get($id);
|
||||
$url = [
|
||||
|
@ -393,34 +300,6 @@ class DeJournalsControllerTest extends BaseControllerTest
|
|||
$this->assertEquals($before->de_journal_type_code, $after->de_journal_type_code);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test delete method
|
||||
*
|
||||
* Tests the delete action with an unauthenticated user (not logged in)
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*
|
||||
* @uses DeJournalsController::delete
|
||||
*/
|
||||
public function testDeleteUnauthenticated(): void
|
||||
{
|
||||
$cntBefore = $this->DeJournals->find()->count();
|
||||
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeJournals',
|
||||
'action' => 'delete',
|
||||
1,
|
||||
];
|
||||
$this->delete($url);
|
||||
$this->assertResponseCode(302);
|
||||
$this->assertRedirectContains('login');
|
||||
|
||||
$cntAfter = $this->DeJournals->find()->count();
|
||||
$this->assertEquals($cntBefore, $cntAfter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test delete method
|
||||
*
|
||||
|
@ -435,7 +314,7 @@ class DeJournalsControllerTest extends BaseControllerTest
|
|||
{
|
||||
$cntBefore = $this->DeJournals->find()->count();
|
||||
|
||||
$this->loginUserByRole('admin');
|
||||
//$this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'plugin' => 'CakeAccounting',
|
||||
'controller' => 'DeJournals',
|
||||
|
|
|
@ -1,43 +1,108 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Test suite bootstrap for CakeAccounting.
|
||||
*
|
||||
* This function is used to find the location of CakePHP whether CakePHP
|
||||
* has been installed as a dependency of the plugin, or the plugin is itself
|
||||
* installed as a dependency of an application.
|
||||
*/
|
||||
$findRoot = function ($root) {
|
||||
do {
|
||||
$lastRoot = $root;
|
||||
$root = dirname($root);
|
||||
if (is_dir($root . '/vendor/cakephp/cakephp')) {
|
||||
return $root;
|
||||
}
|
||||
} while ($root !== $lastRoot);
|
||||
use Cake\Cache\Cache;
|
||||
use Cake\Chronos\Chronos;
|
||||
use Cake\Core\Configure;
|
||||
use Cake\Core\Plugin;
|
||||
use Cake\Database\Connection;
|
||||
use Cake\Datasource\ConnectionManager;
|
||||
use Cake\TestSuite\Fixture\SchemaLoader;
|
||||
use CakeAccounting\CakeAccountingPlugin;
|
||||
use Migrations\TestSuite\Migrator;
|
||||
use TestApp\Controller\AppController;
|
||||
|
||||
throw new Exception('Cannot find the root of the application, unable to run tests');
|
||||
};
|
||||
$root = $findRoot(__FILE__);
|
||||
unset($findRoot);
|
||||
|
||||
chdir($root);
|
||||
|
||||
require_once $root . '/vendor/autoload.php';
|
||||
|
||||
/**
|
||||
* Define fallback values for required constants and configuration.
|
||||
* To customize constants and configuration remove this require
|
||||
* and define the data required by your plugin here.
|
||||
*/
|
||||
require_once $root . '/vendor/cakephp/cakephp/tests/bootstrap.php';
|
||||
|
||||
if (file_exists($root . '/config/bootstrap.php')) {
|
||||
require $root . '/config/bootstrap.php';
|
||||
|
||||
return;
|
||||
if (!defined('DS')) {
|
||||
define('DS', DIRECTORY_SEPARATOR);
|
||||
}
|
||||
if (!defined('WINDOWS')) {
|
||||
if (DS === '\\' || substr(PHP_OS, 0, 3) === 'WIN') {
|
||||
define('WINDOWS', true);
|
||||
} else {
|
||||
define('WINDOWS', false);
|
||||
}
|
||||
}
|
||||
|
||||
define('PLUGIN_ROOT', dirname(__DIR__));
|
||||
define('ROOT', PLUGIN_ROOT . DS . 'tests' . DS . 'test_app');
|
||||
define('TMP', PLUGIN_ROOT . DS . 'tmp' . DS);
|
||||
define('LOGS', TMP . 'logs' . DS);
|
||||
define('CACHE', TMP . 'cache' . DS);
|
||||
define('APP', ROOT . DS . 'src' . DS);
|
||||
define('APP_DIR', 'src');
|
||||
define('CAKE_CORE_INCLUDE_PATH', PLUGIN_ROOT . '/vendor/cakephp/cakephp');
|
||||
define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);
|
||||
define('CAKE', CORE_PATH . APP_DIR . DS);
|
||||
|
||||
define('WWW_ROOT', PLUGIN_ROOT . DS . 'webroot' . DS);
|
||||
define('TESTS', __DIR__ . DS);
|
||||
define('CONFIG', TESTS . 'config' . DS);
|
||||
|
||||
ini_set('intl.default_locale', 'de-DE');
|
||||
|
||||
require PLUGIN_ROOT . '/vendor/autoload.php';
|
||||
require CORE_PATH . 'config/bootstrap.php';
|
||||
require CAKE . 'functions.php';
|
||||
|
||||
Configure::write('App', [
|
||||
'namespace' => 'TestApp',
|
||||
'encoding' => 'UTF-8',
|
||||
'paths' => [
|
||||
'templates' => [
|
||||
PLUGIN_ROOT . DS . 'tests' . DS . 'test_app' . DS . 'templates' . DS,
|
||||
],
|
||||
],
|
||||
]);
|
||||
|
||||
Configure::write('debug', true);
|
||||
|
||||
$cache = [
|
||||
'default' => [
|
||||
'engine' => 'File',
|
||||
'path' => CACHE,
|
||||
],
|
||||
'_cake_core_' => [
|
||||
'className' => 'File',
|
||||
'prefix' => 'crud_myapp_cake_core_',
|
||||
'path' => CACHE . 'persistent/',
|
||||
'serialize' => true,
|
||||
'duration' => '+10 seconds',
|
||||
],
|
||||
'_cake_translations_' => [
|
||||
'className' => 'File',
|
||||
'prefix' => 'crud_myapp_cake_core_',
|
||||
'path' => CACHE . 'persistent/',
|
||||
'serialize' => true,
|
||||
'duration' => '+10 seconds',
|
||||
],
|
||||
'_cake_model_' => [
|
||||
'className' => 'File',
|
||||
'prefix' => 'crud_my_app_cake_model_',
|
||||
'path' => CACHE . 'models/',
|
||||
'serialize' => 'File',
|
||||
'duration' => '+10 seconds',
|
||||
],
|
||||
];
|
||||
|
||||
Cache::setConfig($cache);
|
||||
|
||||
class_alias(AppController::class, 'App\Controller\AppController');
|
||||
|
||||
Plugin::getCollection()->add(new CakeAccountingPlugin());
|
||||
|
||||
Chronos::setTestNow(Chronos::now());
|
||||
|
||||
if (!getenv('DB_URL')) {
|
||||
putenv('DB_URL=sqlite:///:memory:');
|
||||
}
|
||||
|
||||
ConnectionManager::setConfig('test', [
|
||||
'className' => Connection::class,
|
||||
'url' => getenv('DB_URL') ?: null,
|
||||
'timezone' => 'UTC',
|
||||
'quoteIdentifiers' => false,
|
||||
'cacheMetadata' => true,
|
||||
]);
|
||||
|
||||
/**
|
||||
* Load schema from a SQL dump file.
|
||||
|
@ -49,12 +114,9 @@ if (file_exists($root . '/config/bootstrap.php')) {
|
|||
* using migrations to provide schema for your plugin,
|
||||
* and using \Migrations\TestSuite\Migrator to load schema.
|
||||
*/
|
||||
$migrator = new Migrator();
|
||||
// Load a schema dump file.
|
||||
//(new SchemaLoader())->loadSqlFiles('tests/schema.sql', 'test');
|
||||
|
||||
// Run migrations for more than one plugin
|
||||
$migrator->runMany([
|
||||
// Run app migrations on test connection.
|
||||
['connection' => 'test'],
|
||||
// Run plugin migrations on test connection.
|
||||
['plugin' => 'CakeAccounting'],
|
||||
]);
|
||||
|
||||
$migrator = new Migrator();
|
||||
$migrator->run(['plugin' => 'CakeAccounting']);
|
|
@ -0,0 +1 @@
|
|||
<?php
|
|
@ -0,0 +1 @@
|
|||
<?php
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
namespace TestApp;
|
||||
|
||||
use Cake\Http\BaseApplication;
|
||||
use Cake\Http\MiddlewareQueue;
|
||||
use Cake\Routing\Middleware\RoutingMiddleware;
|
||||
use Cake\Routing\Route\DashedRoute;
|
||||
use Cake\Routing\RouteBuilder;
|
||||
|
||||
class Application extends BaseApplication {
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function bootstrap(): void {
|
||||
$this->addPlugin('CakeAccounting');
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function middleware(MiddlewareQueue $middleware): MiddlewareQueue {
|
||||
$middleware->add(new RoutingMiddleware($this));
|
||||
|
||||
return $middleware;
|
||||
}
|
||||
|
||||
public function routes(RouteBuilder $routes): void
|
||||
{
|
||||
parent::routes($routes); // TODO: Change the autogenerated stub
|
||||
$routes->setRouteClass(DashedRoute::class);
|
||||
|
||||
$routes->plugin('CakeAccounting', ['path' => '/cake-accounting'], function (RouteBuilder $pluginRoutes):void {
|
||||
$pluginRoutes->fallbacks();
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
namespace TestApp\Controller;
|
||||
|
||||
use Cake\Controller\Controller;
|
||||
|
||||
class AppController extends Controller {
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function initialize(): void {
|
||||
parent::initialize();
|
||||
|
||||
$this->loadComponent('Flash');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace TestApp\View;
|
||||
|
||||
use Cake\View\View;
|
||||
|
||||
/**
|
||||
* @property \TinyAuth\View\Helper\AuthUserHelper $AuthUser
|
||||
*/
|
||||
class AppView extends View {
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
use Cake\Core\Configure;
|
||||
use Cake\Error\Debugger;
|
||||
|
||||
$this->layout = 'error';
|
||||
|
||||
if (Configure::read('debug')):
|
||||
$this->layout = 'dev_error';
|
||||
|
||||
$this->assign('title', $message);
|
||||
$this->assign('templateName', 'error500.ctp');
|
||||
|
||||
$this->start('file');
|
||||
?>
|
||||
<?php if (!empty($error->queryString)) : ?>
|
||||
<p class="notice">
|
||||
<strong>SQL Query: </strong>
|
||||
<?= h($error->queryString) ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($error->params)) : ?>
|
||||
<strong>SQL Query Params: </strong>
|
||||
<?php Debugger::dump($error->params) ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($error instanceof Error) : ?>
|
||||
<strong>Error in: </strong>
|
||||
<?= sprintf('%s, line %s', str_replace(ROOT, 'ROOT', $error->getFile()), $error->getLine()) ?>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
echo $this->element('auto_table_warning');
|
||||
|
||||
if (extension_loaded('xdebug')):
|
||||
xdebug_print_function_stack();
|
||||
endif;
|
||||
|
||||
$this->end();
|
||||
endif;
|
||||
?>
|
||||
<h2><?= __d('cake', 'An Internal Error Has Occurred') ?></h2>
|
||||
<p class="error">
|
||||
<strong><?= __d('cake', 'Error') ?>: </strong>
|
||||
<?= h($message) ?>
|
||||
</p>
|
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* @var \App\View\AppView $this
|
||||
*/
|
||||
?>
|
||||
<?= $this->fetch('content') ?>
|
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* @var \App\View\AppView $this
|
||||
*/
|
||||
?>
|
||||
<?= $this->fetch('content') ?>
|
Loading…
Reference in New Issue