Skip to content

Commit

Permalink
Tests: Adds unit-tests for models (#1287)
Browse files Browse the repository at this point in the history
This adds model tests to BookablePost, Booking, Week, Calendar, Location and Timeframe model classes.

For this it introduces the clock-mock library, to ease the testing of time-dependent code. clock-mock needs the uopz php extension.

Several small fixes:

* Fixes missing grid variable after refactoring
* Fixes method invocation of commented test
* Refactors the bookingLink invocation
* Fixes CB::get invocation with missing post value
---------

Co-authored-by: Hans Morbach <6433480+hansmorb@users.noreply.github.com>
  • Loading branch information
datengraben and hansmorb committed Jun 22, 2023
1 parent c4c1b0f commit a137852
Show file tree
Hide file tree
Showing 17 changed files with 781 additions and 376 deletions.
1 change: 1 addition & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
- uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
extensions: uopz

- name: Validate composer.json and composer.lock
run: composer validate
Expand Down
16 changes: 11 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
"description": "~",
"version": "0.0.1",
"config": {
"platform-check": false
},
"platform-check": false,
"allow-plugins": {
"php-http/discovery": true
}
},
"autoload": {
"files": [
"includes/OptionsArray.php",
Expand All @@ -13,7 +16,9 @@
"includes/TemplateParser.php",
"includes/Users.php"
],
"psr-4": {"CommonsBooking\\": "src/"}
"psr-4": {
"CommonsBooking\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
Expand Down Expand Up @@ -44,7 +49,8 @@
"require-dev": {
"mockery/mockery": "1.*",
"phpunit/phpunit": "7.*",
"yoast/phpunit-polyfills": "^1.0",
"wp-coding-standards/wpcs": "^2.3"
"slope-it/clock-mock": "^0.3.8",
"wp-coding-standards/wpcs": "^2.3",
"yoast/phpunit-polyfills": "^1.0"
}
}
Loading

0 comments on commit a137852

Please sign in to comment.