Skip to content

Commit

Permalink
Merge branch 'release/1.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
whitelacoste committed Jun 14, 2024
2 parents 30b87f1 + c75dc20 commit 48de177
Show file tree
Hide file tree
Showing 21 changed files with 188 additions and 17 deletions.
4 changes: 2 additions & 2 deletions install/version.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
$arModuleVersion = [
'VERSION' => '1.1.0',
'VERSION_DATE' => '2023-06-13 16:45:00'
'VERSION' => '1.1.1',
'VERSION_DATE' => '2024-06-14 15:00:00'
];
2 changes: 2 additions & 0 deletions lang/ru/include.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@
$MESS['INTERVOLGA_EDU.COURSE3_LESSON3_PROPERTYGENDERVALUES_DESCRIPTION'] = 'Списочное свойство должно содержать 2 варианта: "Мужчина" и "Женщина"';
$MESS['INTERVOLGA_EDU.COURSE3_LESSON3_LINKWITHRESPONDENT'] = 'Проверка свойства "Респондент"';
$MESS['INTERVOLGA_EDU.COURSE3_LESSON3_LINKWITHRESPONDENT_DESCRIPTION'] = 'Должно быть привязкой к элементам ИБ "Респонденты"';
$MESS['INTERVOLGA_EDU.COURSE3_LESSON3_PROPERTYCODE'] = 'Проверка кода компонента "Респонденты/Результаты опроса"';
$MESS['INTERVOLGA_EDU.COURSE3_LESSON3_PROPERTYCODE_DESCRIPTION'] = 'В коде компонента и шаблона не должно быть упоминаний SALARY, GENDER, AGE"';
$MESS['INTERVOLGA_EDU.COURSE3_LESSON4_UF'] = 'Проверка собственного UF-свойства';
$MESS['INTERVOLGA_EDU.COURSE3_LESSON4_UF_DESCRIPTION'] = 'Должен существовать обработчик события OnUserTypeBuildList модуля main для свойства "Привязка к коллекции медиабиблиотеки"';
$MESS['INTERVOLGA_EDU.COURSE3_LESSON4_UFCLASS'] = 'Проверка собственного UF-свойства с требуемыми свойствами для объекта USER';
Expand Down
2 changes: 2 additions & 0 deletions lang/ru/lib/locator/iblock/property/agepollresultproperty.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
$MESS['INTERVOLGA_EDU.AGE_POLL_RESULTS_PROPERTY'] = 'Заработная плата';
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
$MESS['INTERVOLGA_EDU.LOCATOR_IO_RESPONDENT_TEMPLATE'] = 'Шаблон кастомного компонента "Респонденты/Результаты голосования"';
3 changes: 2 additions & 1 deletion lang/ru/lib/tests/course1/lesson1/testlicense.php
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
<?php
$MESS['INTERVOLGA_EDU.COURSE_1_LESSON_1_LICENSE_NAME'] = 'Стандарт';
$MESS['INTERVOLGA_EDU.COURSE_1_LESSON_1_LICENSE_NAME'] = 'Стандарт';
$MESS['INTERVOLGA_EDU.COURSE_1_LESSON_1_TEST_ERROR'] = 'Ошибка теста: #MESSAGE#';
2 changes: 2 additions & 0 deletions lang/ru/lib/tests/course1/lesson1/testupdates.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
$MESS['INTERVOLGA_EDU.COURSE_1_LESSON_1_TEST_ERROR'] = 'Ошибка теста: #MESSAGE#';
2 changes: 2 additions & 0 deletions lang/ru/lib/tests/course1/lesson2/testpromo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
$MESS['INTERVOLGA_EDU.COURSE_1_LESSON_2_NOT_FOUND_PROMO_IN_MENU'] = 'Раздел <b>#PROMO_NAME#</b> (Акции) в главном меню не найден';
15 changes: 15 additions & 0 deletions lib/locator/component/searchform.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
namespace Intervolga\Edu\Locator\Component;

