mirror of
https://code.castopod.org/adaures/castopod
synced 2025-04-19 04:51:17 +00:00
fix(file-uploads): validate chapters json content + remove permit_empty rule to uploaded files
refs #445
This commit is contained in:
parent
37f2d2d21a
commit
6289c42b11
@ -16,7 +16,7 @@ class App extends BaseConfig
|
||||
* URL to your CodeIgniter root. Typically, this will be your base URL,
|
||||
* WITH a trailing slash:
|
||||
*
|
||||
* http://example.com/
|
||||
* E.g., http://example.com/
|
||||
*/
|
||||
public string $baseURL = 'http://localhost:8080/';
|
||||
|
||||
@ -24,10 +24,10 @@ class App extends BaseConfig
|
||||
* Allowed Hostnames in the Site URL other than the hostname in the baseURL.
|
||||
* If you want to accept multiple Hostnames, set this.
|
||||
*
|
||||
* E.g. When your site URL ($baseURL) is 'http://example.com/', and your site
|
||||
* also accepts 'http://media.example.com/' and
|
||||
* 'http://accounts.example.com/':
|
||||
* ['media.example.com', 'accounts.example.com']
|
||||
* E.g.,
|
||||
* When your site URL ($baseURL) is 'http://example.com/', and your site
|
||||
* also accepts 'http://media.example.com/' and 'http://accounts.example.com/':
|
||||
* ['media.example.com', 'accounts.example.com']
|
||||
*
|
||||
* @var list<string>
|
||||
*/
|
||||
@ -38,9 +38,9 @@ class App extends BaseConfig
|
||||
* Index File
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Typically this will be your index.php file, unless you've renamed it to
|
||||
* something else. If you are using mod_rewrite to remove the page set this
|
||||
* variable so that it is blank.
|
||||
* Typically, this will be your `index.php` file, unless you've renamed it to
|
||||
* something else. If you have configured your web server to remove this file
|
||||
* from your site URIs, set this variable to an empty string.
|
||||
*/
|
||||
public string $indexPage = '';
|
||||
|
||||
@ -50,12 +50,12 @@ class App extends BaseConfig
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* This item determines which server global should be used to retrieve the
|
||||
* URI string. The default setting of 'REQUEST_URI' works for most servers.
|
||||
* URI string. The default setting of 'REQUEST_URI' works for most servers.
|
||||
* If your links do not seem to work, try one of the other delicious flavors:
|
||||
*
|
||||
* 'REQUEST_URI' Uses $_SERVER['REQUEST_URI']
|
||||
* 'QUERY_STRING' Uses $_SERVER['QUERY_STRING']
|
||||
* 'PATH_INFO' Uses $_SERVER['PATH_INFO']
|
||||
* 'REQUEST_URI': Uses $_SERVER['REQUEST_URI']
|
||||
* 'QUERY_STRING': Uses $_SERVER['QUERY_STRING']
|
||||
* 'PATH_INFO': Uses $_SERVER['PATH_INFO']
|
||||
*
|
||||
* WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
|
||||
*/
|
||||
@ -96,7 +96,7 @@ class App extends BaseConfig
|
||||
*
|
||||
* IncomingRequest::setLocale() also uses this list.
|
||||
*
|
||||
* @var string[]
|
||||
* @var list<string>
|
||||
*/
|
||||
public array $supportedLocales = ['en', 'fr', 'pl', 'de', 'pt-BR', 'nn-NO', 'es', 'zh-Hans', 'ca'];
|
||||
|
||||
@ -108,7 +108,8 @@ class App extends BaseConfig
|
||||
* The default timezone that will be used in your application to display
|
||||
* dates with the date helper, and can be retrieved through app_timezone()
|
||||
*
|
||||
* @see https://www.php.net/manual/en/timezones.php for list of timezones supported by PHP.
|
||||
* @see https://www.php.net/manual/en/timezones.php for list of timezones
|
||||
* supported by PHP.
|
||||
*/
|
||||
public string $appTimezone = 'UTC';
|
||||
|
||||
@ -132,7 +133,7 @@ class App extends BaseConfig
|
||||
* If true, this will force every request made to this application to be
|
||||
* made via a secure connection (HTTPS). If the incoming request is not
|
||||
* secure, the user will be redirected to a secure version of the page
|
||||
* and the HTTP Strict Transport Security header will be set.
|
||||
* and the HTTP Strict Transport Security (HSTS) header will be set.
|
||||
*/
|
||||
public bool $forceGlobalSecureRequests = true;
|
||||
|
||||
|
@ -66,13 +66,12 @@ class Routing extends BaseRouting
|
||||
|
||||
/**
|
||||
* Sets the class/method that should be called if routing doesn't
|
||||
* find a match. It can be either a closure or the controller/method
|
||||
* name exactly like a route is defined: Users::index
|
||||
* find a match. It can be the controller/method name like: Users::index
|
||||
*
|
||||
* This setting is passed to the Router class and handled there.
|
||||
*
|
||||
* If you want to use a closure, you will have to set it in the
|
||||
* class constructor or the routes file by calling:
|
||||
* routes file by calling:
|
||||
*
|
||||
* $routes->set404Override(function() {
|
||||
* // Do something here
|
||||
|
@ -218,7 +218,6 @@ class EpisodeModel extends UuidModel
|
||||
/** @var LazyUuidFromString $uuid */
|
||||
$uuid = $this->uuid->{$this->uuidVersion}();
|
||||
|
||||
// @phpstan-ignore-next-line
|
||||
if (! $this->update($episodeId, [
|
||||
'preview_id' => $uuid,
|
||||
])) {
|
||||
|
@ -95,4 +95,43 @@ class FileRules extends ValidationFileRules
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Checks that an uploaded json file's content is valid
|
||||
*/
|
||||
public function is_json(string $blank = null, string $params = ''): bool
|
||||
{
|
||||
// Grab the file name off the top of the $params
|
||||
// after we split it.
|
||||
$params = explode(',', $params);
|
||||
$name = array_shift($params);
|
||||
|
||||
if (! ($files = $this->request->getFileMultiple($name))) {
|
||||
$files = [$this->request->getFile($name)];
|
||||
}
|
||||
|
||||
foreach ($files as $file) {
|
||||
if ($file === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($file->getError() === UPLOAD_ERR_NO_FILE) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$content = file_get_contents($file->getTempName());
|
||||
|
||||
if ($content === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
json_decode($content);
|
||||
|
||||
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
"enabled": true,
|
||||
"actions": [
|
||||
{
|
||||
"action": "composer test -- --no-coverage",
|
||||
"action": "composer test",
|
||||
"options": [],
|
||||
"conditions": []
|
||||
},
|
||||
|
@ -9,10 +9,10 @@
|
||||
"php": "^8.1",
|
||||
"adaures/ipcat-php": "^v1.0.0",
|
||||
"adaures/podcast-persons-taxonomy": "^v1.0.1",
|
||||
"aws/aws-sdk-php": "^3.299.1",
|
||||
"aws/aws-sdk-php": "^3.300.8",
|
||||
"chrisjean/php-ico": "^1.0.4",
|
||||
"cocur/slugify": "^v4.5.1",
|
||||
"codeigniter4/framework": "v4.4.5",
|
||||
"codeigniter4/framework": "v4.4.6",
|
||||
"codeigniter4/settings": "v2.2.0",
|
||||
"codeigniter4/shield": "v1.0.1",
|
||||
"codeigniter4/tasks": "dev-develop",
|
||||
@ -24,7 +24,7 @@
|
||||
"michalsn/codeigniter4-uuid": "v1.0.2",
|
||||
"mpratt/embera": "^2.0.36",
|
||||
"opawg/user-agents-v2-php": "dev-main",
|
||||
"phpseclib/phpseclib": "~2.0.46",
|
||||
"phpseclib/phpseclib": "~2.0.47",
|
||||
"vlucas/phpdotenv": "v5.6.0",
|
||||
"whichbrowser/parser": "^v2.1.7",
|
||||
"yassinedoghri/podcast-feed": "dev-main"
|
||||
@ -34,8 +34,8 @@
|
||||
"codeigniter/phpstan-codeigniter": "v1.4.3",
|
||||
"mikey179/vfsstream": "^v1.6.11",
|
||||
"phpstan/extension-installer": "^1.3.1",
|
||||
"phpstan/phpstan": "^1.10.58",
|
||||
"phpunit/phpunit": "^10.5.10",
|
||||
"phpstan/phpstan": "^1.10.59",
|
||||
"phpunit/phpunit": "^10.5.11",
|
||||
"rector/rector": "^1.0.1",
|
||||
"symplify/coding-standard": "^12.0.7",
|
||||
"symplify/easy-coding-standard": "^12.0.13"
|
||||
|
145
composer.lock
generated
145
composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "4773eb8843b3b60e4e4dbfd1926167d9",
|
||||
"content-hash": "b5a3103c2712fc40845933bb0de767d3",
|
||||
"packages": [
|
||||
{
|
||||
"name": "adaures/ipcat-php",
|
||||
@ -120,16 +120,16 @@
|
||||
},
|
||||
{
|
||||
"name": "aws/aws-sdk-php",
|
||||
"version": "3.299.1",
|
||||
"version": "3.300.8",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/aws/aws-sdk-php.git",
|
||||
"reference": "a0f87b8e8bfb9afd0ffd702fcda556b465eee457"
|
||||
"reference": "421be99f109a330acd4297abe2f41069eccbf447"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/a0f87b8e8bfb9afd0ffd702fcda556b465eee457",
|
||||
"reference": "a0f87b8e8bfb9afd0ffd702fcda556b465eee457",
|
||||
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/421be99f109a330acd4297abe2f41069eccbf447",
|
||||
"reference": "421be99f109a330acd4297abe2f41069eccbf447",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -205,9 +205,9 @@
|
||||
"support": {
|
||||
"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
|
||||
"issues": "https://github.com/aws/aws-sdk-php/issues",
|
||||
"source": "https://github.com/aws/aws-sdk-php/tree/3.299.1"
|
||||
"source": "https://github.com/aws/aws-sdk-php/tree/3.300.8"
|
||||
},
|
||||
"time": "2024-02-16T19:08:34+00:00"
|
||||
"time": "2024-02-29T19:06:50+00:00"
|
||||
},
|
||||
{
|
||||
"name": "brick/math",
|
||||
@ -373,16 +373,16 @@
|
||||
},
|
||||
{
|
||||
"name": "codeigniter4/framework",
|
||||
"version": "v4.4.5",
|
||||
"version": "v4.4.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/codeigniter4/framework.git",
|
||||
"reference": "f5844cb9790d87ff6043203953821740ba3aa592"
|
||||
"reference": "7d393f85e8410f16654fa9b486694ff68c354c99"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/codeigniter4/framework/zipball/f5844cb9790d87ff6043203953821740ba3aa592",
|
||||
"reference": "f5844cb9790d87ff6043203953821740ba3aa592",
|
||||
"url": "https://api.github.com/repos/codeigniter4/framework/zipball/7d393f85e8410f16654fa9b486694ff68c354c99",
|
||||
"reference": "7d393f85e8410f16654fa9b486694ff68c354c99",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -440,7 +440,7 @@
|
||||
"slack": "https://codeigniterchat.slack.com",
|
||||
"source": "https://github.com/codeigniter4/CodeIgniter4"
|
||||
},
|
||||
"time": "2024-01-27T03:57:48+00:00"
|
||||
"time": "2024-02-24T02:42:57+00:00"
|
||||
},
|
||||
{
|
||||
"name": "codeigniter4/settings",
|
||||
@ -564,12 +564,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/codeigniter4/tasks.git",
|
||||
"reference": "af45180ea8e04a162699bc55d7bed6b883199f38"
|
||||
"reference": "dbdd8fc32d31d78fdfd559c77240c43faee7ff55"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/codeigniter4/tasks/zipball/af45180ea8e04a162699bc55d7bed6b883199f38",
|
||||
"reference": "af45180ea8e04a162699bc55d7bed6b883199f38",
|
||||
"url": "https://api.github.com/repos/codeigniter4/tasks/zipball/dbdd8fc32d31d78fdfd559c77240c43faee7ff55",
|
||||
"reference": "dbdd8fc32d31d78fdfd559c77240c43faee7ff55",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -580,7 +580,7 @@
|
||||
"require-dev": {
|
||||
"codeigniter4/devkit": "^1.0",
|
||||
"codeigniter4/framework": "^4.1",
|
||||
"rector/rector": "0.19.8"
|
||||
"rector/rector": "1.0.1"
|
||||
},
|
||||
"default-branch": true,
|
||||
"type": "library",
|
||||
@ -638,20 +638,20 @@
|
||||
"source": "https://github.com/codeigniter4/tasks/tree/develop",
|
||||
"issues": "https://github.com/codeigniter4/tasks/issues"
|
||||
},
|
||||
"time": "2024-02-05T11:21:42+00:00"
|
||||
"time": "2024-02-23T11:59:21+00:00"
|
||||
},
|
||||
{
|
||||
"name": "composer/ca-bundle",
|
||||
"version": "1.4.0",
|
||||
"version": "1.4.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/composer/ca-bundle.git",
|
||||
"reference": "b66d11b7479109ab547f9405b97205640b17d385"
|
||||
"reference": "3ce240142f6d59b808dd65c1f52f7a1c252e6cfd"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/composer/ca-bundle/zipball/b66d11b7479109ab547f9405b97205640b17d385",
|
||||
"reference": "b66d11b7479109ab547f9405b97205640b17d385",
|
||||
"url": "https://api.github.com/repos/composer/ca-bundle/zipball/3ce240142f6d59b808dd65c1f52f7a1c252e6cfd",
|
||||
"reference": "3ce240142f6d59b808dd65c1f52f7a1c252e6cfd",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -690,7 +690,7 @@
|
||||
"support": {
|
||||
"irc": "irc://irc.freenode.org/composer",
|
||||
"issues": "https://github.com/composer/ca-bundle/issues",
|
||||
"source": "https://github.com/composer/ca-bundle/tree/1.4.0"
|
||||
"source": "https://github.com/composer/ca-bundle/tree/1.4.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -706,7 +706,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-12-18T12:05:55+00:00"
|
||||
"time": "2024-02-23T10:16:52+00:00"
|
||||
},
|
||||
{
|
||||
"name": "dflydev/dot-access-data",
|
||||
@ -2166,16 +2166,16 @@
|
||||
},
|
||||
{
|
||||
"name": "phpseclib/phpseclib",
|
||||
"version": "2.0.46",
|
||||
"version": "2.0.47",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpseclib/phpseclib.git",
|
||||
"reference": "498e67a0c82bd5791fda9b0dd0f4ec8e8aebb02d"
|
||||
"reference": "b7d7d90ee7df7f33a664b4aea32d50a305d35adb"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/498e67a0c82bd5791fda9b0dd0f4ec8e8aebb02d",
|
||||
"reference": "498e67a0c82bd5791fda9b0dd0f4ec8e8aebb02d",
|
||||
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/b7d7d90ee7df7f33a664b4aea32d50a305d35adb",
|
||||
"reference": "b7d7d90ee7df7f33a664b4aea32d50a305d35adb",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -2252,7 +2252,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/phpseclib/phpseclib/issues",
|
||||
"source": "https://github.com/phpseclib/phpseclib/tree/2.0.46"
|
||||
"source": "https://github.com/phpseclib/phpseclib/tree/2.0.47"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -2268,7 +2268,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-12-29T01:52:43+00:00"
|
||||
"time": "2024-02-26T04:55:38+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/cache",
|
||||
@ -3614,16 +3614,16 @@
|
||||
},
|
||||
{
|
||||
"name": "friendsofphp/php-cs-fixer",
|
||||
"version": "v3.49.0",
|
||||
"version": "v3.51.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git",
|
||||
"reference": "8742f7aa6f72a399688b65e4f58992c2d4681fc2"
|
||||
"reference": "127fa74f010da99053e3f5b62672615b72dd6efd"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/8742f7aa6f72a399688b65e4f58992c2d4681fc2",
|
||||
"reference": "8742f7aa6f72a399688b65e4f58992c2d4681fc2",
|
||||
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/127fa74f010da99053e3f5b62672615b72dd6efd",
|
||||
"reference": "127fa74f010da99053e3f5b62672615b72dd6efd",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -3633,7 +3633,7 @@
|
||||
"ext-json": "*",
|
||||
"ext-tokenizer": "*",
|
||||
"php": "^7.4 || ^8.0",
|
||||
"sebastian/diff": "^4.0 || ^5.0",
|
||||
"sebastian/diff": "^4.0 || ^5.0 || ^6.0",
|
||||
"symfony/console": "^5.4 || ^6.0 || ^7.0",
|
||||
"symfony/event-dispatcher": "^5.4 || ^6.0 || ^7.0",
|
||||
"symfony/filesystem": "^5.4 || ^6.0 || ^7.0",
|
||||
@ -3654,7 +3654,8 @@
|
||||
"php-cs-fixer/accessible-object": "^1.1",
|
||||
"php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.4",
|
||||
"php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.4",
|
||||
"phpunit/phpunit": "^9.6 || ^10.5.5",
|
||||
"phpunit/phpunit": "^9.6 || ^10.5.5 || ^11.0.2",
|
||||
"symfony/var-dumper": "^5.4 || ^6.0 || ^7.0",
|
||||
"symfony/yaml": "^5.4 || ^6.0 || ^7.0"
|
||||
},
|
||||
"suggest": {
|
||||
@ -3689,7 +3690,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues",
|
||||
"source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.49.0"
|
||||
"source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.51.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -3697,7 +3698,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2024-02-02T00:41:40+00:00"
|
||||
"time": "2024-02-28T19:50:06+00:00"
|
||||
},
|
||||
{
|
||||
"name": "mikey179/vfsstream",
|
||||
@ -3799,16 +3800,16 @@
|
||||
},
|
||||
{
|
||||
"name": "nikic/php-parser",
|
||||
"version": "v5.0.0",
|
||||
"version": "v5.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/nikic/PHP-Parser.git",
|
||||
"reference": "4a21235f7e56e713259a6f76bf4b5ea08502b9dc"
|
||||
"reference": "2218c2252c874a4624ab2f613d86ac32d227bc69"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4a21235f7e56e713259a6f76bf4b5ea08502b9dc",
|
||||
"reference": "4a21235f7e56e713259a6f76bf4b5ea08502b9dc",
|
||||
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/2218c2252c874a4624ab2f613d86ac32d227bc69",
|
||||
"reference": "2218c2252c874a4624ab2f613d86ac32d227bc69",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -3844,9 +3845,9 @@
|
||||
"keywords": ["parser", "php"],
|
||||
"support": {
|
||||
"issues": "https://github.com/nikic/PHP-Parser/issues",
|
||||
"source": "https://github.com/nikic/PHP-Parser/tree/v5.0.0"
|
||||
"source": "https://github.com/nikic/PHP-Parser/tree/v5.0.1"
|
||||
},
|
||||
"time": "2024-01-07T17:17:35+00:00"
|
||||
"time": "2024-02-21T19:24:10+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phar-io/manifest",
|
||||
@ -3995,16 +3996,16 @@
|
||||
},
|
||||
{
|
||||
"name": "phpstan/phpstan",
|
||||
"version": "1.10.58",
|
||||
"version": "1.10.59",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpstan/phpstan.git",
|
||||
"reference": "a23518379ec4defd9e47cbf81019526861623ec2"
|
||||
"reference": "e607609388d3a6d418a50a49f7940e8086798281"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/a23518379ec4defd9e47cbf81019526861623ec2",
|
||||
"reference": "a23518379ec4defd9e47cbf81019526861623ec2",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/e607609388d3a6d418a50a49f7940e8086798281",
|
||||
"reference": "e607609388d3a6d418a50a49f7940e8086798281",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -4043,7 +4044,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-02-12T20:02:57+00:00"
|
||||
"time": "2024-02-20T13:59:13+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-code-coverage",
|
||||
@ -4335,16 +4336,16 @@
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit",
|
||||
"version": "10.5.10",
|
||||
"version": "10.5.11",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||
"reference": "50b8e314b6d0dd06521dc31d1abffa73f25f850c"
|
||||
"reference": "0d968f6323deb3dbfeba5bfd4929b9415eb7a9a4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/50b8e314b6d0dd06521dc31d1abffa73f25f850c",
|
||||
"reference": "50b8e314b6d0dd06521dc31d1abffa73f25f850c",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0d968f6323deb3dbfeba5bfd4929b9415eb7a9a4",
|
||||
"reference": "0d968f6323deb3dbfeba5bfd4929b9415eb7a9a4",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -4404,7 +4405,7 @@
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
||||
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
|
||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.10"
|
||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.11"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -4420,7 +4421,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-02-04T09:07:51+00:00"
|
||||
"time": "2024-02-25T14:05:00+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/container",
|
||||
@ -5520,16 +5521,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/console",
|
||||
"version": "v6.4.3",
|
||||
"version": "v6.4.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/console.git",
|
||||
"reference": "2aaf83b4de5b9d43b93e4aec6f2f8b676f7c567e"
|
||||
"reference": "0d9e4eb5ad413075624378f474c4167ea202de78"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/2aaf83b4de5b9d43b93e4aec6f2f8b676f7c567e",
|
||||
"reference": "2aaf83b4de5b9d43b93e4aec6f2f8b676f7c567e",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/0d9e4eb5ad413075624378f474c4167ea202de78",
|
||||
"reference": "0d9e4eb5ad413075624378f474c4167ea202de78",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -5585,7 +5586,7 @@
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": ["cli", "command-line", "console", "terminal"],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/console/tree/v6.4.3"
|
||||
"source": "https://github.com/symfony/console/tree/v6.4.4"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -5601,7 +5602,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-01-23T14:51:35+00:00"
|
||||
"time": "2024-02-22T20:27:10+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/event-dispatcher",
|
||||
@ -6147,16 +6148,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/process",
|
||||
"version": "v6.4.3",
|
||||
"version": "v6.4.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/process.git",
|
||||
"reference": "31642b0818bfcff85930344ef93193f8c607e0a3"
|
||||
"reference": "710e27879e9be3395de2b98da3f52a946039f297"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/process/zipball/31642b0818bfcff85930344ef93193f8c607e0a3",
|
||||
"reference": "31642b0818bfcff85930344ef93193f8c607e0a3",
|
||||
"url": "https://api.github.com/repos/symfony/process/zipball/710e27879e9be3395de2b98da3f52a946039f297",
|
||||
"reference": "710e27879e9be3395de2b98da3f52a946039f297",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -6184,7 +6185,7 @@
|
||||
"description": "Executes commands in sub-processes",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/process/tree/v6.4.3"
|
||||
"source": "https://github.com/symfony/process/tree/v6.4.4"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -6200,7 +6201,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-01-23T14:51:35+00:00"
|
||||
"time": "2024-02-20T12:31:00+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/service-contracts",
|
||||
@ -6340,16 +6341,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/string",
|
||||
"version": "v6.4.3",
|
||||
"version": "v6.4.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/string.git",
|
||||
"reference": "7a14736fb179876575464e4658fce0c304e8c15b"
|
||||
"reference": "4e465a95bdc32f49cf4c7f07f751b843bbd6dcd9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/string/zipball/7a14736fb179876575464e4658fce0c304e8c15b",
|
||||
"reference": "7a14736fb179876575464e4658fce0c304e8c15b",
|
||||
"url": "https://api.github.com/repos/symfony/string/zipball/4e465a95bdc32f49cf4c7f07f751b843bbd6dcd9",
|
||||
"reference": "4e465a95bdc32f49cf4c7f07f751b843bbd6dcd9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -6393,7 +6394,7 @@
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": ["grapheme", "i18n", "string", "unicode", "utf-8", "utf8"],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/string/tree/v6.4.3"
|
||||
"source": "https://github.com/symfony/string/tree/v6.4.4"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -6409,7 +6410,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-01-25T09:26:29+00:00"
|
||||
"time": "2024-02-01T13:16:41+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symplify/coding-standard",
|
||||
|
@ -161,8 +161,8 @@ class EpisodeController extends BaseController
|
||||
'slug' => 'required|max_length[128]',
|
||||
'audio_file' => 'uploaded[audio_file]|ext_in[audio_file,mp3,m4a]',
|
||||
'cover' => 'is_image[cover]|ext_in[cover,jpg,jpeg,png]|min_dims[cover,1400,1400]|is_image_ratio[cover,1,1]',
|
||||
'transcript_file' => 'ext_in[transcript,srt]|permit_empty',
|
||||
'chapters_file' => 'ext_in[chapters,json]|permit_empty',
|
||||
'transcript_file' => 'ext_in[transcript_file,srt,vtt]',
|
||||
'chapters_file' => 'ext_in[chapters_file,json]|is_json[chapters_file]',
|
||||
];
|
||||
|
||||
if ($this->podcast->type === 'serial' && $this->request->getPost('type') === 'full') {
|
||||
@ -297,10 +297,10 @@ class EpisodeController extends BaseController
|
||||
$rules = [
|
||||
'title' => 'required',
|
||||
'slug' => 'required|max_length[128]',
|
||||
'audio_file' => 'uploaded[audio_file]|ext_in[audio_file,mp3,m4a]|permit_empty',
|
||||
'audio_file' => 'ext_in[audio_file,mp3,m4a]',
|
||||
'cover' => 'is_image[cover]|ext_in[cover,jpg,jpeg,png]|min_dims[cover,1400,1400]|is_image_ratio[cover,1,1]',
|
||||
'transcript_file' => 'ext_in[transcript_file,txt,html,srt,json]|permit_empty',
|
||||
'chapters_file' => 'ext_in[chapters_file,json]|permit_empty',
|
||||
'transcript_file' => 'ext_in[transcript_file,srt,vtt]',
|
||||
'chapters_file' => 'ext_in[chapters_file,json]|is_json[chapters_file]',
|
||||
];
|
||||
|
||||
if ($this->podcast->type === 'serial' && $this->request->getPost('type') === 'full') {
|
||||
|
@ -13,4 +13,5 @@ return [
|
||||
'{field} is either not an image, or it is not wide or tall enough.',
|
||||
'is_image_ratio' =>
|
||||
'{field} is either not an image or not of the right ratio.',
|
||||
'is_json' => '{field} contains invalid JSON.',
|
||||
];
|
||||
|
26
package.json
26
package.json
@ -33,8 +33,8 @@
|
||||
"@codemirror/commands": "^6.3.3",
|
||||
"@codemirror/lang-xml": "^6.0.2",
|
||||
"@codemirror/language": "^6.10.1",
|
||||
"@codemirror/state": "^6.4.0",
|
||||
"@codemirror/view": "^6.24.0",
|
||||
"@codemirror/state": "^6.4.1",
|
||||
"@codemirror/view": "^6.24.1",
|
||||
"@floating-ui/dom": "^1.6.3",
|
||||
"@github/clipboard-copy-element": "^1.3.0",
|
||||
"@github/hotkey": "^3.1.0",
|
||||
@ -48,29 +48,29 @@
|
||||
"leaflet": "^1.9.4",
|
||||
"leaflet.markercluster": "^1.5.3",
|
||||
"lit": "^3.1.2",
|
||||
"marked": "^11.2.0",
|
||||
"marked": "^12.0.0",
|
||||
"wavesurfer.js": "^7.7.3",
|
||||
"xml-formatter": "^3.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "^18.6.1",
|
||||
"@commitlint/config-conventional": "^18.6.2",
|
||||
"@commitlint/cli": "^19.0.3",
|
||||
"@commitlint/config-conventional": "^19.0.3",
|
||||
"@csstools/css-tokenizer": "^2.2.3",
|
||||
"@semantic-release/changelog": "^6.0.3",
|
||||
"@semantic-release/exec": "^6.0.3",
|
||||
"@semantic-release/git": "^10.0.1",
|
||||
"@semantic-release/gitlab": "^13.0.2",
|
||||
"@semantic-release/gitlab": "^13.0.3",
|
||||
"@tailwindcss/forms": "^0.5.7",
|
||||
"@tailwindcss/typography": "^0.5.10",
|
||||
"@types/leaflet": "^1.9.8",
|
||||
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
||||
"@typescript-eslint/parser": "^6.21.0",
|
||||
"@typescript-eslint/eslint-plugin": "^7.1.0",
|
||||
"@typescript-eslint/parser": "^7.1.0",
|
||||
"all-contributors-cli": "^6.26.1",
|
||||
"commitizen": "^4.3.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"cssnano": "^6.0.3",
|
||||
"cz-conventional-changelog": "^3.3.0",
|
||||
"eslint": "^8.56.0",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-prettier": "^5.1.3",
|
||||
"husky": "^9.0.11",
|
||||
@ -78,8 +78,8 @@
|
||||
"lint-staged": "^15.2.2",
|
||||
"postcss": "^8.4.35",
|
||||
"postcss-import": "^16.0.1",
|
||||
"postcss-nesting": "^12.0.2",
|
||||
"postcss-preset-env": "^9.3.0",
|
||||
"postcss-nesting": "^12.0.4",
|
||||
"postcss-preset-env": "^9.4.0",
|
||||
"postcss-reporter": "^7.1.0",
|
||||
"prettier": "3.2.5",
|
||||
"prettier-plugin-organize-imports": "^3.2.4",
|
||||
@ -89,8 +89,8 @@
|
||||
"svgo": "^3.2.0",
|
||||
"tailwindcss": "^3.4.1",
|
||||
"typescript": "^5.3.3",
|
||||
"vite": "^5.1.3",
|
||||
"vite-plugin-pwa": "^0.17.5",
|
||||
"vite": "^5.1.4",
|
||||
"vite-plugin-pwa": "^0.19.2",
|
||||
"workbox-build": "^7.0.0",
|
||||
"workbox-core": "^7.0.0",
|
||||
"workbox-routing": "^7.0.0",
|
||||
|
1511
pnpm-lock.yaml
generated
1511
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -7,14 +7,14 @@ test your application. Those details can be found in the documentation.
|
||||
|
||||
## Resources
|
||||
|
||||
- [CodeIgniter 4 User Guide on Testing](https://codeigniter4.github.io/userguide/testing/index.html)
|
||||
- [CodeIgniter 4 User Guide on Testing](https://codeigniter.com/user_guide/testing/index.html)
|
||||
- [PHPUnit docs](https://phpunit.de/documentation.html)
|
||||
- [Any tutorials on Unit testing in CI4?](https://forum.codeigniter.com/showthread.php?tid=81830)
|
||||
|
||||
## Requirements
|
||||
|
||||
It is recommended to use the latest version of PHPUnit. At the time of this
|
||||
writing we are running version 9.x. Support for this has been built into the
|
||||
writing, we are running version 9.x. Support for this has been built into the
|
||||
**composer.json** file that ships with CodeIgniter and can easily be installed
|
||||
via [Composer](https://getcomposer.org/) if you don't already have it installed
|
||||
globally.
|
||||
@ -38,9 +38,9 @@ add `xdebug.mode=coverage` in the **php.ini** file to enable code coverage.
|
||||
|
||||
A number of the tests use a running database. In order to set up the database
|
||||
edit the details for the `tests` group in **app/Config/Database.php** or
|
||||
**phpunit.xml**. Make sure that you provide a database engine that is currently
|
||||
running on your machine. More details on a test database setup are in the
|
||||
[Testing Your Database](https://codeigniter4.github.io/userguide/testing/database.html)
|
||||
**.env**. Make sure that you provide a database engine that is currently running
|
||||
on your machine. More details on a test database setup are in the
|
||||
[Testing Your Database](https://codeigniter.com/user_guide/testing/database.html)
|
||||
section of the documentation.
|
||||
|
||||
## Running the tests
|
||||
@ -96,14 +96,12 @@ to exclude database tests, or automatically generate HTML code coverage reports.
|
||||
## Test Cases
|
||||
|
||||
Every test needs a _test case_, or class that your tests extend. CodeIgniter 4
|
||||
provides a few that you may use directly:
|
||||
provides one class that you may use directly:
|
||||
|
||||
- `CodeIgniter\Test\CIUnitTestCase` - for basic tests with no other service
|
||||
needs
|
||||
- `CodeIgniter\Test\DatabaseTestTrait` - for tests that need database access
|
||||
- `CodeIgniter\Test\CIUnitTestCase`
|
||||
|
||||
Most of the time you will want to write your own test cases to hold functions
|
||||
and services common to your test suites.
|
||||
Most of the time you will want to write your own test cases that extend
|
||||
`CIUnitTestCase` to hold functions and services common to your test suites.
|
||||
|
||||
## Creating Tests
|
||||
|
||||
@ -118,13 +116,9 @@ how. Review the links above and always pay attention to your code coverage.
|
||||
|
||||
### Database Tests
|
||||
|
||||
Tests can include migrating, seeding, and testing against a mock or
|
||||
live<sup>1</sup> database. Be sure to modify the test case (or create your own)
|
||||
to point to your seed and migrations and include any additional steps to be run
|
||||
before tests in the `setUp()` method.
|
||||
|
||||
<sup>1</sup> Note: If you are using database tests that require a live database
|
||||
connection you will need to rename **phpunit.xml.dist** to **phpunit.xml**,
|
||||
uncomment the database configuration lines and add your connection details.
|
||||
Prevent **phpunit.xml** from being tracked in your repo by adding it to
|
||||
**.gitignore**.
|
||||
Tests can include migrating, seeding, and testing against a mock or live
|
||||
database. Be sure to modify the test case (or create your own) to point to your
|
||||
seed and migrations and include any additional steps to be run before tests in
|
||||
the `setUp()` method. See
|
||||
[Testing Your Database](https://codeigniter.com/user_guide/testing/database.html)
|
||||
for details.
|
||||
|
Loading…
x
Reference in New Issue
Block a user