Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OHRM5X-1537: Automation - Leave - Holidays #1359

Closed
wants to merge 70 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
ee271c8
test leave holidays code
ShenaliFernando Jun 28, 2022
97afd90
test leave holidays code- fix 1
ShenaliFernando Jun 28, 2022
1eb2aab
test leave holidays code- fix 2
ShenaliFernando Jun 29, 2022
abdcc1d
test leave holidays code- fix 3
ShenaliFernando Jun 29, 2022
13fa5a1
OHRM5X-1537 Automation: Leave - Holidays
ShenaliFernando Jun 29, 2022
73f3af6
OHRM5X-1746: Develop buzz - upcoming anniversaries (#1461)
ManulMax Sep 27, 2022
bc3ddcd
OHRM5X-1745: Develop buzz - newsfeed (#1485)
Oct 11, 2022
3a8b3a8
OHRM5X-1743: Develop buzz - post related components (#1477)
ManulMax Oct 18, 2022
d0b12d6
OHRM5X - Improve Test Coverage Recruitment Module (#1503)
SandeepaOHRM Oct 24, 2022
7fa8940
OHRM5X-1734: Develop buzz - share video component (#1502)
Oct 24, 2022
a21e335
OHRM5X-1515: Initiate API doc with OpenAPI (#1403)
RajithaKumara Sep 15, 2022
677b5b4
OHRM5X-1709: Initiate admin - API doc with OpenAPI (#1456)
SharukaNP Sep 23, 2022
48e51a9
OHRM5X-1755: Write admin - API doc with OpenAPI (#1462)
SharukaNP Sep 26, 2022
cefdd2e
OHRM5X-1757: Write Performance - API doc with OpenAPI (#1464)
SharukaNP Sep 30, 2022
b85a77b
OHRM5X-1767: Write leave - API doc with OpenAPI (#1476)
SharukaNP Oct 25, 2022
21bf6af
OHRM5X-1733: Develop buzz - share photo component (#1510)
Oct 27, 2022
10d5e24
OHRM5X-1795: Develop buzz - upcoming anniversaries API (#1508)
ManulMax Nov 1, 2022
805d0cc
OHRM5X-1735: Develop buzz - share post component (#1515)
Nov 1, 2022
21bd37b
OHRM5X-1795: Improve buzz - upcoming anniversaries API (#1516)
ManulMax Nov 2, 2022
6e89f3b
OHRM5X-1796: Create buzz - entities (#1518)
RajithaKumara Nov 3, 2022
8486a42
OHRM5X-1766: Improve doctrine connection for the application (#1506)
RajithaKumara Nov 3, 2022
fabe6ff
OHRM5X-1812: Initiate buzz - feed API (#1520)
RajithaKumara Nov 8, 2022
8266e82
OHRM5X-1813: Develop buzz - create post API (#1526)
ManulMax Nov 9, 2022
594ec85
OHRM5X-1819: Initiate buzz - photo controller (#1525)
RajithaKumara Nov 9, 2022
9166721
OHRM5X-1838: Convert buzz - times to UTC times (#1528)
RajithaKumara Nov 10, 2022
cdedda5
OHRM5X-1740: Develop buzz - photo carousel component (#1524)
Nov 11, 2022
7d78daa
OHRM5X-1812: Add buzz - feed API doc (#1530)
RajithaKumara Nov 14, 2022
d84adbe
OHRM5X-1813: Develop buzz - post API (#1532)
ManulMax Nov 14, 2022
97ba06a
OHRM5X-1829: Initiate buzz - share a post API (#1533)
RajithaKumara Nov 14, 2022
19a4737
OHRM5X-1825: Initiate buzz - comment API (#1535)
RajithaKumara Nov 15, 2022
ee5e6be
OHRM5X-1738: Develop buzz - shared post content (#1534)
Nov 15, 2022
f3bf799
OHRM5X-1820: Develop buzz - likes on share API (#1537)
devishke-orange Nov 17, 2022
69ef19d
OHRM5X-1741: Develop buzz - post comment component (#1538)
Nov 17, 2022
7e510a4
OHRM5X-1846: Develop buzz - likes on comment API (#1540)
devishke-orange Nov 21, 2022
c0adb91
OHRM5X-1819: Handle buzz - photo controller caching (#1545)
RajithaKumara Nov 22, 2022
0fb5614
OHRM5X-1817: Develop buzz - validate video URL & generate embedded UR…
ManulMax Nov 22, 2022
5d85696
OHRM5X-1803: Fix buzz - module related issues (#1546)
Nov 23, 2022
be3122f
OHRM5X-1824: Develop buzz - comment API get operation (#1547)
RajithaKumara Nov 23, 2022
cfc8d13
OHRM5X-1829: Add buzz - share API testing & doc (#1548)
ManulMax Nov 24, 2022
418194b
OHRM5X-1845: Fix buzz - module related issues (#1549)
Nov 24, 2022
c5cb21f
OHRM5X-1825: Add buzz - comment API post operation testing (#1551)
RajithaKumara Nov 25, 2022
e703425
OHRM5X-1807: Define one writable directory for the application (#1512)
RajithaKumara Oct 28, 2022
f9bf97f
OHRM5X-1805: Generate doctrine proxy classes (#1514)
RajithaKumara Nov 11, 2022
f0798f3
OHRM5X-1807: Revert introduced experimental var directory
RajithaKumara Nov 28, 2022
d529c56
OHRM5X-1858: Check database prerequisites in installer (#1552)
RajithaKumara Nov 29, 2022
83ea0a1
OHRM5X-1861: Fix response blocking at auth/validate (#1554)
RajithaKumara Dec 2, 2022
dd8802c
OHRM5X-1831: Develop buzz - share API delete operation (#1555)
devishke-orange Dec 5, 2022
88f268f
OHRM5X-1868: Handle buzz - post, share, comments multibyte characters…
RajithaKumara Dec 5, 2022
51e68e6
OHRM5X-1863: Add buzz - newsfeed swipe gesture (#1550)
Dec 5, 2022
07d9d92
OHRM5X-1874: Remove buzz - share count from shared posts (#1558)
RajithaKumara Dec 6, 2022
34202e0
OHRM5X-1814: Develop buzz - post API update operation (#1556)
ManulMax Dec 6, 2022
4325f81
OHRM5X-1823: Develop buzz - post shares API (#1560)
devishke-orange Dec 7, 2022
26de921
OHRM5X-1830: Develop buzz - share API update operation (#1563)
ManulMax Dec 8, 2022
3696369
OHRM5X-1843: Develop buzz - edit post/share modal (#1565)
Dec 9, 2022
3b18b12
OHRM5X-1884: Update buzz - post stats when adding/deleting comments (…
Dec 12, 2022
0a93cdc
OHRM5X-1827: Develop buzz - comments API getOne operation (#1568)
ManulMax Dec 12, 2022
bb63bd3
OHRM5X-817: Test Automation - Apply Leave
OvaraPerera Aug 10, 2022
cf75b8a
OHRM5X-1675: Fix apply leave test cases
Sep 12, 2022
145c46a
skip failing tests
Sep 12, 2022
724e7fe
enble memory storage engine
Sep 12, 2022
30e23cb
move mysql fs to tmpfs
Sep 12, 2022
3385e0d
skip apply leave test cases
Sep 12, 2022
a6669fa
fix fails
Sep 12, 2022
4224182
fix selectOption command
Sep 12, 2022
7a68d80
apply leave test cases
Sep 12, 2022
e12bfa2
fix apply leave test cases
Sep 12, 2022
dded9f7
fix apply leave
Sep 12, 2022
831cf93
fix apply leave
Sep 13, 2022
6ca2321
apply leave fix
Sep 13, 2022
c0da9b5
Merge branch 'OHRM5X-1675' into OHRM5X-1537
Dec 13, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 3 additions & 1 deletion .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,14 @@ jobs:

- name: Start docker containers
run: |
sed -i '156s/volumes/tmpfs/' docker-compose.yml
sed -i '157s/mysql-data-55://' docker-compose.yml
docker-compose up -d php-8.0 mysql55
docker ps

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
id: yarn-cache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
id: git-status
run: |
git status --porcelain
echo "::set-output name=status::$(git status --porcelain)"
echo "status=$(git status --porcelain)" >> $GITHUB_OUTPUT

- name: Fail if files changed
if: ${{ steps.git-status.outputs.status }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scheduled_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
database: [ 'mysql:5.5', 'mysql:5.6', 'mysql:5.7', 'mariadb:5.5', 'mariadb:10.0', 'mariadb:10.1', 'mariadb:10.2', 'mariadb:10.3', 'mariadb:10.4', 'mariadb:10.5', 'mariadb:10.6', 'mariadb:10.7', 'mariadb:10.8', 'mariadb:10.9' ]
database: [ 'mysql:5.5', 'mysql:5.6', 'mysql:5.7', 'mysql:8.0', 'mariadb:5.5', 'mariadb:10.0', 'mariadb:10.1', 'mariadb:10.2', 'mariadb:10.3', 'mariadb:10.4', 'mariadb:10.5', 'mariadb:10.6', 'mariadb:10.7', 'mariadb:10.8', 'mariadb:10.9' ]

services:
mysql:
Expand Down
1 change: 0 additions & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
// TODO:: Remove bellow excluded dirs, files
->exclude('devTools/load')
->exclude('lib')
->exclude('src/plugins/orangehrmBuzzPlugin')
->exclude('src/plugins/orangehrmHelpPlugin/test')
->exclude('src/plugins/orangehrmMarketPlacePlugin')
->exclude('src/plugins/orangehrmOpenidAuthenticationPlugin')
Expand Down
46 changes: 20 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
![](https://www.orangehrm.com/themes/orangehrm-modern/static/images/logo.png)
<img width="40%" alt='OrangeHRM' src='https://raw.githubusercontent.com/wiki/orangehrm/orangehrm/logos/logo.svg#gh-light-mode-only'/><img width="40%" alt='OrangeHRM' src='https://raw.githubusercontent.com/wiki/orangehrm/orangehrm/logos/logo_dark_mode.svg#gh-dark-mode-only'/>

[![Docker Pulls](https://img.shields.io/docker/pulls/orangehrm/orangehrm.svg)](https://hub.docker.com/r/orangehrm/orangehrm) [![SourceForge Downloads](https://img.shields.io/sourceforge/dm/orangehrm.svg)](https://sourceforge.net/projects/orangehrm/) [![SourceForge Downloads](https://img.shields.io/sourceforge/dt/orangehrm.svg)](https://sourceforge.net/projects/orangehrm/) [![codecov](https://codecov.io/gh/orangehrm/orangehrm/branch/develop/graph/badge.svg)](https://codecov.io/gh/orangehrm/develop)
[![Docker Pulls](https://img.shields.io/docker/pulls/orangehrm/orangehrm.svg)](https://hub.docker.com/r/orangehrm/orangehrm) [![SourceForge Downloads](https://img.shields.io/sourceforge/dm/orangehrm.svg)](https://sourceforge.net/projects/orangehrm/) [![SourceForge Downloads](https://img.shields.io/sourceforge/dt/orangehrm.svg)](https://sourceforge.net/projects/orangehrm/)

# OrangeHRM Open Source Application
# OrangeHRM Starter Application

OrangeHRM is a comprehensive Human Resource Management (HRM) System that captures all the essential functionalities required for any enterprise. Copyright (C) 2006 OrangeHRM Inc., http://www.orangehrm.com/

Expand All @@ -12,48 +12,42 @@ OrangeHRM is distributed in the hope that it will be useful, but WITHOUT ANY WAR

## Getting started

- Install OrangeHRM using the web installer
https://github.com/orangehrm/orangehrm/wiki/Getting-started
- Download the latest version of OrangeHRM Starter [here](https://sourceforge.net/projects/orangehrm/files/latest/download).

- For further information on how to use the product please refer the Free User Guide available on http://orangehrm.com/
- Prerequisites and environment set up for installing OrangeHRM Starter:
- [Install on Linux](https://starterhelp.orangehrm.com/hc/en-us/articles/6187572000540-Prerequisites-for-installing-OrangeHRM-Starter-in-Linux)
- [Install on Windows](https://starterhelp.orangehrm.com/hc/en-us/articles/6187576427804-Prerequisites-for-installing-OrangeHRM-Starter-in-Windows)

- In case Installation difficulties there is a seperate Installation Guides also available from the same source.
- Install OrangeHRM using the web installer:
- [OrangeHRM Starter Installation Guide](https://starterhelp.orangehrm.com/hc/en-us/articles/5295915003666-OrangeHRM-Starter-Installation-Guide)
- [OrangeHRM Starter Upgrade Guide](https://starterhelp.orangehrm.com/hc/en-us/articles/6937346912402-OrangeHRM-Starter-Upgrade-Guide-For-5x-versions-)

- For Apache/PHP/MySQL Installation issues please refer to the Environment Setup Guide

- For OrangeHRM Installation issues please refer to the OrangeHRM Installation Guide
- For further information on how to use the product please refer to the User Guides, Tutorial videos, and FAQs available on [Help Portal](https://starterhelp.orangehrm.com)

## OrangeHRM Mobile App

<a href="https://play.google.com/store/apps/details?id=com.orangehrm.opensource" target="_blank">
<img height="54" alt='Get it on Google Play'
src='https://raw.githubusercontent.com/wiki/orangehrm/orangehrm/mobile/play_store_cropped_en_US.png'/>
src='https://raw.githubusercontent.com/wiki/orangehrm/orangehrm/mobile/play_store_cropped_en_US_2022_08_04.png'/>
</a>
<a href="https://apps.apple.com/us/app/orangehrm/id1527247547" target="_blank">
<img height="53" alt='Download on the App Store'
<img height="54" alt='Download on the App Store'
src='https://raw.githubusercontent.com/wiki/orangehrm/orangehrm/mobile/app_store_en_US.svg'/>
</a>

## Contribute

https://github.com/orangehrm/orangehrm/wiki/How-to-Contribute

## Resources

https://github.com/orangehrm/orangehrm/wiki/Resources

## Demo
Live demo is available at : https://opensource-demo.orangehrmlive.com/index.php/auth/login
### Demo
Live demo is available at : https://opensource-demo.orangehrmlive.com

## Releases
### Releases
Sourceforge : https://sourceforge.net/p/orangehrm

## Contribute
https://github.com/orangehrm/orangehrm/wiki/How-to-Contribute


## Website
### Website
https://www.orangehrm.com/

## Help & Support
Submit your help requests through [OrangeHRM Help Portal](https://starterhelp.orangehrm.com/hc/en-us/requests/new) or Email to [ossupport@orangehrm.com](mailto:ossupport@orangehrm.com)

## License
GNU General Public License
18 changes: 11 additions & 7 deletions bin/console
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,18 @@ new Framework($env, $debug); // initializing kernel

$request = new Request();
$pluginConfigs = Config::get('ohrm_plugin_configs');
foreach (array_values($pluginConfigs) as $pluginConfig) {
require_once $pluginConfig['filepath'];
/** @var PluginConfigurationInterface $configClass */
$configClass = new $pluginConfig['classname']();
$configClass->initialize($request);
if ($configClass instanceof ConsoleConfigurationInterface) {
$configClass->registerCommands($console);
try {
foreach (array_values($pluginConfigs) as $pluginConfig) {
require_once $pluginConfig['filepath'];
/** @var PluginConfigurationInterface $configClass */
$configClass = new $pluginConfig['classname']();
$configClass->initialize($request);
if ($configClass instanceof ConsoleConfigurationInterface) {
$configClass->registerCommands($console);
}
}
} catch (Throwable $e) {
echo("\n" . $e->getMessage() . "\n\n");
}

$console->run();
2 changes: 2 additions & 0 deletions build/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
index.html
orangehrm-v2.json
20 changes: 3 additions & 17 deletions build/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
-->
<project name="OrangeHRM" basedir="." default="dist">

<property name="version" value="5.2"/>
<property name="version" value="5.3"/>
<property name="package.name" value="orangehrm-${version}"/>
<resolvepath propertyName="project.dir" file=".."/>
<resolvepath propertyName="dist.dir" file="dist"/>
Expand Down Expand Up @@ -60,32 +60,18 @@
<exclude name="build/build.xml"/>
<exclude name="build/phing-latest.phar"/>
<exclude name=".github/**"/>
<exclude name="INSTALL.html"/>
<exclude name="Dockerfile"/>
<exclude name="devTools/**"/>
<exclude name="lib/confs/Conf.php"/>
<exclude name="lib/confs/cryptokeys/key.ohrm"/>
<exclude name="orangehrm-quick-start-guide.html"/>
<exclude name="src/test/**"/>
<exclude name="src/plugins/**/test/**"/>

<exclude name="src/plugins/orangehrmAdminPlugin/lib/**"/>
<exclude name="src/plugins/orangehrmAuthenticationPlugin/lib/**"/>
<exclude name="src/plugins/orangehrmCoreOAuthPlugin/lib/**"/>
<exclude name="src/plugins/orangehrmCorePlugin/lib/**"/>
<exclude name="src/plugins/orangehrmPimPlugin/lib/**"/>

<exclude name="src/plugins/orangehrmAttendancePlugin/lib"/>
<exclude name="src/plugins/orangehrmBuzzPlugin/lib"/>
<exclude name="src/plugins/orangehrmCoreWebServicePlugin/**"/>
<exclude name="src/plugins/orangehrmCorporateBrandingPlugin/lib"/>
<exclude name="src/plugins/orangehrmCorporateDirectoryPlugin/lib"/>
<exclude name="src/plugins/orangehrmDashboardPlugin/lib"/>
<exclude name="src/plugins/orangehrmMaintenancePlugin/lib"/>
<exclude name="src/plugins/orangehrmMarketPlacePlugin/lib"/>
<exclude name="src/plugins/orangehrmMarketPlacePlugin/**"/>
<exclude name="src/plugins/orangehrmOpenidAuthenticationPlugin/**"/>
<exclude name="src/plugins/orangehrmPerformancePlugin/lib"/>
<exclude name="src/plugins/orangehrmPerformanceTrackerPlugin/**"/>
<exclude name="src/plugins/orangehrmRecruitmentPlugin/lib"/>
<exclude name="src/plugins/orangehrmRESTPlugin/**"/>

<!-- 5.x related -->
Expand Down
2 changes: 2 additions & 0 deletions devTools/core/console.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
use OrangeHRM\DevTools\Command\AddRolePermissionCommand;
use OrangeHRM\DevTools\Command\CreateTestDatabaseCommand;
use OrangeHRM\DevTools\Command\EventDispatcherDebugCommand;
use OrangeHRM\DevTools\Command\GenerateOpenApiDocCommand;
use OrangeHRM\DevTools\Command\PHPFixCodingStandardsCommand;
use OrangeHRM\DevTools\Command\ReInstallCommand;
use OrangeHRM\DevTools\Command\ResetInstallationCommand;
Expand All @@ -59,6 +60,7 @@
$application->add(new ReInstallCommand());
$application->add(new CreateTestDatabaseCommand());
$application->add(new RunMigrationClassCommand());
$application->add(new GenerateOpenApiDocCommand());

ServiceContainer::getContainer()->register(Services::DOCTRINE)
->setFactory([Doctrine::class, 'getEntityManager']);
Expand Down
76 changes: 76 additions & 0 deletions devTools/core/src/Command/GenerateOpenApiDocCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?php
/**
* OrangeHRM is a comprehensive Human Resource Management (HRM) System that captures
* all the essential functionalities required for any enterprise.
* Copyright (C) 2006 OrangeHRM Inc., http://www.orangehrm.com
*
* OrangeHRM is free software; you can redistribute it and/or modify it under the terms of
* the GNU General Public License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* OrangeHRM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program;
* if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA
*/

namespace OrangeHRM\DevTools\Command;

use OpenApi\Generator;
use OrangeHRM\Config\Config;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;

class GenerateOpenApiDocCommand extends Command
{
protected static $defaultName = 'generate-open-api-doc';

/**
* @inheritDoc
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);

$command = $this->getApplication()->find('php-cs-fix');
$input = new ArrayInput([]);
$command->run($input, $output);

$paths = [Config::get(Config::PLUGINS_DIR) . '/orangehrmCorePlugin/Controller/Rest/V2'];
foreach (Config::get(Config::PLUGIN_PATHS) as $pluginAbsPath) {
$pathToApiDir = realpath($pluginAbsPath . '/Api');
if ($pathToApiDir !== false) {
$paths[] = $pathToApiDir;
}
}
$openapi = Generator::scan($paths);
$buildDir = Config::get(Config::BASE_DIR) . '/build';
$filePath = $buildDir . '/orangehrm-v2.json';

$openApiDefinition = $openapi->toJson(
JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_INVALID_UTF8_IGNORE
);

file_put_contents($filePath, $openApiDefinition);
$io->success("File write to `$filePath`");

$swaggerUI = file_get_contents(__DIR__ . '/swagger.tpl.html');

$pos = strpos($openApiDefinition, '3.1.0'); // TODO::remove this
if ($pos !== false) {
$openApiDefinition = substr_replace($openApiDefinition, '3.0.3', $pos, strlen('3.1.0'));
}
$swaggerUI = str_replace('OPEN_API_DEFINITION', $openApiDefinition, $swaggerUI);
$uiFilePath = $buildDir . '/index.html';
file_put_contents($uiFilePath, $swaggerUI);

$io->success("File write to `$uiFilePath`");
return Command::SUCCESS;
}
}
9 changes: 9 additions & 0 deletions devTools/core/src/Command/ReInstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,15 @@ public function handle(
}

$io->success('Done');

define('ENVIRONMENT', 'test');
$testConf = Config::getConf(true);
$this->tryClosure(function () use ($testConf, $io) {
$sm = $this->getEntityManager()->getConnection()->createSchemaManager();
$sm->dropDatabase($testConf->getDbName());
$io->success('Dropped test database');
});

return Command::SUCCESS;
}

Expand Down
16 changes: 12 additions & 4 deletions devTools/core/src/Command/ResetInstallationCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

namespace OrangeHRM\DevTools\Command;

use Conf;
use OrangeHRM\Config\Config;
use OrangeHRM\Core\Traits\ORM\EntityManagerHelperTrait;
use OrangeHRM\Core\Utility\KeyHandler;
Expand All @@ -28,6 +27,7 @@
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Filesystem\Filesystem;
use Throwable;

class ResetInstallationCommand extends Command
{
Expand Down Expand Up @@ -55,22 +55,30 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}

$pathToConf = Config::get(Config::CONF_FILE_PATH);
require_once $pathToConf;
$conf = new Conf();
$conf = Config::getConf();
$dbName = $conf->getDbName();

$sm = $this->getEntityManager()->getConnection()->createSchemaManager();
$sm->dropDatabase("`$dbName`");
$io->note("Dropped database `$dbName`");

define('ENVIRONMENT', 'test');
$testConf = Config::getConf(true);

$fs = new Filesystem();
$fs->remove($pathToConf);
$io->note("Deleted conf file `$pathToConf`");

$pathToKey = KeyHandler::getRealPathToKey();
$pathToKey = KeyHandler::getPathToKey();
$fs->remove($pathToKey);
$io->note("Deleted key.ohrm file `$pathToKey`");

try {
$sm->dropDatabase($testConf->getDbName());
$io->note('Dropped test database');
} catch (Throwable $e) {
}

$io->success('Done');
return Command::SUCCESS;
}
Expand Down
2 changes: 2 additions & 0 deletions devTools/core/src/Command/RunMigrationClassCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use Doctrine\DBAL\Connection;
use OrangeHRM\Config\Config;
use OrangeHRM\Core\Traits\ORM\EntityManagerHelperTrait;
use OrangeHRM\Installer\Framework\HttpKernel;
use OrangeHRM\Installer\Util\ConfigHelper;
use OrangeHRM\Installer\Util\V1\AbstractMigration;
use Symfony\Component\Console\Command\Command;
Expand Down Expand Up @@ -64,6 +65,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$io->error("Invalid migration class `$migrationClass`");
return Command::FAILURE;
}
new HttpKernel('prod', false); // Initiate kernel
class_alias($migrationClass, '\OrangeHRM\DevTools\Command\_Migration');
$migration = new class ($this->getEntityManager()->getConnection()) extends _Migration {
private Connection $connection;
Expand Down
24 changes: 24 additions & 0 deletions devTools/core/src/Command/swagger.tpl.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="OrangeHRM"/>
<title>OrangeHRM</title>
<link rel="stylesheet" href="https://unpkg.com/swagger-ui-dist@4.13.0/swagger-ui.css" />
</head>
<body>
<div id="app"></div>
<script src="https://unpkg.com/swagger-ui-dist@4.13.0/swagger-ui-bundle.js" crossorigin></script>
<script src="https://unpkg.com/swagger-ui-dist@4.13.0/swagger-ui-standalone-preset.js" crossorigin></script>
<script>
const spec = OPEN_API_DEFINITION;
window.onload = () => {
window.ui = SwaggerUIBundle({
spec: spec,
dom_id: '#app',
});
};
</script>
</body>
</html>
Loading