Merge remote-tracking branch 'engelsystem/feature-igel-rewrite'
This commit is contained in:
commit
ec45216899
|
@ -64,7 +64,7 @@ function EventConfig_update(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (bool)DB::update('
|
return DB::update('
|
||||||
UPDATE `EventConfig` SET
|
UPDATE `EventConfig` SET
|
||||||
`event_name` = ?,
|
`event_name` = ?,
|
||||||
`buildup_start_date` = ?,
|
`buildup_start_date` = ?,
|
||||||
|
|
|
@ -9,12 +9,6 @@ namespace Engelsystem;
|
||||||
*/
|
*/
|
||||||
class ShiftsFilter
|
class ShiftsFilter
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* How long can the time interval be?
|
|
||||||
* 86400 = one day
|
|
||||||
*/
|
|
||||||
const MAX_DURATION = 86400;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shift is completely full.
|
* Shift is completely full.
|
||||||
*/
|
*/
|
||||||
|
@ -98,9 +92,6 @@ class ShiftsFilter
|
||||||
*/
|
*/
|
||||||
public function setEndTime($endTime)
|
public function setEndTime($endTime)
|
||||||
{
|
{
|
||||||
if ($endTime - $this->startTime > ShiftsFilter::MAX_DURATION) {
|
|
||||||
$endTime = $this->startTime + ShiftsFilter::MAX_DURATION;
|
|
||||||
}
|
|
||||||
$this->endTime = $endTime;
|
$this->endTime = $endTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -266,10 +266,6 @@ function Shift_signup_allowed_angel(
|
||||||
) {
|
) {
|
||||||
$free_entries = Shift_free_entries($needed_angeltype, $shift_entries);
|
$free_entries = Shift_free_entries($needed_angeltype, $shift_entries);
|
||||||
|
|
||||||
if ($user['Gekommen'] == 0) {
|
|
||||||
return new ShiftSignupState(ShiftSignupState::SHIFT_ENDED, $free_entries);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($user_shifts == null) {
|
if ($user_shifts == null) {
|
||||||
$user_shifts = Shifts_by_user($user);
|
$user_shifts = Shifts_by_user($user);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,8 @@
|
||||||
<whitelist>
|
<whitelist>
|
||||||
<directory>./include/</directory>
|
<directory>./include/</directory>
|
||||||
<directory>./public/</directory>
|
<directory>./public/</directory>
|
||||||
</whitelist>
|
<directory>./src/</directory>
|
||||||
|
</whitelist>
|
||||||
</filter>
|
</filter>
|
||||||
<php>
|
<php>
|
||||||
<const name="PHPUNIT_TESTSUITE" value="true"/>
|
<const name="PHPUNIT_TESTSUITE" value="true"/>
|
||||||
|
|
|
@ -81,31 +81,31 @@ class Db
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run a insert query
|
* Run an insert query
|
||||||
*
|
*
|
||||||
* @param string $query
|
* @param string $query
|
||||||
* @param array $bindings
|
* @param array $bindings
|
||||||
* @return bool
|
* @return int|bool
|
||||||
*/
|
*/
|
||||||
public static function insert($query, array $bindings = [])
|
public static function insert($query, array $bindings = [])
|
||||||
{
|
{
|
||||||
self::query($query, $bindings);
|
self::query($query, $bindings);
|
||||||
|
|
||||||
return self::$lastStatus;
|
return (self::$lastStatus ? self::$stm->rowCount() : false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run a update query
|
* Run an update query
|
||||||
*
|
*
|
||||||
* @param string $query
|
* @param string $query
|
||||||
* @param array $bindings
|
* @param array $bindings
|
||||||
* @return int|null
|
* @return int|bool
|
||||||
*/
|
*/
|
||||||
public static function update($query, array $bindings = [])
|
public static function update($query, array $bindings = [])
|
||||||
{
|
{
|
||||||
self::query($query, $bindings);
|
self::query($query, $bindings);
|
||||||
|
|
||||||
return (self::$lastStatus ? self::$stm->rowCount() : null);
|
return (self::$lastStatus ? self::$stm->rowCount() : false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -113,13 +113,13 @@ class Db
|
||||||
*
|
*
|
||||||
* @param string $query
|
* @param string $query
|
||||||
* @param array $bindings
|
* @param array $bindings
|
||||||
* @return int|null
|
* @return int|bool
|
||||||
*/
|
*/
|
||||||
public static function delete($query, array $bindings = [])
|
public static function delete($query, array $bindings = [])
|
||||||
{
|
{
|
||||||
self::query($query, $bindings);
|
self::query($query, $bindings);
|
||||||
|
|
||||||
return (self::$lastStatus ? self::$stm->rowCount() : null);
|
return (self::$lastStatus ? self::$stm->rowCount() : false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Engelsystem\Test;
|
namespace Engelsystem\Test;
|
||||||
|
|
||||||
class LogEntriesModelTest extends \PHPUnit_Framework_TestCase
|
use \PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
class LogEntriesModelTest extends TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
public function create_LogEntry()
|
public function create_LogEntry()
|
||||||
{
|
{
|
||||||
LogEntry_create('test', 'test');
|
LogEntry_create('test', 'test');
|
||||||
|
@ -13,7 +15,7 @@ class LogEntriesModelTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$count = count(LogEntries());
|
$count = count(LogEntries());
|
||||||
$this->assertNotFalse(LogEntry_create('test', 'test_LogEntry_create'));
|
$this->assertNotFalse(LogEntry_create('test', 'test_LogEntry_create'));
|
||||||
|
|
||||||
// There should be one more log entry now
|
// There should be one more log entry now
|
||||||
$this->assertEquals(count(LogEntries()), $count + 1);
|
$this->assertEquals(count(LogEntries()), $count + 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Engelsystem\Test;
|
namespace Engelsystem\Test;
|
||||||
|
|
||||||
class RoomModelTest extends \PHPUnit_Framework_TestCase
|
use \PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
class RoomModelTest extends TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
private $room_id = null;
|
private $room_id = null;
|
||||||
|
|
||||||
public function create_Room()
|
public function create_Room()
|
||||||
|
@ -14,14 +16,14 @@ class RoomModelTest extends \PHPUnit_Framework_TestCase
|
||||||
public function test_Room()
|
public function test_Room()
|
||||||
{
|
{
|
||||||
$this->create_Room();
|
$this->create_Room();
|
||||||
|
|
||||||
$room = Room($this->room_id);
|
$room = Room($this->room_id);
|
||||||
|
|
||||||
$this->assertNotFalse($room);
|
$this->assertNotFalse($room);
|
||||||
$this->assertNotNull($room);
|
$this->assertNotNull($room);
|
||||||
$this->assertEquals($room['Name'], 'test');
|
$this->assertEquals($room['Name'], 'test');
|
||||||
|
|
||||||
$this->assertNull(Room(-1));
|
$this->assertNull(Room(- 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue