Skip to content

PHPUnit テスト基盤の導入#159

Draft
tanakakc wants to merge 17 commits into
masterfrom
feature/add-phpunit-tests
Draft

PHPUnit テスト基盤の導入#159
tanakakc wants to merge 17 commits into
masterfrom
feature/add-phpunit-tests

Conversation

@tanakakc

@tanakakc tanakakc commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

概要

PHPUnitテスト基盤を導入し、QHM固有のクラス・プラグインのテストを追加

対応予定 - QHM独自プラグイン (199件)

PukiWikiに存在しないQHM独自のプラグイン

一覧を表示
  • absplit.inc.php
  • absplit2.inc.php
  • accordion.inc.php
  • addacc.inc.php
  • addfavorite.inc.php
  • addgoogle.inc.php
  • addyahoo.inc.php
  • atom.inc.php
  • attachref.inc.php
  • audio.inc.php
  • autoclose.inc.php
  • beforescript.inc.php
  • blog_body.inc.php
  • blog_comment.inc.php
  • blog_edit.inc.php
  • blog_more.inc.php
  • blog_rss.inc.php
  • blog_viewer.inc.php
  • blog.inc.php
  • box.inc.php
  • bs_accordion.inc.php
  • bs_box.inc.php
  • bs_carousel.inc.php
  • bs_nav.inc.php
  • bs_tabs.inc.php
  • bugtrack_list.inc.php
  • button.inc.php
  • calendar_edit.inc.php
  • calendar_read.inc.php
  • calendar_viewer.inc.php
  • canonical.inc.php
  • check_login.inc.php
  • checkagree.inc.php
  • chpassword.inc.php
  • close.inc.php
  • cols.inc.php
  • comment2.inc.php
  • commu_auth_return.inc.php
  • commu_auth.inc.php
  • commu_html.inc.php
  • commu_info.inc.php
  • commu_logout.inc.php
  • commu_qform.inc.php
  • commu_value.inc.php
  • contentsx.inc.php
  • conversion_r.inc.php
  • conversion.inc.php
  • convert_haik.inc.php
  • deco.inc.php
  • delete.inc.php
  • description.inc.php
  • dlbutton.inc.php
  • dllink.inc.php
  • dump2.inc.php
  • dwrite.inc.php
  • edit_this.inc.php
  • editacc.inc.php
  • enable_cache.inc.php
  • enable_jquery.inc.php
  • equal_navi.inc.php
  • eucjp.inc.php
  • eyecatch.inc.php
  • fb_comments.inc.php
  • fb_likebox.inc.php
  • fb_likebutton.inc.php
  • fb_likegate.inc.php
  • fb_page.inc.php
  • fb_pagebox.inc.php
  • fb_recommends.inc.php
  • fb_root.inc.php
  • flash.inc.php
  • footer.inc.php
  • formzu.inc.php
  • formzup.inc.php
  • ga_link.inc.php
  • ganatracker.inc.php
  • ganatracker2.inc.php
  • gmap.inc.php
  • gmapfun.inc.php
  • googlemaps2_draw.inc.php
  • googlemaps2_icon.inc.php
  • googlemaps2_insertmarker.inc.php
  • googlemaps2_mark.inc.php
  • googlemaps2.inc.php
  • gp_button.inc.php
  • greybox.inc.php
  • gsearch.inc.php
  • header.inc.php
  • html.inc.php
  • html2.inc.php
  • icon.inc.php
  • iframe.inc.php
  • include_skin.inc.php
  • include_template.inc.php
  • insert_mark.inc.php
  • jplayer.inc.php
  • keywords.inc.php
  • label.inc.php
  • lastscript.inc.php
  • layout.inc.php
  • lightbox2.inc.php
  • listbox.inc.php
  • logo_image.inc.php
  • lsx.inc.php
  • mag2.inc.php
  • main_visual.inc.php
  • media_list.inc.php
  • menu2.inc.php
  • mobaccess.inc.php
  • modoru.inc.php
  • mp3play.inc.php
  • nav.inc.php
  • nav2.inc.php
  • noeyecatch.inc.php
  • nonav.inc.php
  • nowindow.inc.php
  • ogp.inc.php
  • only_mobile.inc.php
  • only_pc.inc.php
  • otherwin.inc.php
  • panel.inc.php
  • permalink.inc.php
  • pkwkmail_en.inc.php
  • pkwkmail.inc.php
  • playlist.inc.php
  • playvideo.inc.php
  • pp_button.inc.php
  • pp_cart.inc.php
  • prevnext.inc.php
  • progress_bar.inc.php
  • qblog_archives.inc.php
  • qblog_category.inc.php
  • qblog_comment.inc.php
  • qblog_foot.inc.php
  • qblog_head.inc.php
  • qblog_list.inc.php
  • qblog_recent_comments.inc.php
  • qblog_recent.inc.php
  • qblog_rss.inc.php
  • qblog.inc.php
  • qcart.inc.php
  • qform_view.inc.php
  • qform.inc.php
  • qhmauth.inc.php
  • qhmlogout.inc.php
  • qhmpw.inc.php
  • qhmsetting.inc.php
  • qlg.inc.php
  • qms_cart.inc.php
  • qp_button.inc.php
  • qp_cart.inc.php
  • qp_here.inc.php
  • qr.inc.php
  • read_url.inc.php
  • redirect_iframe.inc.php
  • redirect.inc.php
  • ref2.inc.php
  • referer.inc.php
  • scrollbox.inc.php
  • scrollup.inc.php
  • search_menu.inc.php
  • secedit.inc.php
  • secret.inc.php
  • section.inc.php
  • select_fsize.inc.php
  • share_buttons.inc.php
  • shiftjis.inc.php
  • show.inc.php
  • sitemap.inc.php
  • skin_customizer.inc.php
  • slides.inc.php
  • slideshow.inc.php
  • social_buttons.inc.php
  • ssl.inc.php
  • style.inc.php
  • style2.inc.php
  • system_updater.inc.php
  • tabbox.inc.php
  • tag.inc.php
  • tagcloud.inc.php
  • taglist.inc.php
  • tb.inc.php
  • tel.inc.php
  • theme_config.inc.php
  • theme_uploader.inc.php
  • thumbnails.inc.php
  • tracker_list.inc.php
  • tw_button.inc.php
  • tweet.inc.php
  • u2b.inc.php
  • uname.inc.php
  • underline.inc.php
  • update_tinycode.inc.php
  • use_smart.inc.php
  • utf8.inc.php
  • video.inc.php
  • vimeo.inc.php
  • votex.inc.php
  • yahoobookmark.inc.php

