<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Blog Entries Tagged &#34;phpunit&#34; on Milwaukee Web Developer, PHP and Laravel Programmer, Consultant</title>
    <link>https://aaronsaray.com/tag/phpunit/</link>
    <description>Recent content in Blog Entries Tagged &#34;phpunit&#34; on Milwaukee Web Developer, PHP and Laravel Programmer, Consultant</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <copyright>This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.</copyright>
    <lastBuildDate>Mon, 22 Mar 2021 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://aaronsaray.com/tag/phpunit/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>The Importance of ToDo Tests</title>
      <link>https://aaronsaray.com/2021/phpunit-todo-tests/</link>
      <pubDate>Mon, 22 Mar 2021 00:00:00 +0000</pubDate>
      <guid>https://aaronsaray.com/2021/phpunit-todo-tests/</guid>
      <description>&lt;p&gt;I&amp;rsquo;m not a huge fan of &lt;code&gt;todo&lt;/code&gt; comments in code because I think they&amp;rsquo;re mainly forgotten. However, I don&amp;rsquo;t have the same opinion for PHPUnit tests.  Let&amp;rsquo;s talk about why - and how to easily add them in your code.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Do Not Calculate Answers to Your Unit Tests</title>
      <link>https://aaronsaray.com/2021/do-not-calculate-answers-to-tests/</link>
      <pubDate>Mon, 08 Feb 2021 00:00:00 +0000</pubDate>
      <guid>https://aaronsaray.com/2021/do-not-calculate-answers-to-tests/</guid>
      <description>&lt;p&gt;Since you&amp;rsquo;re a programmer, you&amp;rsquo;re always looking for ways to be a bit more efficient. Because of this, it can be easy to fall into the trap of being too programatic, too calculation-heavy in your unit tests. But, this isn&amp;rsquo;t a test then - its just another block of quite fallible code.  Let&amp;rsquo;s talk about why and show what to do instead.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Finding Slow Tests in PHPUnit 9</title>
      <link>https://aaronsaray.com/2021/finding-slow-tests-in-phpunit-9/</link>
      <pubDate>Mon, 04 Jan 2021 00:00:00 +0000</pubDate>
      <guid>https://aaronsaray.com/2021/finding-slow-tests-in-phpunit-9/</guid>
      <description>&lt;p&gt;When your unit test suite gets larger, it can take quite a long time. One of the many ways to speed this up is to hunt down and fix slow tests.  Let&amp;rsquo;s use PHPUnit&amp;rsquo;s test listeners to do just that.&lt;/p&gt;</description>
    </item>
    <item>
      <title>PHPUnit Code Coverage Can Help While Writing Tests</title>
      <link>https://aaronsaray.com/2020/phpunit-coverage-helps-while-writing-tests/</link>
      <pubDate>Mon, 28 Dec 2020 00:00:00 +0000</pubDate>
      <guid>https://aaronsaray.com/2020/phpunit-coverage-helps-while-writing-tests/</guid>
      <description>&lt;p&gt;It&amp;rsquo;s great to run code coverage at the very end before you push your changes. This gives you some idea what&amp;rsquo;s tested and what&amp;rsquo;s not. But you don&amp;rsquo;t have to wait till the end; code coverage can help you all throughout writing your test suite, too.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Stop Using Assert Database Has in Laravel</title>
      <link>https://aaronsaray.com/2020/stop-assert-database-has-laravel/</link>
      <pubDate>Fri, 24 Apr 2020 00:00:00 +0000</pubDate>
      <guid>https://aaronsaray.com/2020/stop-assert-database-has-laravel/</guid>
      <description>&lt;p&gt;Please stop using &lt;code&gt;assertDatabaseHas&lt;/code&gt; in Laravel.  There are many reasons why this is bad, and there are better options available.  Let&amp;rsquo;s find out why.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Test Coverage is Not as Good of a Metric as You Think</title>
      <link>https://aaronsaray.com/2019/test-coverage-bad-metric/</link>
      <pubDate>Sun, 09 Jun 2019 00:00:00 +0000</pubDate>
      <guid>https://aaronsaray.com/2019/test-coverage-bad-metric/</guid>
      <description>&lt;p&gt;There are a lot of debates about trying to achieve test coverage of 100%. Some people swear you need to do this. Others say, get 80% or more&amp;hellip; the rest doesn&amp;rsquo;t matter.  Each side has strong arguments.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Two Gotchas in Laravel Unit Testing</title>
      <link>https://aaronsaray.com/2019/two-gotchas-in-laravel-unit-tests/</link>
      <pubDate>Mon, 20 May 2019 00:00:00 +0000</pubDate>
      <guid>https://aaronsaray.com/2019/two-gotchas-in-laravel-unit-tests/</guid>
      <description>&lt;p&gt;There&amp;rsquo;s a struggle to balance the easy-to-use Laravel helpers and functions with very verbose, complicated methods in unit tests.  As I&amp;rsquo;ve been relying on Laravel&amp;rsquo;s way of doing testing more, I&amp;rsquo;ve ran into a couple of gotchas that I should share.&lt;/p&gt;</description>
    </item>
    <item>
      <title>PHPUnit Runs Data Provider Before Setup</title>
      <link>https://aaronsaray.com/2018/phpunit-dataprovider-before-setup/</link>
      <pubDate>Mon, 03 Dec 2018 00:00:00 +0000</pubDate>
      <guid>https://aaronsaray.com/2018/phpunit-dataprovider-before-setup/</guid>
      <description>&lt;p&gt;I started noticing a disturbing trend on one of my projects: developers were doing too much logic in the &lt;code&gt;setup&lt;/code&gt; and data provider methods of their PHPUnit tests. However, before we could address this, a &amp;ldquo;limitation&amp;rdquo; popped up which helped them kick this habit.&lt;/p&gt;</description>
    </item>
    <item>
      <title>PHPUnit Listener for Long Running Tests Update</title>
      <link>https://aaronsaray.com/2017/phpunit-listener-for-long-running-tests-update/</link>
      <pubDate>Wed, 15 Nov 2017 00:00:00 +0000</pubDate>
      <guid>https://aaronsaray.com/2017/phpunit-listener-for-long-running-tests-update/</guid>
      <description>&lt;p&gt;I wrote instructions in 2011 to &lt;a href=&#34;https://aaronsaray.com/2011/add-phpunit-listeners-to-watch-for-long-running-tests/&#34;&gt;add a PHPUnit Listener to Watch for Long Running Tests&lt;/a&gt; which seem to be a bit out of date now.  But, here&amp;rsquo;s a quick refresher:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Run A Single PHPUnit Test Only</title>
      <link>https://aaronsaray.com/2017/run-only-one-phpunit-test/</link>
      <pubDate>Wed, 11 Oct 2017 00:00:00 +0000</pubDate>
      <guid>https://aaronsaray.com/2017/run-only-one-phpunit-test/</guid>
      <description>&lt;p&gt;Often times, I find myself targeting a single file with PHPUnit by specifying the file after the binary in the command line:&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
