-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdeveloper.htm
executable file
·72 lines (61 loc) · 4.75 KB
/
developer.htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<!DOCTYPE html>
<html>
<head>
<title></title>
<link id="theme" rel="stylesheet" type="text/css" href="kodify/themes/cheery.css" />
<link id="theme" rel="stylesheet" type="text/css" href="style.css" />
<script type="text/javascript" src="kodify/js/lx_analyzer.js"></script>
<script type="text/javascript" src="kodify/js/kodify.js"></script>
<script type="text/javascript" src="kodify/js/lang/js.js"></script>
<script type="text/javascript" src="kodify/js/lang/php.js"></script>
<script type="text/javascript" src="kodify/js/lang/html.js"></script>
<script type="text/javascript" src="kodify/js/lang/css.js"></script>
</head>
<body>
<h1>Developer Guide</h1>
<h2>Install With Modman</h2>
<pre>
$ cd /path/to/root/magento/install
$ modman clone https://github.com/vehiclefits/Vehicle-Fits-Magento
$ cd .modman/Vehicle-Fits-Magento/app/code/local/Elite
$ composer install
</pre>
After installation, log into Magento's admin panel and go to system -> configuration -> developer -> template settings -> Allow Symlinks: Yes
<h1>Automated Tests</h1>
<p>The Vehicle Fits software is a complex software. Some users want "year,make,model", others may want "foo,bar". Due to this, the number of interactions between features is difficult to manage. In order to ensure all interactions of these features work after making code changes, we run an automated test suite. This is comprised of phpunit tests for PHP & qunit tests for javascript.</p>
<h2>Running the phpunit tests</h2>
<p>cd to the app/code/local/Elite directory and run `phpunit`. The configuration is read from phpunit.xml.dist</p>
<p>The tests are each wrapped in a transaciton that gets rolled back. In each test case, in the doSetUp() method the schema should be specified (year,make,model for example). If the schema differs from the current database's schema, a reset of the tables is forced. If a unit test fails at an unfortunate time, the tables could not all be created. To force a database reset run `php tasks/schema.php`.</p>
<p>There are some conventions with the way unit tests are written. Generally speaking, we usually group the test case files by the schema levels. For a feature we will have one test case that tests with the levels set to "year,make,model".. in another test case we will have the levels set to "make,model,year" with a similar set of test methods. All test cases extend a base test case class which provides common functionality such as database transaction/rollback mechanism to reset the state of the database after each test, and utility methods that facilitate common operations such as creating a vehicle, or asserting that a vehicle exists</p>
<p>Since the base test case class defines a setUp() method for wrapping test methods in transactions, all setup logic for your test case must go in a template method doSetUp(). In this method the first line of code should use the utility method switchSchema() to define what schema should be initialized for your tests</p>
<pre class="kodify php">
function doSetUp()
{
$this->switchSchema('make,model,year');
}
</pre>
<p>For performance reasons, switchSchema() will drop the old tables & create new tables, but only if the schema being asked for differs from the current state of the database. Data is reset on every test method with a transaction rollback. The schema need only be reset if the schema is changing.</p>
<h2>Running the Qunit tests</h2>
<p>Open your browser to http://localhost/vafAjaxTests/ replacing localhost with wherever you have Magento installed. The tests should run and their results will be displayed in your browser.</p>
<h1>Command Line Utilities</h1>
<p>In app/code/local/Elite are various utilities.</p>
<h2>Schema</h2>
<p>To reset the schema to a new schema do this:<br />
<pre class="kodify">php tasks/schema.php --force --levels="make,model,year"</pre>
To add a new schema do this:
<pre class="kodify">php tasks/schema.php --add --levels="foo,bar"</pre>
You must create the first schema before creating an additional one with the --add flag.
</p>
<h2>Import/Export</h2>
<p>//todo</p>
<h1>Coding Standards</h1>
<p>We use the <a href="https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md">coding standards called psr-2</a>, for all PHP files, with the following exceptions:<br />
<ul>
<li>There is to be no visibility declared for any methods. All methods are implicitly public.</li>
</ul>
For javascript, curly braces always go 'on the same line'.
</p>
<h1>Contributions</h1>
<p>Contributions are more than welcome, however please read the above notes about automated tests. The more code we accept, the more code we have to maintain. Your code must be well unit tested to be accepted, even a bug fix is not officially incorporated in most cases, without accompanying unit tests.</p>
</body>
</html>