対応予定 - QHM拡張プラグイン (63件)

PukiWiki標準プラグインにQHMが機能拡張を加えたもの (get_qm/get_qt/ss_admin使用、または機能追加)

一覧を表示
  • add.inc.php
  • amazon.inc.php
  • aname.inc.php
  • article.inc.php
  • attach.inc.php
  • back.inc.php
  • backup.inc.php
  • br.inc.php (margin/ID追加)
  • bugtrack.inc.php
  • calendar.inc.php
  • calendar2.inc.php
  • color.inc.php
  • comment.inc.php
  • contents.inc.php
  • counter.inc.php
  • deleted.inc.php
  • diff.inc.php
  • dump.inc.php
  • edit.inc.php
  • external_link.inc.php
  • filelist.inc.php
  • freeze.inc.php
  • hr.inc.php (画像HR対応)
  • img.inc.php
  • include.inc.php
  • insert.inc.php
  • interwiki.inc.php
  • links.inc.php
  • list.inc.php
  • lookup.inc.php
  • ls.inc.php
  • ls2.inc.php
  • map.inc.php
  • md5.inc.php
  • memo.inc.php
  • menu.inc.php
  • navi.inc.php
  • new.inc.php
  • newpage.inc.php
  • online.inc.php
  • paint.inc.php
  • pcomment.inc.php
  • popular.inc.php
  • random.inc.php
  • read.inc.php
  • recent.inc.php
  • ref.inc.php
  • related.inc.php
  • rename.inc.php
  • rss.inc.php
  • ruby.inc.php
  • search.inc.php
  • search2.inc.php
  • server.inc.php
  • setlinebreak.inc.php
  • showrss.inc.php
  • size.inc.php
  • source.inc.php
  • template.inc.php
  • tracker.inc.php
  • versionlist.inc.php
  • vote.inc.php
  • yetlist.inc.php

