Skip to content
This repository

Adding test execution instructions #194

Merged
merged 1 commit into from over 2 years ago

2 participants

ianmacl Andrew Eddie
ianmacl
Owner

Basic instructions on running phpunit and phpcs.

Andrew Eddie eddieajau merged commit 86aee55 into from August 07, 2011
Andrew Eddie eddieajau closed this August 07, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Aug 07, 2011
ianmacl Adding test execution instructions f3d95ca
This page is out of date. Refresh to see the latest.
102  docs/manual/appendices/analysis.xml
... ...
@@ -0,0 +1,102 @@
  1
+<?xml version="1.0" encoding="utf-8"?>
  2
+<appendix xml:id="app1">
  3
+	<title>Configuring Code Analysis Tools</title>
  4
+
  5
+	<sect1>
  6
+		<title>Running Unit Tests</title>
  7
+
  8
+		<para>Before code gets pulled into the master repository, the unit testing suite is run to
  9
+		ensure that the change candidates to not leave trunk in an unstable state (i.e. all tests
  10
+		should pass at all times). In order to make the process of getting your code accepted it
  11
+		is helpful to run these tests locally to prevent any unexpected surprises.</para>
  12
+		
  13
+		<para>The Joomla Platform unit tests are developed for use with PHPUnit 3.5, which is the
  14
+		latest stable version as of August 2011. Please see the
  15
+		<link href="http://www.phpunit.de/manual/3.5/en/installation.html">PHPUnit Manual</link> for
  16
+		information on installing PHPUnit on your system.</para>
  17
+		
  18
+		<sect2>
  19
+			<title>Configuring Your Environment</title>
  20
+			
  21
+			<para>At this point in time you will get a bunch of failed unit tests if you attempt to execute
  22
+			them without first creating a database, populating it, and configuring the unit tests to be able
  23
+			to locate the correct database using the correct user.</para>
  24
+			
  25
+			<para>To do this, perform the following steps:</para>
  26
+			
  27
+			<itemizedlist>
  28
+				<listitem>
  29
+					<para>Create a database and a database user with full access to the database.</para>
  30
+				</listitem>
  31
+				
  32
+				<listitem>
  33
+					<para>Populate the database by executing the ddl.sql file found in the tests directory.</para>
  34
+				</listitem>
  35
+				
  36
+				<listitem>
  37
+					<para>Copy the config.php-dist file to config.php (in the tests directory) and edit the host, user,
  38
+					password and db values as appropriate (this step can be skipped if your database is on localhost,
  39
+					is named joomla_ut, your user is named utuser and the password is ut1234.</para>
  40
+				</listitem>
  41
+				
  42
+			</itemizedlist>
  43
+
  44
+		</sect2>
  45
+
  46
+		<sect2>
  47
+			<title>Running the Tests</title>
  48
+			
  49
+			<para>You can run the tests by going to the platform root directory and executing <command>phpunit</command></para>
  50
+			
  51
+		</sect2>
  52
+		
  53
+		<sect2>
  54
+			<title>Known Issues</title>
  55
+			
  56
+			<itemizedlist>
  57
+				<listitem>
  58
+					<para>There is currently a cache test that will fail the first time you run the tests. If you run the tests a
  59
+					second time it should pass.</para>
  60
+				</listitem>
  61
+				
  62
+			</itemizedlist>
  63
+			
  64
+		</sect2>
  65
+		
  66
+	</sect1>
  67
+	
  68
+	<sect1>
  69
+		<title>Coding Standards Analysis</title>
  70
+		
  71
+		<para>In order to improve the consistency and readability of the source code, we run a coding style analysis tool everytime
  72
+		changes are pushed in the repo. For new contributions we are going to be encorcing coding standards to ensure that the coding
  73
+		style in the source code is consistent. Ensuring that your code meets these standards will make the process of code contribution
  74
+		smoother.</para>
  75
+
  76
+		<para>The Joomla Platform sniffer rules are written to be used with a tool called PHP_CodeSniffer. Please see the
  77
+		<link href="http://pear.php.net/package/PHP_CodeSniffer">PHP_CodeSniffer Pear Page</link> for
  78
+		information on installing PHP_CodeSniffer on your system.</para>
  79
+
  80
+		<sect2>
  81
+			<title>Configuring Your Environment</title>
  82
+			
  83
+			<para>The Joomla project has written custom code sniffer rules for use with PHP_CodeSniffer. Unfortunately, these is a
  84
+			limitation in PHP_CodeSniffer which means that in order to use the custom rules they either have to be symlinked or copied into
  85
+			the PEAR directory.</para>
  86
+			
  87
+			<para>The build/phpcs/Joomla directory must be copied into CodeSniffer standards directory. On Ubuntu 11.04 this directory is
  88
+			<filename>/usr/share/php/PHP/CodeSniffer/Standards</filename>. On Macports this directory is
  89
+			<filename>/opt/local/lib/php/PHP/CodeSniffer/Standards</filename>. Other systems and configurations will vary.</para>
  90
+
  91
+		</sect2>
  92
+
  93
+		<sect2>
  94
+			<title>Running CodeSniffer</title>
  95
+			
  96
+			<para>You can run CodeSniffer by going to the platform root directory and executing
  97
+			<command>phpcs --report=checkstyle --report-file=build/logs/checkstyle.xml --standard=Joomla /path/to/platform</command></para>
  98
+
  99
+		</sect2>
  100
+
  101
+	</sect1>
  102
+</appendix>
2  docs/manual/book.xml
@@ -3,10 +3,12 @@
3 3
 <!DOCTYPE book [
4 4
 <!ENTITY pref SYSTEM "chapters/preface.xml">
5 5
 <!ENTITY app1 SYSTEM "appendices/changelog.xml">
  6
+<!ENTITY app2 SYSTEM "appendices/analysis.xml">
6 7
 ]>
7 8
 
8 9
 <book xmlns="http://docbook.org/ns/docbook" version="5.0">
9 10
 	<title>The Joomla! Platform Manual</title>
10 11
 &pref;
11 12
 &app1;
  13
+&app2;
12 14
 </book>
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.