mirror of
https://github.com/Karaka-Management/oms-Tasks.git
synced 2026-01-11 15:38:40 +00:00
test fixes
This commit is contained in:
parent
cd0ff0c478
commit
dc436833f5
41
.github/workflows/main.yml
vendored
41
.github/workflows/main.yml
vendored
|
|
@ -121,6 +121,28 @@ jobs:
|
|||
uses: actions/checkout@main
|
||||
with:
|
||||
fetch-depth: 1
|
||||
- name: Checkout Build Repository
|
||||
uses: actions/checkout@main
|
||||
with:
|
||||
fetch-depth: 1
|
||||
ref: develop
|
||||
repository: Karaka-Management/Build
|
||||
path: Build
|
||||
- name: Checkout Resource Repository
|
||||
uses: actions/checkout@main
|
||||
with:
|
||||
fetch-depth: 1
|
||||
ref: develop
|
||||
repository: Karaka-Management/Resources
|
||||
path: Resources
|
||||
- name: Checkout phpOMS Repository
|
||||
uses: actions/checkout@main
|
||||
with:
|
||||
fetch-depth: 1
|
||||
ref: develop
|
||||
repository: Karaka-Management/phpOMS
|
||||
path: phpOMS
|
||||
token: ${{ secrets.GH_PAT }}
|
||||
- name: Checkout Karaka Repository
|
||||
uses: actions/checkout@main
|
||||
with:
|
||||
|
|
@ -128,7 +150,6 @@ jobs:
|
|||
ref: develop
|
||||
repository: Karaka-Management/Karaka
|
||||
path: Karaka
|
||||
submodules: recursive
|
||||
- name: Setup PHP, with composer and extensions
|
||||
uses: shivammathur/setup-php@master
|
||||
with:
|
||||
|
|
@ -197,7 +218,7 @@ jobs:
|
|||
- name: Setup Composer
|
||||
run: composer install
|
||||
- name: phpstan
|
||||
run: vendor/bin/phpstan analyse -a tests/Autoloader.php --no-progress -l 9 -c Build/Config/phpstan.neon ./
|
||||
run: vendor/bin/phpstan analyse -a phpOMS/Autoloader.php --no-progress -l 9 -c Build/Config/phpstan.neon ./
|
||||
codestyle-tests:
|
||||
runs-on: ubuntu-latest
|
||||
if: "!contains(github.event.head_commit.message, 'NO_CI')"
|
||||
|
|
@ -241,14 +262,14 @@ jobs:
|
|||
run: vendor/bin/phpcs --severity=1 ./ --standard="Build/Config/phpcs.xml" -s --report=full
|
||||
- name: rector
|
||||
run: vendor/bin/rector process --dry-run --config Build/Config/rector.php ./
|
||||
# - name: Install NPM
|
||||
# uses: actions/setup-node@v3
|
||||
# with:
|
||||
# node-version: '14'
|
||||
# cache: 'npm'
|
||||
# - run: npm install
|
||||
# - name: eslint
|
||||
# run: npx eslint ./ -c Build/Config/.eslintrc.json
|
||||
- name: Install NPM
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '14'
|
||||
cache: 'npm'
|
||||
- run: npm install
|
||||
- name: eslint
|
||||
run: npx eslint ./ -c Build/Config/.eslintrc.json
|
||||
# linting:
|
||||
# runs-on: ubuntu-latest
|
||||
# if: "!contains(github.event.head_commit.message, 'NO_CI')"
|
||||
|
|
|
|||
|
|
@ -14,6 +14,11 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\Tasks\tests\Views;
|
||||
|
||||
use Modules\Admin\Models\AccountMapper;
|
||||
use Modules\Admin\Models\NullAccount;
|
||||
use Modules\Media\Models\Media;
|
||||
use Modules\Profile\Models\Profile;
|
||||
use Modules\Profile\Models\ProfileMapper;
|
||||
use Modules\Tasks\Views\TaskView;
|
||||
|
||||
/**
|
||||
|
|
@ -38,8 +43,32 @@ class TaskViewTest extends \PHPUnit\Framework\TestCase
|
|||
*/
|
||||
public function testAccountImageUrl() : void
|
||||
{
|
||||
$view = new TaskView();
|
||||
$media = new Media();
|
||||
$media->createdBy = new NullAccount(1);
|
||||
$media->description = 'desc';
|
||||
$media->setPath('Web/Backend/img/default-user.jpg');
|
||||
$media->size = 11;
|
||||
$media->extension = 'png';
|
||||
$media->name = 'Image';
|
||||
|
||||
if (($profile = ProfileMapper::get()->where('account', 1)->execute())->id === 0) {
|
||||
$profile = new Profile();
|
||||
|
||||
$profile->account = AccountMapper::get()->where('id', 1)->execute();
|
||||
$profile->image = $media;
|
||||
$profile->birthday = new \DateTime('now');
|
||||
|
||||
$id = ProfileMapper::create()->execute($profile);
|
||||
self::assertGreaterThan(0, $profile->id);
|
||||
self::assertEquals($id, $profile->id);
|
||||
} else {
|
||||
$profile->image = $media;
|
||||
$profile->birthday = new \DateTime('now');
|
||||
|
||||
ProfileMapper::update()->with('image')->execute($profile);
|
||||
}
|
||||
|
||||
$view = new TaskView();
|
||||
self::assertEquals('Web/Backend/img/default-user.jpg', $view->getAccountImage(1));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user