対応不要 - PukiWikiバージョン差異のみ (8件)

機能拡張なし、API差異のみ

  • includesubmenu.inc.php
  • nofollow.inc.php
  • rss10.inc.php
  • stationary.inc.php
  • topicpath.inc.php
  • touchgraph.inc.php
  • unfreeze.inc.php
  • update_entities.inc.php

対応不要 - PukiWiki標準のまま (4件)

PukiWikiから変更されていないプラグイン

  • clear.inc.php
  • lastmod.inc.php
  • norelated.inc.php
  • version.inc.php

保留

  • lib/qhm_init.php(スクリプト形式、グローバル変数依存)
  • lib/qhm_init_main.php(スクリプト形式、グローバル変数依存)
  • lib/qhm_init_killer.php(スクリプト形式、グローバル変数依存)

※ PukiWiki https://github.com/pukiwiki/pukiwiki との実ファイル比較に基づく分類

🤖 Generated with Claude Code

tanakakc and others added 8 commits December 19, 2025 03:10
- PHP 7.4 CLI with Composer 2
- VS Code extensions: Intelephense, Xdebug

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add PHPUnit 9.6 as dev dependency
- Configure phpunit.xml for test suite
- Add bootstrap.php for test initialization

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Test coverage for:
- h() / h_decode(): HTML escaping and decoding
- is_image(): Image file detection
- get_mimetype(): MIME type detection
- wrap_script_tag(): JavaScript wrapping
- is_url(): URL validation with protocol options
- wikiescape(): Dangerous wiki tag escaping
- get_bs_style(): Bootstrap class generation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Run PHPUnit tests on PHP 7.3 and 7.4
- Trigger on push to master/feature/* and PRs to master
- Cache Composer dependencies for faster builds

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Use PHP 7.4 only (matches composer.lock)
- Run on push to master and PRs only (avoid duplicate runs)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Migrating to GitHub Actions for CI/CD.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Trigger on version tags (v*)
- Run tests before release
- Build update package (excluding dev files and user data)
- Create GitHub Release with update zip

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Test coverage for:
- Singleton pattern (get_instance)
- Value storage (setv/getv, setv_once)
- Value manipulation (appendv, prependv)
- One-time operations (appendv_once, prependv_once)
- Template syntax conversion (convert_php)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@tanakakc tanakakc self-assigned this Dec 18, 2025
tanakakc and others added 9 commits December 20, 2025 10:21
- Add tests for clear, br, underline plugins
- Move require_once to setUpBeforeClass in each test file
- Simplify bootstrap.php to common constants only
- Move qhm_template specific constants to QHMTemplateTest

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add 28 tests for plugin/button.inc.php covering:
  - Button types (primary, danger, success, warning, info, link)
  - Button sizes (large, small, mini, xs)
  - Button styles (block, round, gradient, ghost)
  - URL and page link handling with is_page() integration
  - XSS protection for href and target attributes
- Update bootstrap.php with DATA_DIR and global variables
  ($BracketName, $InterWikiName) required for is_pagename()

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Ignore test data directory used for temporary wiki pages during testing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Each test file now includes a header comment specifying:
- The target file being tested
- The functions/classes covered by @Covers annotation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add error_reporting(E_ALL) to bootstrap.php to show all PHP notices
- Configure phpunit.xml to not convert notices/warnings/deprecations to exceptions
- Keeps tests passing while making PHP issues visible in output

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Define CACHE_DIR once in bootstrap.php to avoid duplicate definition
- Remove CACHE_DIR definitions from individual test files
- Add defined() checks for CONTENT_CHARSET and TEMPLATE_ENCODE

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Test QHM-specific extension of PukiWiki's ruby plugin:
- Error message retrieval via get_qm() message system

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant