Ana içeriğe geç

Technical Guide & CI/CD Pipeline

Version PHP CI Updated

Purpose

This guide covers the development workflow, asset compilation, and the theme's testing infrastructure and CI/CD pipeline.

Development Workflow

The mhm-rentiva-theme is designed for performance and strict adherence to WordPress Coding Standards (WPCS).

Asset Yönetimi — 6 CSS Dosyası

Statik dosyalar /assets dizininde saklanir. v0.3.0 itibariyla CSS yigini 6 dosyadan olusur:

#DosyaAmac
1header.cssUst menu, mobil navigasyon overlay (koyu tema #101922).
23-layout.cssSayfa düzeni, content-wide modu, max-width: var(--wp--style--global--content-size, 1280px). @layer layout KALDIRILDI.
3components.cssKart, buton, badge gibi tekrar kullanilan UI bileşenleri.
4utilities.cssYardimci siniflar (spacing, visibility, typography).
5plugin-pages.cssEklenti sayfalarına ozel stil overridelari.
6elementor-compat.cssElementor uyumluluk katmani.
  • /assets/js: Hafif vanilla JS (ornegin mobil menu için header.js).
CSS Mimarisi Notu

3-layout.css dosyasında daha once kullanilan @layer layout v0.3.0 ile kaldirilmistir. Ayrica rv-trust-value sınıfına white-space: nowrap eklenmiştir (10.000+ istatistik karti fix).

Yükleme Mantigi

Tum asset'ler functions.php icerisinde mhm_rentiva_theme_enqueue_header_assets() üzerinden yüklenir:

wp_enqueue_style( 'mhm-theme-plugin-pages', $css_uri . 'plugin-pages.css', array(), $ver );
wp_enqueue_script( 'mhm-theme-header', $js_uri . 'header.js', array(), $ver, true );

Dependency Management

The theme uses Composer for development dependencies (PHPUnit, PHPCS) and npm/npx for asset minification (where applicable).

  • Install Dependencies: composer install

Testing Infrastructure

The theme includes a comprehensive PHPUnit test suite located in /tests.

Key Test Suites

Test SuiteFileResponsibility
Theme StructureThemeStructureTest.phpEnsures templates/, parts/, and theme.json exist.
Asset CheckAssetEnqueueTest.phpValidates correct enqueuing of CSS and JS.
PatternsPatternRegistrationTest.phpVerifies rentiva category and essential patterns.
TemplatesThemeTemplatesSemanticTest.phpEnsures key templates like single-vehicle.html are correct.

Running Tests Locally

Use the included phpunit.xml.dist configuration:

vendor/bin/phpunit

CI/CD Pipeline

The theme uses GitHub Actions (.github/workflows/ci.yml) for automated quality checks.

Workflow Stages

  1. PHP Lint: Checks for syntax errors across all versions.
  2. PHP Coding Standards (PHPCS): Validates adherence to WordPress-Core and WordPress-Extra.
  3. Unit Testing: Runs the complete PHPUnit suite in a headless WordPress environment.
  4. Build Check: Verifies theme.json schema validity.

Workflow Configuration

# Examples from .github/workflows/ci.yml
name: CI
on: [push, pull_request]
jobs:
phpcs:
runs-on: ubuntu-latest
steps:
- name: PHPCS Check
run: vendor/bin/phpcs --standard=phpcs.xml.dist .

Coding Standards

The theme follows these strict rules (as defined in phpcs.xml.dist):

  • declare(strict_types=1); mandatory for all PHP files.
  • No direct usage of extract().
  • Use of @since and @return tags in docblocks.
  • Prefixing all functions with mhm_rentiva_theme_.


DemoSeeder ve WP-CLI

DemoSeeder Hata Düzeltmeleri (v0.3.0)

v0.3.0 sürümünde DemoSeeder'da 7 hata düzeltildi. Bunlardan en önemlisi: add_booking_review() metodu artik testimonials shortcode'u ile tam uyumlu çalışmaktadir. Testimonials shortcode'u vehicle_booking post meta'dan (_mhm_rentiva_customer_review) okur, WP comment'lerden değil.

WP-CLI Sayfa Oluşturma

WordPress sayfalarınin WP-CLI ile olusturulmasi sırasında bash ! escaping sorunundan kacinmak için wp eval-file - heredoc yontemi kullanılır:

wp eval-file - <<'PHPEOF'
<?php
// Sayfa oluşturma kodu burada
wp_insert_post([
'post_title' => 'Araclar',
'post_name' => 'araclar',
'post_content' => '<!-- wp:shortcode -->[rentiva_vehicles_grid]<!-- /wp:shortcode -->',
'post_status' => 'publish',
'post_type' => 'page',
]);
PHPEOF

Değişiklik Günlüğü

TarihSürümNot
27.03.2026v0.3.0CSS yigini (6 dosya) detaylari, DemoSeeder düzeltmeleri, WP-CLI yontemi eklendi.
09.03.20264.21.0-docsGelistirme rehberi ve CI/CD dokumantasyonu oluşturuldu.