<?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>PHPUnit | Nerdpress.org</title>
	<atom:link href="https://nerdpress.org/tag/phpunit/feed/" rel="self" type="application/rss+xml" />
	<link>https://nerdpress.org</link>
	<description>...dev, tech problems and solutions.</description>
	<lastBuildDate>Mon, 04 Apr 2022 08:10:00 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>Testing Deprecations with PHPUnit</title>
		<link>https://nerdpress.org/2022/04/04/testing-deprecations-with-phpunit/</link>
		
		<dc:creator><![CDATA[Ivo Bathke]]></dc:creator>
		<pubDate>Mon, 04 Apr 2022 08:08:26 +0000</pubDate>
				<category><![CDATA[PHPUnit]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=3121</guid>

					<description><![CDATA[<p>When testing deprecations with PHPUnit greater than 9.5.10 you might encounter this error: Failed asserting that exception of type "PHPUnit\Framework\Error\Deprecated" is thrown. The code in the test is as follows: $this-&#62;expectDeprecation(); and the code that should be tested is like this: \trigger_error('foo', \E_USER_DEPRECATED); However PHPUnit does not convert the deprecation to a testable error.By default &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2022/04/04/testing-deprecations-with-phpunit/" class="more-link">Continue reading<span class="screen-reader-text"> "Testing Deprecations with PHPUnit"</span></a></p>
The post <a href="https://nerdpress.org/2022/04/04/testing-deprecations-with-phpunit/">Testing Deprecations with PHPUnit</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>When testing deprecations with PHPUnit greater than 9.5.10 you might encounter this error:</p>



<p><em><code>Failed asserting that exception of type "PHPUnit\Framework\Error\Deprecated" is thrown.</code></em></p>



<p>The code in the test is as follows:</p>



<p><code>$this-&gt;expectDeprecation();</code></p>



<p>and the code that should be tested is like this:</p>



<p><code>\trigger_error('foo', \E_USER_DEPRECATED);</code></p>



<span id="more-3121"></span>



<p>However PHPUnit does not convert the deprecation to a testable error.<br />By default PHPUnit converts only errors, warnings and notices but not deprecations as we can read here:<br /><a href="https://phpunit.readthedocs.io/en/9.5/writing-tests-for-phpunit.html#testing-php-errors-warnings-and-notices" target="_blank" rel="noreferrer noopener">https://phpunit.readthedocs.io/en/9.5/writing-tests-for-phpunit.html#testing-php-errors-warnings-and-notices</a></p>



<p>So we have to tell PHPUnit to convert also deprecations to exceptions and we do this in the <em>phpunit.xml.dist</em> by setting the attribute</p>



<p><code>convertDeprecationsToExceptions="true"</code></p>



<p>in the root element.</p>



<p>Now the test should work and deprecations are handled as exceptions.</p>The post <a href="https://nerdpress.org/2022/04/04/testing-deprecations-with-phpunit/">Testing Deprecations with PHPUnit</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Disable symfony deprecation warnings in PHPUnit tests</title>
		<link>https://nerdpress.org/2019/08/29/disable-symfony-deprecation-warnings-in-phpunit-tests/</link>
					<comments>https://nerdpress.org/2019/08/29/disable-symfony-deprecation-warnings-in-phpunit-tests/#comments</comments>
		
		<dc:creator><![CDATA[Ivo Bathke]]></dc:creator>
		<pubDate>Thu, 29 Aug 2019 07:39:23 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[PHPUnit]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=2878</guid>

					<description><![CDATA[<p>Symfony&#8217;s deprecation warnings while running tests is a great service to keep track with upcoming changes in newer symfony versions. However these warnings can break your CI/CD pipeline and sometimes you cant fix all deprecation warnings immediatly. To disable them you can set the ENV var SYMFONY_DEPRECATIONS_HELPER=disabled and the warnings will not be displayed anymore &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2019/08/29/disable-symfony-deprecation-warnings-in-phpunit-tests/" class="more-link">Continue reading<span class="screen-reader-text"> "Disable symfony deprecation warnings in PHPUnit tests"</span></a></p>
The post <a href="https://nerdpress.org/2019/08/29/disable-symfony-deprecation-warnings-in-phpunit-tests/">Disable symfony deprecation warnings in PHPUnit tests</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>Symfony&#8217;s deprecation warnings while running tests is a great service to keep track with upcoming changes in newer symfony versions.<br> However these warnings can break your CI/CD pipeline and sometimes you cant fix all deprecation warnings immediatly.</p>



<p>To disable them you can set the ENV var <br><code>SYMFONY_DEPRECATIONS_HELPER=disabled</code> <br>and the warnings will not be displayed anymore and CI/CD will pass again.<strong><br>Update from comments:</strong><code><br>SYMFONY_DEPRECATIONS_HELPER=weak</code> does also work and will still show the deprecation warnings count. (Thx Max)</p>



<span id="more-2878"></span>



<p> This was introduced a while ago with this <a rel="noreferrer noopener" aria-label="PullRequest (opens in a new tab)" href="https://github.com/symfony/symfony/pull/18232" target="_blank">PullRequest</a> and works for symfony >= 3.1.</p>



<p>So for running the tests manually, do like this:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
SYMFONY_DEPRECATIONS_HELPER=disabled vendor/bin/phpunit
</pre></div>


<p>Or add it to the phpunit.xml</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
&amp;lt;php&gt;
    &amp;lt;ini name=&quot;error_reporting&quot; value=&quot;-1&quot; /&gt;
    &amp;lt;env name=&quot;KERNEL_CLASS&quot; value=&quot;App\Kernel&quot; /&gt;
    ...
    &amp;lt;env name=&quot;SYMFONY_DEPRECATIONS_HELPER&quot; value=&quot;disabled&quot; /&gt;
&amp;lt;/php&gt;
</pre></div>


<p>With bitbucket pipelines it looks like this:</p>



<pre class="wp-block-preformatted"><code>pipelines:<br>   branches:<br>     master:<br>       - step:<br>           script:<br>             - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer<br>             - composer install<br>             - SYMFONY_DEPRECATIONS_HELPER=disabled composer test<br>             - composer check-style</code></pre>The post <a href="https://nerdpress.org/2019/08/29/disable-symfony-deprecation-warnings-in-phpunit-tests/">Disable symfony deprecation warnings in PHPUnit tests</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
					<wfw:commentRss>https://nerdpress.org/2019/08/29/disable-symfony-deprecation-warnings-in-phpunit-tests/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>mocking APIs with Guzzle</title>
		<link>https://nerdpress.org/2017/12/11/mocking-apis-with-guzzle/</link>
		
		<dc:creator><![CDATA[Ivo Bathke]]></dc:creator>
		<pubDate>Mon, 11 Dec 2017 16:10:17 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[guzzle]]></category>
		<category><![CDATA[mocks]]></category>
		<category><![CDATA[PHPUnit]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=2803</guid>

					<description><![CDATA[<p>When working with APIs you sometimes cant use the live API in the tests. Because you dont own the API, dont want to spam, cant create entities for testing or various other reasons. Then you need to mock the API and deliever responses from fixtures. Though there is this term of &#8220;Don&#8217;t mock what you &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2017/12/11/mocking-apis-with-guzzle/" class="more-link">Continue reading<span class="screen-reader-text"> "mocking APIs with Guzzle"</span></a></p>
The post <a href="https://nerdpress.org/2017/12/11/mocking-apis-with-guzzle/">mocking APIs with Guzzle</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>When working with APIs you sometimes cant use the live API in the tests.<br />
Because you dont own the API, dont want to spam, cant create entities for testing or various other reasons.</p>
<p>Then you need to mock the API and deliever responses from fixtures.<br />
Though there is this term of &#8220;<em>Don&#8217;t mock what you don&#8217;t own</em>&#8221; we will mock the API because we dont own it. :)</p>
<p><a href="https://github.com/julienfalque/http-mock" rel="noopener" target="_blank">https://github.com/julienfalque/http-mock</a> is a nice library which helps a lot when mocking an API.<br />
And when your client is using Guzzle there is also a <a href="https://github.com/julienfalque/http-mock-guzzle" rel="noopener" target="_blank">Guzzle handler</a> for HttpMock that makes integration easy.</p>
<p>How does this work?<br />
<span id="more-2803"></span></p>
<p>See below but with caution: its pseudo code but you get the idea dont you? :)</p>
<p>1. lets create a HttpMock Server object through a Factory<br />
and define the endpoints and assign the fixture.</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php

namespace Nerdpress\Tests;

use GuzzleHttp\Psr7\Response;
use Jfalque\HttpMock\Server;

class HttpMockFactory
{
    public static function create(): Server
    {
        $server = (new Server())-&gt;whenUri('http://mock.api/action/ding')
                                -&gt;andWhenMethod('POST')
                                -&gt;return($foo = new Response(200, &#x5B;],
                                    file_get_contents(__DIR__.'/fixtures/DingResponse.xml')))
                                -&gt;end();

        return $server;
    }
}
</pre>
<p>2. lets create a mock Guzzle client that takes the HttpMock server and delegates the requests.</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php

namespace Nerdpress\Tests;

use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Middleware;
use Jfalque\HttpMock\Guzzle\HttpMockHandler;
use Jfalque\HttpMock\Server;
use Psr\Http\Message\RequestInterface;

class HttpClientMock implements ClientInterface
{
    /**
     * @var Server
     */
    protected $server;
    /**
     * @var \GuzzleHttp\Client
     */
    protected $delegate;
    /**
     * The set of requests that have been sent through the client.
     *
     * @var \Psr\Http\Message\RequestInterface&#x5B;]
     */
    protected $requestHistory = &#x5B;];

    /**
     * HttpClientMock constructor.
     * @param Server $server
     * @param array $options
     */
    public function __construct(Server $server, array $options = &#x5B;])
    {
        $this-&gt;initialize($server, $options);
    }

    /**
     * {@inheritDoc}
     */
    public function send(RequestInterface $request, array $options = &#x5B;])
    {
        return $this-&gt;delegate-&gt;send($request, $options);
    }

    /**
     * {@inheritDoc}
     */
    public function sendAsync(RequestInterface $request, array $options = &#x5B;])
    {
        return $this-&gt;delegate-&gt;sendAsync($request, $options);
    }

    /**
     * {@inheritDoc}
     */
    public function request($method, $uri, array $options = &#x5B;])
    {
        return $this-&gt;delegate-&gt;request($method, $uri, $options);
    }

    /**
     * {@inheritDoc}
     */
    public function requestAsync($method, $uri, array $options = &#x5B;])
    {
        return $this-&gt;delegate-&gt;requestAsync($method, $uri, $options);
    }

    /**
     * {@inheritDoc}
     */
    public function getConfig($option = null)
    {
        return $this-&gt;delegate-&gt;getConfig($option);
    }

    /**
     * @return RequestInterface&#x5B;]
     */
    public function getRequestHistory(): array
    {
        return $this-&gt;requestHistory;
    }

    /**
     * @param Server $server
     * @param array $options
     */
    private function initialize(Server $server, array $options)
    {
        $this-&gt;requestHistory = &#x5B;];
        $history              = Middleware::history($this-&gt;requestHistory);
        $stack                = HttpMockHandler::createStack($server);
        $stack-&gt;push($history);
        $client         = new Client(array_merge($options, &#x5B;
            'handler' =&gt; $stack,
        ]));
        $this-&gt;delegate = $client;
    }
}
</pre>
<p>3. lets say we use symfony and create services for the mocks</p>
<pre class="brush: yaml; title: ; notranslate">
services:
  Nerdpress\Tests\HttpMockFactory:
  Nerdpress\Tests\HttpClientMock:
    arguments: &#x5B;&quot;@=service('Nerdpress\\\\Tests\\\\HttpMockFactory').create()&quot;, base_uri: 'http://mock.api']

my_bundle:
  client: 'Nerdpress\Tests\HttpClientMock'
</pre>
<p>4. lets write a test and use the client and work on the returned fixtures</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php

namespace Nerdpress\Tests;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

class RequestTest extends WebTestCase
{

    protected function setUp()
    {
        parent::setUp();
        static::createClient();
    }

    public function testRequest()
    {
        $container     = static::$kernel-&gt;getContainer();

        $request = $container-&gt;get('my_bundle.request.with.client');

        $payload = &#x5B;'testo' =&gt; 'bert'];
        $response = $request-&gt;send($payload);

        //hey lets have a look at the request
        $reqs = $container-&gt;get('Nerdpress\Tests\HttpClientMockt')-&gt;getRequestHistory();
        $sendedRequest = $reqs&#x5B;0]&#x5B;'request']-&gt;getBody()-&gt;__toString();

        $this-&gt;assertEquals($sendedRequest, '&lt;req&gt;&lt;action type=&quot;testo&quot;&gt;bert&lt;/action&gt;&lt;/req&gt;');
        $this-&gt;assertEquals('you got pinged', $response-&gt;getData());
    }
}
</pre>
<p>Happy Testing :)</p>The post <a href="https://nerdpress.org/2017/12/11/mocking-apis-with-guzzle/">mocking APIs with Guzzle</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Eclipse Plugin PHP Tool Integration</title>
		<link>https://nerdpress.org/2011/01/26/eclipse-plugin-php-tool-integration/</link>
		
		<dc:creator><![CDATA[Ivo Bathke]]></dc:creator>
		<pubDate>Wed, 26 Jan 2011 10:09:13 +0000</pubDate>
				<category><![CDATA[IDE]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[CodeSniffer]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[PDT]]></category>
		<category><![CDATA[phpdepend]]></category>
		<category><![CDATA[PHPUnit]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=1331</guid>

					<description><![CDATA[<p>Ich bin letzte Woche über Eclipse PTI gestolpert und habe es direkt mal ausprobiert. Einfach über den Eclipse installer über die Site: http://www.phpsrc.org/eclipse/pti/ geholt und fertig. Was ist PTI? PTI ist ein Plugin für Eclipse PDT (zumeist), das folgende Tools in Eclipse integriert: * PHP_CodeSniffer * PHPUnit * PHP Depend * PHP Copy/Paste Detector Das &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2011/01/26/eclipse-plugin-php-tool-integration/" class="more-link">Continue reading<span class="screen-reader-text"> "Eclipse Plugin PHP Tool Integration"</span></a></p>
The post <a href="https://nerdpress.org/2011/01/26/eclipse-plugin-php-tool-integration/">Eclipse Plugin PHP Tool Integration</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>Ich bin letzte Woche über Eclipse <a href="http://www.phpsrc.org/">PTI</a> gestolpert und habe es direkt mal ausprobiert.<br />
Einfach über den Eclipse installer über die Site: <em>http://www.phpsrc.org/eclipse/pti/</em> geholt und fertig.</p>
<p>Was ist PTI? PTI ist ein Plugin für Eclipse PDT (zumeist), das folgende Tools in Eclipse integriert:</p>
<p>    * <a href="http://pear.php.net/package/PHP_CodeSniffer/">PHP_CodeSniffer</a><br />
    * <a href="http://www.phpunit.de/">PHPUnit</a><br />
    * <a href="http://www.pdepend.org/">PHP Depend</a><br />
    * <a href="http://github.com/sebastianbergmann/phpcpd">PHP Copy/Paste Detector</a> </p>
<p><span id="more-1331"></span></p>
<p>Das sind meines Erachtens alles eher Tools die auf den CI Server gehören, aber ist doch irgendwie praktisch die direkt in Eclipse zu haben.<br />
Falls man mal was sichten oder direkt checken will.<br />
Für mich der Hauptvorteil ist wohl, dass man die Tools ohne viel Aufwand zu Verfügung gestellt kriegt.<br />
Ich hätte mir wohl sonst nie <em>phpdepend</em> oder <em>phpcpd</em> installiert und benutzt.</p>
<p><a href="https://nerdpress.org/wp-content/uploads/2011/01/phpdepend-pti.png"><img fetchpriority="high" decoding="async" src="https://nerdpress.org/wp-content/uploads/2011/01/phpdepend-pti-300x227.png" alt="" title="phpdepend-pti" width="300" height="227" class="alignnone size-medium wp-image-1332" /></a></p>
<p>&#8230; und auch prompt über phpdepend, als netter Seiteneffekt, ein Syntax Fehler gefunden :).</p>The post <a href="https://nerdpress.org/2011/01/26/eclipse-plugin-php-tool-integration/">Eclipse Plugin PHP Tool Integration</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Selenium functional tests mit PHPUnit</title>
		<link>https://nerdpress.org/2010/11/14/selenium-functional-tests-mit-phpunit/</link>
					<comments>https://nerdpress.org/2010/11/14/selenium-functional-tests-mit-phpunit/#comments</comments>
		
		<dc:creator><![CDATA[Max Girkens]]></dc:creator>
		<pubDate>Sun, 14 Nov 2010 15:03:14 +0000</pubDate>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[JS]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[continuous integration]]></category>
		<category><![CDATA[PHP 5.3]]></category>
		<category><![CDATA[PHPUnit]]></category>
		<category><![CDATA[selenium]]></category>
		<category><![CDATA[sfPhpunitPlugin]]></category>
		<category><![CDATA[test driven developement]]></category>
		<category><![CDATA[testing]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=1193</guid>

					<description><![CDATA[<p>PHPUnit hat coolerweise eine Extension für Selenium Tests. Dafür braucht man noch den PHP Client für die Selenium Remote Control. pear install Testing_Selenium-0.4.3 Bei mir auf Debian Lenny, bzw. Mac OSX musste ich noch den include_path dafür anpassen, damit phpunit Testing/Selenium.php gefunden hat. Damit kann man mit PHP komfortabel einen Selenium Test Server über die &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2010/11/14/selenium-functional-tests-mit-phpunit/" class="more-link">Continue reading<span class="screen-reader-text"> "Selenium functional tests mit PHPUnit"</span></a></p>
The post <a href="https://nerdpress.org/2010/11/14/selenium-functional-tests-mit-phpunit/">Selenium functional tests mit PHPUnit</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p><a href="http://www.phpunit.de/">PHPUnit</a> hat coolerweise eine <a href="https://github.com/sebastianbergmann/phpunit-selenium">Extension</a> für <a href="http://seleniumhq.org/">Selenium</a> Tests.</p>
<p>Dafür braucht man noch den PHP Client für die Selenium Remote Control.</p>
<pre class="brush: bash; title: ; notranslate">
pear install Testing_Selenium-0.4.3
</pre>
<p>Bei mir auf Debian Lenny, bzw. Mac OSX musste ich noch den include_path dafür anpassen,<br />
damit phpunit Testing/Selenium.php gefunden hat.</p>
<p>Damit kann man mit PHP komfortabel einen Selenium Test Server über die <a href="http://seleniumhq.org/docs/05_selenium_rc.html">Selenium RC</a> ansprechen,<br />
der dann beliebige Browser für functional Tests benutzt.</p>
<p>Der Selenium Server ist auch im Prinzip <a href="http://seleniumhq.org/docs/05_selenium_rc.html#installation">schnell</a> installiert<br />
und lokal ist das ganze einigermaßen unproblematisch, weil man ja schon mal die Browser seines OS zur Verfügung hat.</p>
<p>In einem Continuous Integration Setup möchte man aber vielleicht Selenium lieber auf einem Web Server laufen lassen.</p>
<p>Da sieht es dann erstmal weniger gut aus mit Browser executables.<br />
Was also tun?</p>
<p><span id="more-1193"></span></p>
<p>Eine Möglichkeit ist <a href="http://saucelabs.com/">saucelabs.com</a>.<br />
Die bieten &#8220;Cross browser testing with Selenium in the cloud&#8221; an.<br />
Sogar gratis für Firefox unter Linux.<br />
Für die anderen Browser und OS muss man dann schon auf einen bezahlten Account umsteigen.</p>
<p>Dann einfach den saucelabs Selenium Server mit oben erwähnter Extension aus PHPUnit ansprechen:</p>
<p><em>Das Example.php Script von saucelabs</em></p>
<pre class="brush: php; title: ; notranslate">
require_once 'Testing/Selenium.php';
require_once 'PHPUnit/Framework/TestCase.php';

class Example extends PHPUnit_Framework_TestCase
{
    private $selenium;

    public function setUp()
    {
        $this-&gt;selenium = new Testing_Selenium(
            json_encode(array(
                &quot;username&quot; =&gt; &quot;YOUR_USERNAME&quot;,
                &quot;access-key&quot; =&gt; &quot;YOUR_ACCESS_KEY&quot;,
                &quot;os&quot; =&gt; &quot;Windows 2003&quot;, 
                &quot;browser&quot; =&gt; &quot;firefox&quot;,
                &quot;browser-version&quot; =&gt; &quot;3.6.&quot;,
                &quot;name&quot; =&gt; $this-&gt;getName()
            )),
            &quot;http://saucelabs.com&quot;, 
            &quot;ondemand.saucelabs.com&quot;,
            80,
            90000);
        $this-&gt;selenium-&gt;start();
    }

    public function tearDown()
    {
        $this-&gt;selenium-&gt;stop();
    }

    public function testSauce()
    {
        $this-&gt;selenium-&gt;open(&quot;/&quot;);
        $this-&gt;assertEquals(&quot;Cross browser testing with Selenium - Sauce Labs&quot;,
                            $this-&gt;selenium-&gt;getTitle());
    }

}
</pre>
<p>und PHPUnit macht Selenium Tests:</p>
<pre class="brush: bash; title: ; notranslate">
phpunit Example.php
</pre>
<p>:)</p>The post <a href="https://nerdpress.org/2010/11/14/selenium-functional-tests-mit-phpunit/">Selenium functional tests mit PHPUnit</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
					<wfw:commentRss>https://nerdpress.org/2010/11/14/selenium-functional-tests-mit-phpunit/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
