<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Thu, 23 May 2013 19:29:32 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[NetTuts.com: Testing Like a Boss in Laravel: Models]]></title>
      <guid>http://www.phpdeveloper.org/news/19204</guid>
      <link>http://www.phpdeveloper.org/news/19204</link>
      <description><![CDATA[<p>
NetTuts.com has a new tutorial in their series covering the use of the <a href="http://four.laravel.com">Laravel 4 framework</a>. In <a href="http://net.tutsplus.com/tutorials/php/testing-like-a-boss-in-laravel-models/">this new post</a>, though, they show how to ensure quality in your application by unit testing your models (the "M" in "MVC").
</p>
<blockquote>
If you're hoping to learn <a href="http://net.tutsplus.com/tutorials/php/the-newbies-guide-to-test-driven-development/">why tests are beneficial</a>, this is not the article for you. Over the course of this tutorial, I will assume that you already understand the advantages, and are hoping to learn how best to write and organize your tests in <a href="http://four.laravel.com/">Laravel 4</a>. Version 4 of Laravel offers serious improvements in relation to testing, when compared to its previous release. This is the first article of a series that will cover how to write tests for Laravel 4 applications. We'll begin the series by discussing model testing.
</blockquote>
<p>
They show how to set up the environment - making it use an in-memory SQLite database, call the migration to initialize it and run a "createApplication" to bootstrap the app. They then include an example if tests written against a "Post" model that extends the <a href="http://laravelbook.github.com/ardent">Ardent</a> class. It also uses the <a href="https://github.com/Zizaco/factory-muff">FactoryMuff</a> package to create objects. Some example tests are included, checking things like object properties, "posted at" date formats and the "slug" of a page (in a Page model and its tests).
</p>]]></description>
      <pubDate>Tue, 19 Feb 2013 13:42:04 -0600</pubDate>
    </item>
  </channel>
</rss>
