TASK: Document new test implementation

This commit is contained in:
Daniel Siepmann 2017-05-04 08:35:13 +02:00
parent e789311862
commit 9e3f8b8195
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4

View file

@ -55,6 +55,44 @@ a folder named like the sniff. E.g. you want to add a test for sniff
:file:`src/Standards/Typo3Update/Sniffs/LegacyClassnames/DocCommentSniff.php`, the following folder
has to exist: :file:`tests/Fixtures/Standards/Typo3Update/Sniffs/LegacyClassnames/DocCommentSniff/`.
Also for convenience add a test class with following content:
.. code-block:: php
<?php
namespace Typo3Update\Tests\Sniffs\Removed;
/*
* Copyright (C) 2017 Daniel Siepmann <coding@daniel-siepmann.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
use Typo3Update\Tests\SniffsTest;
class TypoScriptSniffTest extends SniffsTest
{
}
Place it accordingly to namespace. Adjust namespace and class name. No code is needed, everything is
done in ``SniffsTest``. But this enables you to add ``--filter`` to ``phpunit`` to run just one
test. Also IDEs support to run the single test file. This makes development much faster and failing
tests more helpfull as they contain the class name.
.. _extending-tests-single:
Single test per sniff