Skip to content
This repository has been archived by the owner on Sep 13, 2024. It is now read-only.

Commit

Permalink
Improved tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rskrzypczak committed Nov 2, 2023
1 parent eeb9e7b commit 39d2d66
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
2 changes: 1 addition & 1 deletion tests/Integrations/TwitterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ final class TwitterTest extends \Tests\Base
*/
public static function setUpBeforeClass(): void
{
$moduleModel = \Settings_LayoutEditor_Module_Model::getInstanceByName('Contacts');
$moduleModel = \Settings_LayoutEditor_Module_Model::getInstance('Settings:LayoutEditor')->setSourceModule('Contacts');
$block = $moduleModel->getBlocks()['LBL_CONTACT_INFORMATION'];
$type = 'Twitter';
$suffix = '_t1';
Expand Down
8 changes: 4 additions & 4 deletions tests/Settings/ModuleManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ private function getLangPathToFile($fileName)
*/
public function testCreateNewBlock()
{
$moduleModel = \Settings_LayoutEditor_Module_Model::getInstanceByName('TestModule');
$moduleModel = \Vtiger_Module_Model::getInstance('TestModule');
$blockInstance = new \Settings_LayoutEditor_Block_Model();
$blockInstance->set('label', 'label block');
$blockInstance->set('iscustom', 1);
Expand Down Expand Up @@ -155,14 +155,14 @@ public function testCreateNewField($type, $param, $suffix = '')
if ('Tree' === $type || 'CategoryMultipicklist' === $type) {
//Add a tree if it does not exist
if (empty(self::$treeId)) {
self::$treeId = (new TreesManager())->testAddTree(1, \Settings_LayoutEditor_Module_Model::getInstanceByName('TestModule')->getId());
self::$treeId = (new TreesManager())->testAddTree(1, \Vtiger_Module_Model::getInstance('TestModule')->getId());
}
$param['tree'] = self::$treeId;
} elseif ('MultiReferenceValue' === $type) {
$param['MRVField'] = $this->getMRVField();
}

$moduleModel = \Settings_LayoutEditor_Module_Model::getInstanceByName($param['sourceModule']);
$moduleModel = \Settings_LayoutEditor_Module_Model::getInstance('Settings:LayoutEditor')->setSourceModule($param['sourceModule']);
$fieldModel = $moduleModel->addField($param['fieldType'], self::$blockId, $param);
self::$fieldsId[$key] = $fieldModel->getId();
$details = $moduleModel->getTypeDetailsForAddField($type, $param);
Expand Down Expand Up @@ -237,7 +237,7 @@ private function getMRVField()
$moduleInstance = \vtlib\Module::getInstance('Contacts');
$source_Module->setRelatedList($moduleInstance, 'TestRel123', ['ADD', 'SELECT'], 'getRelatedList');

$moduleModel = \Settings_LayoutEditor_Module_Model::getInstanceByName('TestModule');
$moduleModel = \Settings_LayoutEditor_Module_Model::getInstance('Settings:LayoutEditor')->setSourceModule('TestModule');
$fields = [];
foreach ($moduleModel->getRelations() as $value) {
foreach ($value->getFields() as $valF) {
Expand Down
17 changes: 15 additions & 2 deletions tests/setup/nginx/yetiforce.conf
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ header_filter_by_lua_block {
## nginx module: headers-more-nginx-module
# https://github.com/openresty/headers-more-nginx-module#installation
# https://www.nginx.com/blog/compiling-dynamic-modules-nginx-plus/
more_clear_headers 'Server';
more_clear_headers 'X-Frame-Options';
more_clear_headers 'X-XSS-Protection';
more_clear_headers 'X-Content-Type-Options';
more_clear_headers 'Referrer-Policy';
more_clear_headers 'Strict-Transport-Security';
more_clear_headers 'X-Robots-Tag';
more_clear_headers 'X-Permitted-Cross-Domain-Policies';
more_clear_headers 'Expect-CT';

more_set_headers 'Server: ';
more_set_headers 'X-Frame-Options: SAMEORIGIN';
more_set_headers 'X-XSS-Protection: 1; mode=block';
Expand All @@ -34,7 +44,6 @@ more_set_headers 'Strict-Transport-Security: max-age=31536000; includeSubDomains
more_set_headers 'X-Robots-Tag: none';
more_set_headers 'X-Permitted-Cross-Domain-Policies: none';
more_set_headers 'Expect-CT: enforce; max-age=3600';
more_set_headers 'Cache-Control: private, no-cache, no-store, must-revalidate, post-check=0, pre-check=0';

##########################
## Stability ##
Expand All @@ -60,11 +69,15 @@ gzip_vary on;
gzip_comp_level 6;
gzip_min_length 500;
gzip_disable "msie6";

#add_header Cache-Control "private, no-cache, no-store, must-revalidate, post-check=0, pre-check=0" always;
more_clear_headers 'Cache-Control';
more_set_headers 'Cache-Control: private, no-cache, no-store, must-revalidate, post-check=0, pre-check=0';
location ~* \.(?:css(\.map)?|js(\.map)?|jpe?g|png|gif|ico|cur|heic|webp|tiff?|mp3|m4a|aac|ogg|midi?|wav|mp4|mov|webm|mpe?g|avi|ogv|flv|wmv|ttf|ttc|otf|eot|woff2?)$ {
access_log off;
expires 1d;
#add_header Cache-Control public;
#add_header Cache-Control public always;
more_clear_headers 'Cache-Control';
more_set_headers 'Cache-Control: public';
etag on;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/setup/selenium.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
serverUrl='http://127.0.0.1:4444'

# Versions
CHROME_DRIVER_VERSION=`curl -sS https://chromedriver.storage.googleapis.com/LATEST_RELEASE_103`
CHROME_DRIVER_VERSION=`curl -sS https://chromedriver.storage.googleapis.com/LATEST_RELEASE_105`
#CHROME_DRIVER_VERSION="101.0.4951.41"
SELENIUM_STANDALONE_VERSION=3.9.1
SELENIUM_SUBDIR=$(echo "$SELENIUM_STANDALONE_VERSION" | cut -d"." -f-2)
Expand Down

0 comments on commit 39d2d66

Please sign in to comment.