Skip to content

Commit

Permalink
Setup dockunit for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
azizur committed Apr 21, 2016
1 parent c4edaf7 commit 7dc78f6
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 1 deletion.
35 changes: 35 additions & 0 deletions Dockunit.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"containers": [{
"prettyName": "PHP-FPM 7.0",
"image": "dockunit/prebuilt-images:php-mysql-phpunit-wordpress-7.0-rc-1-fpm",
"beforeScripts": [
"service mysql start",
"wp core download --path=/temp/wp --allow-root",
"wp core config --path=/temp/wp --dbname=test --dbuser=root --allow-root",
"wp core install --url=http://localhost --title=Test --admin_user=admin --admin_password=12345 [email protected] --path=/temp/wp --allow-root",
"mkdir /temp/wp/wp-content/plugins/arabic-ligature",
"cp -r . /temp/wp/wp-content/plugins/arabic-ligature"
],
"testCommand": "wp plugin activate arabic-ligature --allow-root --path=/temp/wp"
}, {
"prettyName": "PHP-FPM 5.6",
"image": "dockunit/prebuilt-images:php-mysql-phpunit-wordpress-5.6-fpm",
"beforeScripts": [
"service mysql start",
"wp core download --path=/temp/wp --allow-root",
"wp core config --path=/temp/wp --dbname=test --dbuser=root --allow-root",
"wp core install --url=http://localhost --title=Test --admin_user=admin --admin_password=12345 [email protected] --path=/temp/wp --allow-root",
"mkdir /temp/wp/wp-content/plugins/arabic-ligature",
"cp -r . /temp/wp/wp-content/plugins/arabic-ligature"
],
"testCommand": "wp plugin activate arabic-ligature --allow-root --path=/temp/wp"
}, {
"prettyName": "PHP-FPM 5.2",
"image": "dockunit/prebuilt-images:php-mysql-phpunit-wordpress-5.2-fpm",
"beforeScripts": [
"service mysql start",
"wp-install latest"
],
"testCommand": "wp-activate-plugin arabic-ligature.php"
}]
}
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,20 @@ Supported Short Codes:
| [salaam]<br />[sallam] | &#1575;&#1604;&#1587;&#1604;&#1575;&#1605; &#1593;&#1604;&#1610;&#1603;&#1605; | &#1575;&#1604;&#1587;&#1604;&#1575;&#1605; &#1593;&#1604;&#1610;&#1603;&#1605; | As-salamu alaykum | Peace be upon you |
| [wasalaam]<br />[wasallam]<br />[waalaykumu] | &#1608;&#1593;&#1604;&#1610;&#1603;&#1605; &#1575;&#1604;&#1587;&#1604;&#1575;&#1605; | &#1608;&#1593;&#1604;&#1610;&#1603;&#1605; &#1575;&#1604;&#1587;&#1604;&#1575;&#1605; | Wa ‘alaykum al-salaam | And unto you peace |
| [allah] | &#65010; | &#65010; | Allāh | Allah (God) |
| [swt]<br />[jallajalaluh]<br />[jallajalalouhou] | &#xFDFB; | &#1587;&#1576;&#1581;&#1575;&#1606;&#1607; &#1608; &#1578;&#1593;&#1575;&#1604;&#1609; | Jalla Jalāluhu | May He be Glorified and Exalted |
| [swt]<br />[jallajalaluh]<br />[jallajalalouhou] | &#xFDFB; | &#1587;&#1576;&#1581;&#1575;&#1606;&#1607; &#1608; &#1578;&#1593;&#1575;&#1604;&#1609; | Jalla Jalāluhu | May He be Glorified and Exalted |


# Development

## Unit Testing

install Dockunit:

```
npm install -g dockunit
```

Run tests
```
dockunit --du-verbose
```
13 changes: 13 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<phpunit
bootstrap="tests/bootstrap.php"
backupGlobals="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true">
<testsuites>
<testsuite>
<directory prefix="test-" suffix=".php">./tests/</directory>
</testsuite>
</testsuites>
</phpunit>
9 changes: 9 additions & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
$_tests_dir = getenv('WP_TESTS_DIR');
if ( !$_tests_dir ) $_tests_dir = '/temp/wp/wordpress-tests-lib';
require_once $_tests_dir . '/includes/functions.php';
function _manually_load_plugin() {
require dirname( __FILE__ ) . '/../arabic-ligature.php';
}
tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );
require $_tests_dir . '/includes/bootstrap.php';

0 comments on commit 7dc78f6

Please sign in to comment.