class SearchForm extends ComponentLocator
{
public static function getCode(): array
{
return ['bitrix:search.form'];
}

public static function getFilter(): array
{
return array_merge(parent::getFilter(), ['REAL_PATH' => '/local/templates/.default/%header.php']);
}
}
1 change: 1 addition & 0 deletions lib/locator/iblock/promoiblock.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public static function getFilter(): array
'promos',
'stock',
'stocks',
'promotion',
],
];
}
Expand Down
31 changes: 31 additions & 0 deletions lib/locator/iblock/property/agepollresultproperty.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace Intervolga\Edu\Locator\Iblock\Property;

use Bitrix\Main\Localization\Loc;
use Intervolga\Edu\Locator\Iblock\ResultsPollingIblock;

class AgePollResultProperty extends PropertyLocator
{
public static function getIblock()
{
return ResultsPollingIblock::class;
}

public static function getFilter(): array
{
return [
'=CODE' => [
'AGE',
],
'PROPERTY_TYPE' => [
'N'
]
];
}

public static function getNameLoc(): string
{
return Loc::getMessage('INTERVOLGA_EDU.AGE_POLL_RESULTS_PROPERTY');
}
}
27 changes: 27 additions & 0 deletions lib/locator/io/componenttemplate/respondenttemplate.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace Intervolga\Edu\Locator\IO\ComponentTemplate;

use Bitrix\Main\Localization\Loc;
use Intervolga\Edu\Locator\IO\DirectoryLocator;
use Intervolga\Edu\Locator\IO\CustomRespondents;

class RespondentTemplate extends DirectoryLocator
{
public static function getNameLoc(): string
{
return Loc::getMessage('INTERVOLGA_EDU.LOCATOR_IO_RESPONDENT_TEMPLATE');
}

protected static function getRootLocator()
{
return CustomRespondents::class;
}

protected static function getPaths(): array
{
$paths = ['/templates/.default/'];

return $paths;
}
}
1 change: 1 addition & 0 deletions lib/tester.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ protected static function getTestClasses()
\Intervolga\Edu\Tests\Course3\Lesson3\TestResultsPollingIblock::class,
\Intervolga\Edu\Tests\Course3\Lesson3\TestPropertyGenderValues::class,
\Intervolga\Edu\Tests\Course3\Lesson3\TestLinkWithRespondent::class,
\Intervolga\Edu\Tests\Course3\Lesson3\TestPropertyCode::class,

\Intervolga\Edu\Tests\Course3\Lesson4\TestUf::class,
\Intervolga\Edu\Tests\Course3\Lesson4\TestUfClass::class,
Expand Down
10 changes: 9 additions & 1 deletion lib/tests/course1/lesson1/testupdates.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
namespace Intervolga\Edu\Tests\Course1\Lesson1;

use Bitrix\Main\Localization\Loc;
use Intervolga\Edu\Asserts\Assert;
use Intervolga\Edu\Tests\BaseTest;
use Intervolga\Edu\Util\UpdateSystem;
Expand All @@ -11,6 +12,13 @@ protected static function run()
{
$status = UpdateSystem::getStatus();

Assert::count($status['MODULES'], 0);
if (is_int($status['MODULES']) || is_array($status['MODULES'])) {
Assert::count($status['MODULES'], 0);
} else {
Assert::custom(Loc::getMessage('INTERVOLGA_EDU.COURSE_1_LESSON_1_TEST_ERROR',
[
'#MESSAGE#' => $status['MODULES']
]));
}
}
}
5 changes: 4 additions & 1 deletion lib/tests/course1/lesson10/testsearchaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
namespace Intervolga\Edu\Tests\Course1\Lesson10;

