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