Skip to content

Commit 4f540b1

Browse files
committed
add setup for unit test
1 parent f272f27 commit 4f540b1

File tree

3 files changed

+84
-1
lines changed

3 files changed

+84
-1
lines changed

docs/testing/automated/system/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ sidebar_position: 2
66
System Testing
77
===============
88

9-
We are using [Cypress](https://docs.cypress.io/guides/overview/why-cypress) for our system (end2end testing).
9+
We are using [Cypress](https://docs.cypress.io/guides/overview/why-cypress) for our system (end2end) testing.

docs/testing/automated/system/setup.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ You need a set of tools to have a good testing setup. Tools you should have:
1818
* Webserver (apache 2.4+, nginx 1.18+)
1919
* Editor (PhpStorm, Visual Studio Code)
2020

21+
:::note
22+
23+
This is the same toolset you need for unit testing
24+
25+
:::
2126

2227
## MAC OS
2328

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
---
2+
sidebar_position: 1
3+
---
4+
5+
6+
Setup your testing environment
7+
===============
8+
9+
## Prepare your Workstation
10+
11+
You need a set of tools to have a good testing setup. Tools you should have:
12+
13+
* git
14+
* node (16.16.0 is the current LTS)
15+
* database (mysql 5.6+, mariaDB 10.1+, postgres 11.0+)
16+
* PHP (good to have different versions and the ability to switch)
17+
* Composer, [Installation instructions here](https://getcomposer.org/doc/00-intro.md#installation-linux-unix-macos)
18+
* Webserver (apache 2.4+, nginx 1.18+) - **optional**
19+
* Editor (PhpStorm, Visual Studio Code)
20+
21+
:::note
22+
23+
This is pretty much the same toolset you need for system testing
24+
25+
:::
26+
27+
## MAC OS
28+
29+
As always there are different ways of installing the listed software. One way is the use of [Valet](https://laravel.com/docs/9.x/valet) in combination with [Homebrew](https://brew.sh/)
30+
31+
Now as you have all tools installed you can clone the [joomla-cms repository](https://github.com/joomla/joomla-cms).
32+
33+
1. Open a terminal
34+
2. Go into a directory on you workstation.
35+
3. clone the joomla-cms repository: ```git clone https://github.com/joomla/joomla-cms.git``` another option here is to fork the joomla-cms repo and then clone your fork. We recommend the 2nd way because then you can make changes and Pull Request directly.
36+
4. Go into the joomla-cms directory
37+
5. **Optional** - If you have installed valet, run ```valet link```
38+
5. Run ```composer install```
39+
6. Run ```npm ci```
40+
7. Copy ```phpunit.xml.dist``` file to ```phpunit.xml```. This file allows config setting for phpunit.
41+
42+
Here is a example ```phpunit.xml```
43+
44+
```xml
45+
<?xml version="1.0" encoding="UTF-8"?>
46+
<phpunit bootstrap="tests/Unit/bootstrap.php" colors="false">
47+
<testsuites>
48+
<testsuite name="Unit">
49+
<directory suffix="Test.php">./tests/Unit/Libraries</directory>
50+
</testsuite>
51+
<testsuite name="Integration">
52+
<directory suffix="Test.php">./tests/Integration/Libraries</directory>
53+
</testsuite>
54+
</testsuites>
55+
<php>
56+
<const name="JTEST_DB_ENGINE" value="mysqli" />
57+
<const name="JTEST_DB_HOST" value="mysql" />
58+
<const name="JTEST_DB_NAME" value="test_joomla" />
59+
<const name="JTEST_DB_USER" value="root" />
60+
<const name="JTEST_DB_PASSWORD" value="password" />
61+
</php>
62+
</phpunit>
63+
```
64+
65+
8. Run ```phpunit --testdox```
66+
67+
68+
69+
## Windows
70+
71+
72+
73+
74+
:::caution TODO
75+
76+
This page is unfinished, please use the **Edit this Page** link at the bottom of this page to help make it more useful.
77+
78+
:::

0 commit comments

Comments
 (0)