summaryrefslogtreecommitdiff
path: root/demos/time-tracker/protected/pages/Docs/WritingUnitTest.page
diff options
context:
space:
mode:
authorwei <>2007-05-14 02:51:03 +0000
committerwei <>2007-05-14 02:51:03 +0000
commit1ae178334023d36a224b06c371a47a5c3e0aad3d (patch)
tree49f2ca7c95bbcf9985c2e7a07e1f8857c51039c9 /demos/time-tracker/protected/pages/Docs/WritingUnitTest.page
parentc48862a7bc618045673dfe80a16f9423a281cb4c (diff)
remove unfinished docs.
Diffstat (limited to 'demos/time-tracker/protected/pages/Docs/WritingUnitTest.page')
-rw-r--r--demos/time-tracker/protected/pages/Docs/WritingUnitTest.page86
1 files changed, 0 insertions, 86 deletions
diff --git a/demos/time-tracker/protected/pages/Docs/WritingUnitTest.page b/demos/time-tracker/protected/pages/Docs/WritingUnitTest.page
deleted file mode 100644
index 77bdcbe6..00000000
--- a/demos/time-tracker/protected/pages/Docs/WritingUnitTest.page
+++ /dev/null
@@ -1,86 +0,0 @@
-<com:TContent ID="body">
-<h1>Writing a Unit Test</h1>
-<p>Before we begin to write our business logic and code, we shall
-proceed with the path of <a href="http://tdd.com">test driven development</a> (TDD), or at least take
-some part of that process.</p>
-
-<p>Unit testing is a useful tool when we want to start to test
- our individual business logic classes.
- The <tt>tests/unit</tt> directory will be used to hold the unit test
- cases and <tt>tests/functional</tt> directory
- to hold the function test cases.
-</p>
-
-<h2>Write a unit test case</h2>
-<p>We will start be writing a very simple unit test case. Notice
-that we are writing the test case <b>first</b>.</p>
-<com:TTextHighlighter Language="php" CssClass="source">
-&lt;?php
-class ProjectTestCase extends UnitTestCase
-{
- function testProjectClassExists()
- {
- $project = new Project();
- $this->pass();
- }
-}
-?&gt;
-</com:TTextHighlighter>
-<p>Save the code as <tt>ProjectTestCase.php</tt> in the <tt>document_root/time-tracker/tests/unit/</tt>
-directory.</p>
-
-<h2>Run your first unit test case from your browser</h2>
-<p>Point your browser to your development server's unit test case runner, e.g.
- <tt>http://web-server-address/time-tracker/tests/unit.php</tt>. You should see the following
-<img src="<%~ unit_test1.png %>" class="figure"/>
-<div class="caption"><b>Figure 1:</b> Unit test runner</div>
-</p>
-<p>Clicking on the <tt>ProjectTestCase.php</tt> link, you should see
-<img src="<%~ unit_test2.png %>" class="figure"/>
-<div class="caption"><b>Figure 2:</b> Unit test failure</div>
-</p>
-
-<h2>Smallest step to make the test pass.</h2>
-
-<p>Since we only wrote the test case and nothing else we expected
-that the test case will fail at some point. Obviously, we need create
-a class <tt>Project</tt>, so lets define the <tt>Project</tt> class.</p>
-<com:TTextHighlighter Language="php" CssClass="source">
-&lt;?php
-class Project
-{
-}
-?&gt;
-</com:TTextHighlighter>
-<p>We save the above code as <tt>time-tracker/protected/pages/APP_CODE/Project.php</tt>.
- Where the <tt>APP_CODE</tt> directory will contain most of the business logic code
- for the Time Tracker application.</p>
-<p>Now, we also need to add the following line in our test case so as to
-include the <tt>Project</tt> class file when running the tests.</p>
-
-<com:TTextHighlighter Language="php" CssClass="source">
-&lt;?php
-Prado::using('Application.APP_CODE.Project');
-class ProjectTestCase extends UnitTestCase
-{
- ...
-}
-?&gt;
-</com:TTextHighlighter>
-
-<div class="info"><b>Info:</b>
-The statement <tt>Prado::using('Application.APP_CODE.Project')</tt> basically
-loads the <tt>Project.php</tt> class file. It assumes that a class name <tt>Project</tt> has filename <tt>Project.php</tt>.
-For futher details regarding <tt>Prado::using</tt> can be found in <a href="http://www.pradosoft.com/demos/quickstart/index.php?page=Fundamentals.Components#704">Prado Namespaces</a> documentation.
-</div>
-
-<p>Run the unit test runner again, we see that the test has passed.
- <img src="<%~ unit_test3.png %>" class="figure"/>
- <div class="caption"><b>Figure 3:</b> Unit test success</div>
-</p>
-<p>
-Later on, we shall write more test cases. See the
-<a href="http://www.lastcraft.com/simple_test.php">SimpleTest documentation</a>
-for detailed tutorial on writing test cases.</p>
-
-</com:TContent> \ No newline at end of file