xref: /template/strap/contrib.md (revision b9ba2b0ccaf700a13a933d81266d32458158896d)
1# Contrib
2
3
4
5## Main
6
7The main entrypoint is the [docustom.php action script](action/docustom.php). ie
8(ie a `do` custom action) that takes over action such as `show` (default).
9
10
11
12
13## Laptop Dev Installation Steps
14
15* Install php7.4 on debian with the [sury repo](https://github.com/oerdnj/deb.sury.org/wiki/Frequently-Asked-Questions#how-to-enable-the-debsuryorg-repository)
16* https://packages.sury.org/php/pool/main/p/php7.4/
17```bash
18curl -sSL https://packages.sury.org/php/README.txt | sudo bash -x
19sudo apt update
20sudo apt install -y php7.4 \
21  php7.4-mbstring \
22  php7.4-xml \
23  php7.4-gd \
24  php7.4-intl \
25  php7.4-xdebug \
26  php7.4-sqlite3
27# openssl not found
28which php7.4
29# ini
30cat /etc/php/7.4/cli/php.ini
31cat /etc/php/7.4/mods-available/xdebug.ini
32```
33
34* Clone Dokuwiki to get:
35  * the base DokuWikiTest class
36  * and `_test\phpunit.xml`
37```bash
38git clone https://github.com/dokuwiki/dokuwiki combo
39cd combo
40```
41* Clone Combo
42```bash
43cd lib/plugins/
44git clone git@github.com:ComboStrap/combo
45```
46* Intellij
47    * add it as registered root (Intellij> Version Control > Directory Mapping)
48    * Set it as source root
49* Clone the tests
50```bash
51cd combo
52git clone git@github.com:ComboStrap/combo_test.git _test
53```
54* Install phpunit
55```bash
56cd dokuwiki/_test
57composer install
58```
59
60### Intellij Php WSL
61
62
63Following [](https://www.jetbrains.com/help/phpstorm/how-to-use-wsl-development-environment-in-product.html#open-a-project-in-wsl)
64
65* Install the plugin PHP WSL Support
66* Add Php Cli Interpreter on WSL. Intellij > Settings > Php > Cli Interpreter
67* Firewall from an elevated PowerShell
68```powershell
69New-NetFirewallRule -DisplayName "WSL" -Direction Inbound  -InterfaceAlias "vEthernet (WSL (Hyper-V firewall))"  -Action Allow
70Get-NetFirewallProfile -Name Public | Get-NetFirewallRule | where DisplayName -ILike "IntelliJ IDEA*" | Disable-NetFirewallRule
71```
72* Intellij > Settings > Php > Test Framework
73```yaml
74Use_autoloader: combo\_test\vendor\autoload.php
75Use_default_configuration_file: combo/_test/phpunit.xml
76Use_default_bootstrap_file: combo/lib/plugins/combo/_test/bootstrap.php
77```
78* Intellij Test Runner Configuration
79```yaml
80Use_alternative_configuration_file: combo/_test/phpunit.xml
81Use_alternative_bootstrap_file: combo/lib/plugins/combo/_test/bootstrap.php
82Interpreter_cli: use wsl
83Interpreter_options: |
84    # put this ip if you are not in mirrored mode and intellij keep using 127.0.0.1
85    -dxdebug.client_host=$(echo $(ip route list default | awk '{print $3}'))
86```
87