<commit_before># Installing PHPUnit
 
You will need to install PHPUnit (version 3.6.10 or later) and DbUnit
 
```
sudo pear config-set auto_discover 1
sudo pear install pear.phpunit.de/PHPUnit
sudo pear install phpunit/DbUnit
```
 
See the [official manual](http://www.phpunit.de/manual/current/en/installation.html#installation.pear) for more details.
 
# Configuring the test environment
 
1. In the `tests/phpunit` directory, copy `sample.phpunit.xml` to `phpunit.xml`. 
2. Set up a new Ilios database `ilios_test` using the scripts in the `/database/install` directory.
3. Edit `phpunit.xml` to customize it for your environment.   
Note that the value for `ILIOS2_TEST_DB_ACTIVE_GROUP` will be the name of a new DB group that you will create in the next step.
```xml
<!--  name of the CI db group configuration which should be used for testing -->
<const name="ILIOS2_TEST_DB_ACTIVE_GROUP" value="ilios_test" />
```

4. Add a new DB group named `ilios_test` to your `application/config/database.php` file. Point it to the new `ilios_test` database that you created earlier, then set `$active_group` to `ilios_test`.
 
```php
<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');

$active_group = "ilios_test";
$active_record = TRUE;

$db['ilios_test']['hostname'] = 'localhost';
$db['ilios_test']['username'] = 'ilios_user';<commit_msg>fixed name of default php unit configuration file in the setup instructions.<commit_after># Installing PHPUnit
 
You will need to install PHPUnit (version 3.6.10 or later) and DbUnit
 
```
sudo pear config-set auto_discover 1
sudo pear install pear.phpunit.de/PHPUnit
sudo pear install phpunit/DbUnit
```
 
See the [official manual](http://www.phpunit.de/manual/current/en/installation.html#installation.pear) for more details.
 
# Configuring the test environment
 
1. In the `tests/phpunit` directory, copy `default.phpunit.xml` to `phpunit.xml`. 
2. Set up a new Ilios database `ilios_test` using the scripts in the `/database/install` directory.
3. Edit `phpunit.xml` to customize it for your environment.   
Note that the value for `ILIOS2_TEST_DB_ACTIVE_GROUP` will be the name of a new DB group that you will create in the next step.
```xml
<!--  name of the CI db group configuration which should be used for testing -->
<const name="ILIOS2_TEST_DB_ACTIVE_GROUP" value="ilios_test" />
```

4. Add a new DB group named `ilios_test` to your `application/config/database.php` file. Point it to the new `ilios_test` database that you created earlier, then set `$active_group` to `ilios_test`.
 
```php
<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');

$active_group = "ilios_test";
$active_record = TRUE;

$db['ilios_test']['hostname'] = 'localhost';
$db['ilios_test']['username'] = 'ilios_user';
{'fraction_non_alphanumeric': 0.1129842180774749, 'fraction_numerical': 0.007890961262553802, 'mean_word_length': 4.846960167714885, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6166023', 'n_tokens_mistral': 907, 'n_tokens_neox': 865, 'n_words': 324}