mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
fix another one
This commit is contained in:
parent
3951fd59b3
commit
a29400722f
@ -88,18 +88,7 @@ class AppController extends Controller
|
|||||||
// load current balance
|
// load current balance
|
||||||
$session = $this->getRequest()->getSession();
|
$session = $this->getRequest()->getSession();
|
||||||
$state_user_id = $session->read('StateUser.id');
|
$state_user_id = $session->read('StateUser.id');
|
||||||
if ($state_user_id) {
|
|
||||||
$stateBalancesTable = TableRegistry::getTableLocator()->get('stateBalances');
|
|
||||||
$stateBalanceQuery = $stateBalancesTable
|
|
||||||
->find('all')
|
|
||||||
->contain(false)
|
|
||||||
->where(['state_user_id' => $state_user_id]);
|
|
||||||
if ($stateBalanceQuery->count() == 1) {
|
|
||||||
//var_dump($stateBalanceEntry->first());
|
|
||||||
$session->write('StateUser.balance', $stateBalanceQuery->first()->decay);
|
|
||||||
//echo "stateUser.balance: " . $session->read('StateUser.balance');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// load error count
|
// load error count
|
||||||
if ($state_user_id) {
|
if ($state_user_id) {
|
||||||
@ -111,8 +100,6 @@ class AppController extends Controller
|
|||||||
->where(['state_user_id' => $state_user_id]);
|
->where(['state_user_id' => $state_user_id]);
|
||||||
$session->write('StateUser.errorCount', $stateErrorQuery->count());
|
$session->write('StateUser.errorCount', $stateErrorQuery->count());
|
||||||
}
|
}
|
||||||
//echo "initialize";
|
|
||||||
|
|
||||||
|
|
||||||
// put current page into global for navi
|
// put current page into global for navi
|
||||||
$GLOBALS["passed"] = null;
|
$GLOBALS["passed"] = null;
|
||||||
|
|||||||
45
community_server/tests/Fixture/Migrations2Fixture.php
Normal file
45
community_server/tests/Fixture/Migrations2Fixture.php
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Test\Fixture;
|
||||||
|
|
||||||
|
use Cake\TestSuite\Fixture\TestFixture;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MigrationsFixture
|
||||||
|
*/
|
||||||
|
class Migrations2Fixture extends TestFixture
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Fields
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
// @codingStandardsIgnoreStart
|
||||||
|
public $fields = [
|
||||||
|
'id' => ['type' => 'integer', 'length' => 10, 'unsigned' => true, 'null' => false, 'default' => null, 'comment' => '', 'autoIncrement' => true, 'precision' => null],
|
||||||
|
'db_version' => ['type' => 'integer', 'length' => 11, 'unsigned' => false, 'null' => true, 'default' => '0', 'comment' => '', 'precision' => null, 'autoIncrement' => null],
|
||||||
|
'_constraints' => [
|
||||||
|
'primary' => ['type' => 'primary', 'columns' => ['id'], 'length' => []],
|
||||||
|
],
|
||||||
|
'_options' => [
|
||||||
|
'engine' => 'InnoDB',
|
||||||
|
'collation' => 'utf8mb4_unicode_ci'
|
||||||
|
],
|
||||||
|
];
|
||||||
|
// @codingStandardsIgnoreEnd
|
||||||
|
/**
|
||||||
|
* Init method
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function init()
|
||||||
|
{
|
||||||
|
$this->table = "migrations";
|
||||||
|
$this->records = [
|
||||||
|
[
|
||||||
|
'id' => 1,
|
||||||
|
'db_version' => 2,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
parent::init();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,46 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace App\Test\TestCase\Controller;
|
|
||||||
|
|
||||||
use App\Controller\AppController;
|
|
||||||
use Cake\TestSuite\IntegrationTestTrait;
|
|
||||||
use Cake\TestSuite\TestCase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* App\Controller\DashboardController Test Case
|
|
||||||
*
|
|
||||||
* @uses \App\Controller\DashboardController
|
|
||||||
*/
|
|
||||||
class AppControllerTest extends TestCase
|
|
||||||
{
|
|
||||||
use IntegrationTestTrait;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fixtures
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
public $fixtures = [
|
|
||||||
'app.StateBalances'
|
|
||||||
];
|
|
||||||
|
|
||||||
public function setUp()
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test initialize method
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testInitialize()
|
|
||||||
{
|
|
||||||
$this->session(['StateUser.id' => 1]);
|
|
||||||
$this->get('/');
|
|
||||||
$this->assertSession(1200, 'StateUser.balance');
|
|
||||||
//$this->markTestIncomplete('Not implemented yet.');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -51,19 +51,7 @@ class JsonRequestClientComponentTest extends TestCase
|
|||||||
$this->markTestIncomplete('Not implemented yet.');
|
$this->markTestIncomplete('Not implemented yet.');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test getLoginServerUrl method
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testGetLoginServerUrl()
|
|
||||||
{
|
|
||||||
//$this->markTestIncomplete('Not implemented yet.');
|
|
||||||
$serverUrl = $this->JsonRequestClientComponent->getLoginServerUrl();
|
|
||||||
$this->assertEquals($serverUrl, 'http://***REMOVED***');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test is_base64 method
|
* Test is_base64 method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
|||||||
@ -27,6 +27,10 @@ use Cake\View\Exception\MissingTemplateException;
|
|||||||
*/
|
*/
|
||||||
class PagesControllerTest extends IntegrationTestCase
|
class PagesControllerTest extends IntegrationTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public $fixtures = [
|
||||||
|
'app.Migrations2'
|
||||||
|
];
|
||||||
/**
|
/**
|
||||||
* testMultipleGet method
|
* testMultipleGet method
|
||||||
*
|
*
|
||||||
@ -35,9 +39,12 @@ class PagesControllerTest extends IntegrationTestCase
|
|||||||
public function testMultipleGet()
|
public function testMultipleGet()
|
||||||
{
|
{
|
||||||
$this->get('/');
|
$this->get('/');
|
||||||
$this->assertRedirect('account/');
|
$locations = $this->_response->getHeader('Location');
|
||||||
|
$this->assertRegExp('%.*/account/$%', $locations[0]);
|
||||||
|
|
||||||
$this->get('/');
|
$this->get('/');
|
||||||
$this->assertRedirect('account/');
|
$locations = $this->_response->getHeader('Location');
|
||||||
|
$this->assertRegExp('%.*/account/$%', $locations[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -64,7 +71,7 @@ class PagesControllerTest extends IntegrationTestCase
|
|||||||
$this->get('/pages/not_existing');
|
$this->get('/pages/not_existing');
|
||||||
|
|
||||||
$this->assertResponseError();
|
$this->assertResponseError();
|
||||||
$this->assertResponseContains('Error');
|
$this->assertResponseContains('Not Found');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -78,8 +85,7 @@ class PagesControllerTest extends IntegrationTestCase
|
|||||||
$this->get('/pages/not_existing');
|
$this->get('/pages/not_existing');
|
||||||
|
|
||||||
$this->assertResponseFailure();
|
$this->assertResponseFailure();
|
||||||
$this->assertResponseContains('Missing Template');
|
$this->assertResponseContains('Template file \u0022Pages\/not_existing.ctp\u0022 is missing.');
|
||||||
$this->assertResponseContains('Stacktrace');
|
|
||||||
$this->assertResponseContains('not_existing.ctp');
|
$this->assertResponseContains('not_existing.ctp');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user