Когда: Каждый Pull Request
Цель: Проверить что компоненты работают вместе
ℹ️ Bootstrap Barrio подключает Bootstrap 5 CSS/JS через Drupal libraries.
ideal_theme использует plain CSS (tokens.css, global.css, ...) — нет npm build step.
Проверка CSS файлов:
# Проверить что все CSS файлы из THEME-SPEC существуют
for f in tokens.css global.css product.css catalog.css cart.css; do
[ -f web/themes/custom/ideal_theme/css/$f ] && echo "✅ $f" || echo "❌ $f MISSING"
done
Проверка JS файлов:
for f in cart-ajax.js filters.js delivery-progress.js; do
[ -f web/themes/custom/ideal_theme/js/$f ] && echo "✅ $f" || echo "❌ $f MISSING"
done
Валидация YAML:
# Проверка конфигов
yamllint ideal_theme.info.yml
yamllint ideal_theme.libraries.yml
# Ожидаемый результат:
# ✅ Синтаксис корректен
# ✅ Все ключи на месте
SDC компоненты рендерятся:
// tests/integration/components.test.php
class ComponentsTest extends TestCase {
public function testHeaderComponentRenders() {
$component = \Drupal::service('plugin.manager.sdc')
->createInstance('ideal_theme:header');
$build = $component->build([]);
$output = \Drupal::service('renderer')->renderRoot($build);
$this->assertStringContainsString('<header', $output);
$this->assertStringContainsString('class="header"', $output);
}
}
Twig шаблоны подключаются:
public function testPageTemplateExists() {
$theme_path = \Drupal::service('extension.list.theme')
->getPath('ideal_theme');
$this->assertFileExists($theme_path . '/templates/layout/page.html.twig');
}
CSS/JS библиотеки загружаются:
public function testLibrariesDefined() {
$libraries = \Drupal::service('library.discovery')
->getLibrariesByExtension('ideal_theme');
$this->assertArrayHasKey('global-styling', $libraries);
$this->assertArrayHasKey('commerce', $libraries);
}
Тема устанавливается:
# CI/CD pipeline
drush theme:install ideal_theme
drush config:set system.theme default ideal_theme -y
drush cr
# Проверка
drush theme:list | grep ideal_theme
# Ожидаемый вывод: ideal_theme (default theme)
Все зависимости найдены:
# Проверка зависимостей
drush pm:list --type=module --status=enabled
# Проверить что установлены:
# ✅ commerce
# ✅ facets
# ✅ search_api
# ✅ pathauto
Конфиги применяются:
# Импорт конфигов
drush config:import --source=config/sync -y
# Проверка
drush config:get system.theme default
# Ожидаемый вывод: ideal_theme
ℹ️ Используем self-hosted runner (Gitea Actions / GitLab CI / локальный скрипт).
GitHub Actions — иностранный SaaS, не используем для продакшн-проектов.
Локальный скрипт .ci/integration.sh:
#!/bin/bash
set -e
echo "=== Integration Test ==="
# 1. Проверка файлов темы
for f in css/tokens.css css/global.css js/cart-ajax.js; do
[ -f "web/themes/custom/ideal_theme/$f" ] || { echo "❌ Missing: $f"; exit 1; }
done
echo "✅ Theme files exist"
# 2. PHP syntax check
find web/themes/custom/ideal_theme -name "*.php" -o -name "*.theme" 2>/dev/null | \
xargs -r php -l
echo "✅ PHP syntax OK"
# 3. YAML валидация
find web/themes/custom/ideal_theme -name "*.yml" | \
xargs -I{} php -r "if(!yaml_parse(file_get_contents('{}'))) exit(1);"
echo "✅ YAML syntax OK"
# 4. Установить Drupal CMS (если не установлен)
if [ ! -f web/index.php ]; then
composer create-project drupal/cms . --no-interaction
fi
# 5. Установить Drupal
vendor/bin/drush site:install standard --db-url=sqlite://db.sqlite \
--site-name="Ideal Shop Test" --account-pass=admin -y
# 6. Включить тему
vendor/bin/drush theme:install bootstrap_barrio ideal_theme -y
vendor/bin/drush config:set system.theme default ideal_theme -y
vendor/bin/drush cr
# 7. Проверить тему
vendor/bin/drush theme:list | grep "ideal_theme (default theme)"
echo "✅ Theme active"
# 8. Тест страниц
vendor/bin/drush runserver 127.0.0.1:8080 &
sleep 3
curl -sf http://127.0.0.1:8080/ > /dev/null
echo "✅ Homepage HTTP 200"
echo "=== PASSED ==="
При каждом PR проверяется:
✅ Сборка проходит
- CSS компилируется
- JS минифицируется
- Нет ошибок
✅ Тема устанавливается
- Drupal site:install успешен
- Тема включается без ошибок
- Конфиги применяются
✅ Страницы рендерятся
- Главная страница: HTTP 200
- Базовые страницы доступны
- Нет PHP errors
✅ Компоненты работают
- SDC компоненты находятся
- Twig шаблоны рендерятся
- CSS/JS загружаются
Перед созданием PR:
# 1. Сборка
npm run build
# 2. Тест установки
./scripts/test-install.sh
# 3. Проверка компонентов
composer run test:integration
# 4. Проверка страниц
curl http://localhost:8080/
curl http://localhost:8080/catalog
curl http://localhost:8080/product/1
# Все должны вернуть HTTP 200
#!/bin/bash
set -e
echo "🔧 Testing theme installation..."
# 1. Создать временный Drupal
mkdir -p /tmp/drupal-test
cd /tmp/drupal-test
composer create-project drupal/cms . --no-interaction
# 2. Скопировать тему
cp -r $OLDPWD web/themes/custom/ideal_theme
# 3. Установить Drupal
vendor/bin/drush site:install standard \
--db-url=sqlite://db.sqlite \
--site-name="Test Site" \
--account-pass=admin \
-y
# 4. Включить тему
vendor/bin/drush theme:install ideal_theme -y
vendor/bin/drush config:set system.theme default ideal_theme -y
vendor/bin/drush cr
# 5. Проверить
vendor/bin/drush theme:list | grep "ideal_theme (default theme)" || exit 1
# 6. Тест рендеринга
vendor/bin/drush runserver 127.0.0.1:8888 &
SERVER_PID=$!
sleep 3
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:8888/)
kill $SERVER_PID
if [ "$HTTP_CODE" = "200" ]; then
echo "✅ Theme installation successful!"
exit 0
else
echo "❌ Theme installation failed! HTTP $HTTP_CODE"
exit 1
fi
Требования:
- ✅ Сборка: успешна
- ✅ Установка: без ошибок
- ✅ Все компоненты найдены
- ✅ Главная страница: HTTP 200
- ✅ Время установки: < 2 минуты
❌ Пошаговая установка рецептов (Стратегия 3)
❌ Различные конфигурации (Стратегия 4)
❌ Старые браузеры (Стратегия 4)
❌ Визуальные регрессии (Стратегия 4)
После прохождения Integration Testing → Стратегия 3: Deployment Testing
Статус: Готово к использованию
Дата: 2026-01-07