|
1 | 1 | ### Configuring Code Analysis Tools |
2 | 2 |
|
3 | | -#### Running Unit Tests |
4 | | - |
5 | | -Before code gets pulled into the master repository, the unit testing |
6 | | -suite is run to ensure that the change candidates do not leave trunk in |
7 | | -an unstable state (i.e. all tests should pass at all times). In order to |
8 | | -make the process of getting your code accepted it is helpful to run |
9 | | -these tests locally to prevent any unexpected surprises. |
10 | | - |
11 | | -The Joomla Platform unit tests are developed for use with PHPUnit 3.6, |
12 | | -which is the latest stable version as of August 2011. Please see the |
13 | | -[PHPUnit Manual](http://www.phpunit.de/manual/3.6/en/installation.html) |
14 | | -for information on installing PHPUnit on your system. |
15 | | - |
16 | | -##### Configuring Your Environment: The Database |
17 | | - |
18 | | -Standard unit tests run against a |
19 | | -[Sqlite](http://www.sqlite.org/quickstart.html) in memory database for |
20 | | -ease of setup and performance. Other than [installing |
21 | | -Sqlite](http://www.sqlite.org/quickstart.html) no manual intervention or |
22 | | -set up is required. The database is built at runtime and deleted when |
23 | | -finished. |
24 | | - |
25 | | -To run the specific database tests: |
26 | | - |
27 | | -- Create your database and use the appropriate database-specific DDL |
28 | | - located in tests/suites/database/stubs to create the database tables |
29 | | - required. |
30 | | - |
31 | | -- In the root directory, copy the file named phpunit.xml.dist, leaving |
32 | | - it in the same folder and naming it phpunit.xml. |
33 | | - |
34 | | -- Uncomment the php block and include the const line(s) related to the |
35 | | - database(s) you will be testing. |
36 | | - |
37 | | -- Set up the database configuration values for your specific |
38 | | - environment. |
39 | | - |
40 | | -##### Configuring Your Environment: The JHttpTransport Test Stubs |
41 | | - |
42 | | -There is a special stub that is required for testing the JHttp |
43 | | -transports so that actual web requests can be simulated and assertions |
44 | | -can be made about the results. To set these up, you'll need to do the |
45 | | -following: |
46 | | - |
47 | | -- In the root directory, copy the file named phpunit.xml.dist, leaving |
48 | | - it in the same folder and naming it phpunit.xml. |
49 | | - |
50 | | -- Uncomment the php block and include the "JTEST\_HTTP\_STUB" const. |
51 | | - |
52 | | -- The default file path for the const assumes that you have checked |
53 | | - out the Joomla Platform to the web root of your test environment |
54 | | - inside a folder named "joomla-platform". If this is not the case, |
55 | | - you can change the path to suit your environment and, if need be, |
56 | | - copy the file from its default location to be available within your |
57 | | - web environment. |
58 | | - |
59 | | -##### Running the Tests |
60 | | - |
61 | | -You can run the tests by going to the platform root directory and |
62 | | -executing `phpunit` |
63 | | - |
64 | | -Alternatively, if you have Ant installed on your system, you may run the |
65 | | -unit tests by going to the platform root directory and executing |
66 | | -`ant phpunit` to execute the tests on classes located under the |
67 | | -libraries/joomla directory or executing `ant phpunit-legacy` to execute |
68 | | -the tests on classes located under the libraries/legacy directory. |
69 | | - |
70 | 3 | #### Coding Standards Analysis |
71 | 4 |
|
72 | 5 | In order to improve the consistency and readability of the source code, |
|
0 commit comments