diff options
author | Igor Scheller <igor.scheller@igorshp.de> | 2017-07-19 23:35:20 +0200 |
---|---|---|
committer | Igor Scheller <igor.scheller@igorshp.de> | 2017-07-19 23:35:20 +0200 |
commit | ec45216899b192789c2fd88f6dc057937f5927cc (patch) | |
tree | 540aa8a5a1a08f4b547083341a4bc423f0af3c29 | |
parent | 6cfd309bef050fbf9b9e2eba0af32962485f840a (diff) | |
parent | 9b3f6f557a127fef16be267c26f8239dc1c22126 (diff) |
Merge remote-tracking branch 'engelsystem/feature-igel-rewrite'
-rw-r--r-- | includes/model/EventConfig_model.php | 2 | ||||
-rw-r--r-- | includes/model/ShiftsFilter.php | 9 | ||||
-rw-r--r-- | includes/model/Shifts_model.php | 4 | ||||
-rw-r--r-- | phpunit.xml | 3 | ||||
-rw-r--r-- | src/Database/Db.php | 16 | ||||
-rw-r--r-- | test/model/LogEntriesModelTest.php | 8 | ||||
-rw-r--r-- | test/model/RoomModelTest.php | 14 |
7 files changed, 24 insertions, 32 deletions
diff --git a/includes/model/EventConfig_model.php b/includes/model/EventConfig_model.php index f5846870..112ad457 100644 --- a/includes/model/EventConfig_model.php +++ b/includes/model/EventConfig_model.php @@ -64,7 +64,7 @@ function EventConfig_update( ); } - return (bool)DB::update(' + return DB::update(' UPDATE `EventConfig` SET `event_name` = ?, `buildup_start_date` = ?, diff --git a/includes/model/ShiftsFilter.php b/includes/model/ShiftsFilter.php index 47ef50d7..3b691b55 100644 --- a/includes/model/ShiftsFilter.php +++ b/includes/model/ShiftsFilter.php @@ -10,12 +10,6 @@ namespace Engelsystem; class ShiftsFilter { /** - * How long can the time interval be? - * 86400 = one day - */ - const MAX_DURATION = 86400; - - /** * Shift is completely full. */ const FILLED_FILLED = 1; @@ -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; } diff --git a/includes/model/Shifts_model.php b/includes/model/Shifts_model.php index b0269362..21abc888 100644 --- a/includes/model/Shifts_model.php +++ b/includes/model/Shifts_model.php @@ -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); } diff --git a/phpunit.xml b/phpunit.xml index 29bfdba5..b868096c 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -16,7 +16,8 @@ <whitelist> <directory>./include/</directory> <directory>./public/</directory> - </whitelist> + <directory>./src/</directory> + </whitelist> </filter> <php> <const name="PHPUNIT_TESTSUITE" value="true"/> diff --git a/src/Database/Db.php b/src/Database/Db.php index c1efa058..4116ffda 100644 --- a/src/Database/Db.php +++ b/src/Database/Db.php @@ -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); } /** diff --git a/test/model/LogEntriesModelTest.php b/test/model/LogEntriesModelTest.php index 4da6fd4b..25d46fc4 100644 --- a/test/model/LogEntriesModelTest.php +++ b/test/model/LogEntriesModelTest.php @@ -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); } diff --git a/test/model/RoomModelTest.php b/test/model/RoomModelTest.php index 9c91939d..135a6108 100644 --- a/test/model/RoomModelTest.php +++ b/test/model/RoomModelTest.php @@ -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)); } /** |