<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>LAMPlights &#187; crimson</title>
	<atom:link href="http://www.hermanradtke.com/blog/tag/crimson/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hermanradtke.com</link>
	<description>Personal anecdotes from my experiences using the LAMP stack</description>
	<lastBuildDate>Wed, 25 Jan 2012 18:14:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Bootstrapping PHPUnit tests</title>
		<link>http://www.hermanradtke.com/blog/bootstrapping-phpunit-tests/</link>
		<comments>http://www.hermanradtke.com/blog/bootstrapping-phpunit-tests/#comments</comments>
		<pubDate>Sun, 12 Dec 2010 07:18:26 +0000</pubDate>
		<dc:creator>Herman Radtke</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[crimson]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[phpunit]]></category>

		<guid isPermaLink="false">http://www.hermanradtke.com/?p=586</guid>
		<description><![CDATA[I just recently stumbled upon PHPUnit's --bootstrap flag. I used to bootstrap each of my unit tests using a require statement at the top of the file. I always found this very tedious, but did not want to write some script to wrap each unit test. The --bootstrap flag solves this problem quite nicely. My [...]]]></description>
			<content:encoded><![CDATA[<p>I just recently stumbled upon PHPUnit's --bootstrap flag.  I used to bootstrap each of my unit tests using a require statement at the top of the file.  I always found this very tedious, but did not want to write some script to wrap each unit test.  The --bootstrap flag solves this problem quite nicely.<span id="more-586"></span></p>
<p>My unit tests used to look something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">require_once</span> <span style="color: #990000;">dirname</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/../TestHelper.php'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> FooTest <span style="color: #000000; font-weight: bold;">extends</span> \PHPUnit_Framework_TestCase <span style="color: #009900;">&#123;</span> <span style="color: #339933;">...</span> <span style="color: #009900;">&#125;</span></pre></div></div>

<p>This allowed me to run the tests as part of a suite or run them individually.  This worked fine, but it was annoying to always have to make sure the require_once statement was correct.  As I create tests in sub-directories I would often forget this.  I can now remove the require statement and run the unit test with the following command:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">phpunit <span style="color: #660033;">--bootstrap</span> TestHelper.php crimsontest<span style="color: #000000; font-weight: bold;">/</span>FooTest.php</pre></div></div>

<p>I create a runtests.sh script so I don't have to manually type the phpunit command plus the required flag:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #007800;">DIR</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">dirname</span> <span style="color: #007800;">$0</span><span style="color: #000000; font-weight: bold;">`</span>
phpunit <span style="color: #660033;">--bootstrap</span> <span style="color: #007800;">$DIR</span><span style="color: #000000; font-weight: bold;">/</span>TestHelper.php <span style="color: #007800;">$DIR</span><span style="color: #000000; font-weight: bold;">/</span>crimsontest<span style="color: #000000; font-weight: bold;">/</span>AllTests.php</pre></div></div>

<p>I already updated all the unit tests in the <a href="https://github.com/hradtke/crimson" target="_blank">Crimson</a> framework to use a the bootstrap strategy.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hermanradtke.com/blog/bootstrapping-phpunit-tests/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Crimson Framework Updated to PHP 5.3</title>
		<link>http://www.hermanradtke.com/blog/crimson-framework-updated-to-php-5-3/</link>
		<comments>http://www.hermanradtke.com/blog/crimson-framework-updated-to-php-5-3/#comments</comments>
		<pubDate>Fri, 24 Sep 2010 05:43:34 +0000</pubDate>
		<dc:creator>Herman Radtke</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[crimson]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[php5.3]]></category>

		<guid isPermaLink="false">http://www.hermanradtke.com/blog/?p=508</guid>
		<description><![CDATA[I have updated my Crimson framework to use PHP 5.3 namespace support instead of the old PEAR style class namespacing.  I did this primarily as an exercise in migrating a code-base to use namespaces.  Just in case anyone was relying on the old framework code, there is a pre-5.3 branch on github. Along the way [...]]]></description>
			<content:encoded><![CDATA[<p>I have updated my <a href="http://github.com/hradtke/crimson">Crimson</a> framework to use PHP 5.3 namespace support instead of the old PEAR style class namespacing.  I did this primarily as an exercise in migrating a code-base to use namespaces.  Just in case anyone was relying on the old framework code, there is a pre-5.3 branch on github.<span id="more-508"></span></p>
<p>Along the way I decided to deviate from the separate component structure and merge all components into a single framework structure.  It is still my goal to keep dependencies within the framework to a minimum, but I felt the extra work required to maintain each component separately was not worth it.  This was especially the case for the unit tests.  Each component required a considerable amount of boilerplate code to bootstrap and run the tests.  I was able to reduce the amount of boilerplate considerably by merging the tests into one suite.  I have been following the developments of Zend Framework 2.0 to see what major changes they are making.  I think the large overhaul to the ZF2 tests section was a significant influence on my decision to do some overhaul myself.</p>
<p>I have also added some additional features to the framework that I will be talking about in a later post.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hermanradtke.com/blog/crimson-framework-updated-to-php-5-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Crimson framework PHP 5.3 branch</title>
		<link>http://www.hermanradtke.com/blog/crimson-framework-php-5-3-branch/</link>
		<comments>http://www.hermanradtke.com/blog/crimson-framework-php-5-3-branch/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 05:48:05 +0000</pubDate>
		<dc:creator>Herman Radtke</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[crimson]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php53]]></category>

		<guid isPermaLink="false">http://www.hermanradtke.com/blog/?p=151</guid>
		<description><![CDATA[I have added a PHP 5.3 branch to the Crimson framework. The code now uses namespaces and has a native namespace autoloader. Some of the classes were renamed to conform with the PHP Framework Standards Group preliminary standard. For the time being I will be keeping a 5.2 and 5.3 version of the Crimson framework [...]]]></description>
			<content:encoded><![CDATA[<p>I have added a PHP 5.3 branch to the Crimson framework.  The code now uses namespaces and has a native namespace autoloader.  Some of the classes were renamed to conform with the PHP Framework Standards Group preliminary standard.</p>
<p>For the time being I will be keeping a 5.2 and 5.3 version of the Crimson framework until PHP 5.3 becomes even more stable.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hermanradtke.com/blog/crimson-framework-php-5-3-branch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