use Intervolga\Edu\Asserts\Assert;
use Intervolga\Edu\Asserts\AssertComponent;
use Intervolga\Edu\Locator\Component\SearchForm;
use Intervolga\Edu\Tests\BaseTest;
use Intervolga\Edu\Util\ComponentParameters;
use Intervolga\Edu\Util\Regex;
Expand All @@ -10,7 +12,8 @@ class TestSearchAction extends BaseTest
{
protected static function run()
{
$parameters = ComponentParameters::getComponentParameters('bitrix:search.form');
AssertComponent::componentLocator(SearchForm::class);
$parameters = SearchForm::find()['PARAMETERS'];
Assert::notEmpty($parameters['PAGE']);
Assert::notMatches(
$parameters['PAGE'],
Expand Down
17 changes: 13 additions & 4 deletions lib/tests/course1/lesson2/testpromo.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
<?php
namespace Intervolga\Edu\Tests\Course1\Lesson2;

use Bitrix\Main\Localization\Loc;
use Intervolga\Edu\Asserts\Assert;
use Intervolga\Edu\Locator\IO\PromoSection;
use Intervolga\Edu\Tests\BaseTest;
use Intervolga\Edu\Util\Menu;

class TestPromo extends BaseTest
{
protected static function run()
{
Assert::directoryLocator(PromoSection::class);
}
protected static function run()
{
Assert::directoryLocator(PromoSection::class);

$links = Menu::getMenuLinks('/.top.menu.php', true);
Assert::notEmpty(
$links[PromoSection::find()->getName()],
Loc::getMessage('INTERVOLGA_EDU.COURSE_1_LESSON_2_NOT_FOUND_PROMO_IN_MENU',
['#PROMO_NAME#' => PromoSection::find()->getName(),])
);
}
}
4 changes: 2 additions & 2 deletions lib/tests/course1/lesson7/testmenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ protected static function run()
Loc::getMessage('INTERVOLGA_EDU.ASSERT_COMPONENT_PARAMETERS_CACHE_TYPE',
[
'#COMPONENT#' => static::getLocator()::getPossibleTips(),
'#TEMPLATE#' => $component['PARAMETERS']['COMPONENT_TEMPLATE'],
'#TEMPLATE#' => $component['PARAMETERS']['COMPONENT_TEMPLATE']?:'.default',
'#PATH#' => $component['REAL_PATH'],
]
)
Expand All @@ -38,7 +38,7 @@ protected static function run()
Loc::getMessage('INTERVOLGA_EDU.ASSERT_COMPONENT_PARAMETERS_CACHE_GROUPS',
[
'#COMPONENT#' => static::getLocator()::getPossibleTips(),
'#TEMPLATE#' => $component['PARAMETERS']['COMPONENT_TEMPLATE'],
'#TEMPLATE#' => $component['PARAMETERS']['COMPONENT_TEMPLATE']?:'.default',
'#PATH#' => $component['REAL_PATH'],
]
)
Expand Down
5 changes: 3 additions & 2 deletions lib/tests/course2/lesson8/testsettingresultlinks.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,10 @@ protected static function getGadgetUrls($formId, &$todayLinkIndex, &$allLinkInde
$page = ob_get_contents();
ob_clean();

preg_match_all('/href="[\w\s\d\=\'"\/_\.\?&;\-\#\$\%\^:]*\>/iu', $page, $matches, PREG_SET_ORDER);
$page = preg_replace('/\s*/', '', $page);
preg_match_all('/href=("|\')[\w\d=\/_.?&;\-#]*("|\')/iu', $page, $matches, PREG_SET_ORDER);
foreach ($matches as $match) {
$urls[] = mb_strcut($match[0], strpos($match[0], '"') + 1, -2);
$urls[] = mb_strcut(trim($match[0]), 6, -1);
}

if (strpos($urls[1], 'find_date_create_1')) {
Expand Down
50 changes: 50 additions & 0 deletions lib/tests/course3/lesson3/testpropertycode.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php
namespace Intervolga\Edu\Tests\Course3\Lesson3;

use Intervolga\Edu\Asserts\Assert;
use Intervolga\Edu\Locator\IO\ComponentTemplate\RespondentTemplate;
use Intervolga\Edu\Locator\IO\CustomRespondents;
use Intervolga\Edu\Locator\IO\DirectoryLocator;
use Intervolga\Edu\Tests\BaseTest;
use Intervolga\Edu\Util\Regex;

class TestPropertyCode extends BaseTest
{
public static function interceptErrors()
{
return true;
}

protected static function run()
{
static::checkComponentFile(CustomRespondents::class);
static::checkTemplate(RespondentTemplate::class);
}

/**
* @param DirectoryLocator|string $dirComponent
*/
protected static function checkComponentFile($dirComponent)
{
Assert::directoryLocator($dirComponent);
$file = $dirComponent::getComponentFile();
Assert::fileContentNotMatches($file,
new Regex('/(\'|")(SALARY|GENDER|AGE)(\'|")/i', '\'SALARY\', \'GENDER\', \'AGE\''));
}

/**
* @param DirectoryLocator|string $dirTemplate
*/
protected static function checkTemplate($dirTemplate)
{
Assert::directoryLocator($dirTemplate);
$directory = $dirTemplate::find();

foreach ($directory->getChildren() as $child) {
if ($child->isFile()) {
Assert::fileContentNotMatches($child,
new Regex('/(\'|")(SALARY|GENDER|AGE)(\'|")/i', '\'SALARY\', \'GENDER\', \'AGE\''));
}
}
}
}
4 changes: 3 additions & 1 deletion lib/tests/course3/lesson3/testresultspollingiblock.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
namespace Intervolga\Edu\Tests\Course3\Lesson3;

use Intervolga\Edu\Locator\Iblock\Property\AgePollResultProperty;
use Intervolga\Edu\Locator\Iblock\Property\ConnectRespondentProperty;
use Intervolga\Edu\Locator\Iblock\Property\GenderProperty;
use Intervolga\Edu\Locator\Iblock\Property\SalaryProperty;
Expand All @@ -24,7 +25,8 @@ protected static function getPropertiesLocators(): array
return [
SalaryProperty::class,
ConnectRespondentProperty::class,
GenderProperty::class
GenderProperty::class,
AgePollResultProperty::class
];
}

Expand Down
3 changes: 2 additions & 1 deletion lib/util/help.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public static function get(string $course, string $lesson): string
protected static function convertFrom1251Possible(string $text): string
{
$isMarketplaceInstallation = (IV_EDU_MODULE_DIR == '/bitrix/modules/intervolga.edu');
if ($isMarketplaceInstallation)

if ($isMarketplaceInstallation && mb_detect_encoding($text) !== 'UTF-8')
{
$text = iconv('cp1251', 'UTF8', $text);
}
Expand Down
15 changes: 13 additions & 2 deletions lib/util/updatesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,20 @@ public static function getStatus()
static::$updateStatus = static::getUpdatesList();
}

try {
$license = static::$updateStatus['CLIENT'][0]['@']['LICENSE'];
} catch (\Throwable $throw) {
$license = $throw->getMessage().'<br>'.$throw->getFile().' '.$throw->getLine();
}
try {
$modules = static::$updateStatus['MODULES'][0]['#'] ? static::$updateStatus['MODULES'][0]['#']['MODULE'] : [];
} catch (\Throwable $throw) {
$modules = $throw->getMessage().'<br>'.$throw->getFile().' '.$throw->getLine();
}

return [
'LICENSE' => static::$updateStatus['CLIENT'][0]['@']['LICENSE'],
'MODULES' => static::$updateStatus['MODULES'][0]['#']['MODULE'] ?: [],
'LICENSE' => $license,
'MODULES' => $modules,
];
}

Expand Down

0 comments on commit 48de177

Please sign in to comment.