[Pkg-owncloud-commits] [owncloud-doc] 02/110: Add reference for TestCase class to docs
David Prévot
taffit at moszumanska.debian.org
Fri Feb 6 21:10:20 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository owncloud-doc.
commit 48b90f13bc0659bd747e7c51e21992b0a8137e42
Author: Joas Schilling <nickvergessen at gmx.de>
Date: Thu Nov 20 15:03:17 2014 +0100
Add reference for TestCase class to docs
---
developer_manual/app/testing.rst | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/developer_manual/app/testing.rst b/developer_manual/app/testing.rst
index 82b45d4..11a2538 100644
--- a/developer_manual/app/testing.rst
+++ b/developer_manual/app/testing.rst
@@ -51,15 +51,17 @@ would look like this:
.. code-block:: php
<?php
- // tests/unit/storage/AuthorStorageTest.php
- namespace OCA\MyApp\Storage;
+ // tests/storage/AuthorStorageTest.php
+ namespace OCA\MyApp\Tests\Storage;
- class AuthorStorageTest extends \PHPUnit_Framework_TestCase {
+ class AuthorStorageTest extends \Test\TestCase {
private $container;
private $storage;
protected function setUp() {
+ parent::setUp();
+
$app = new \OCA\MyApp\AppInfo\Application();
$this->container = $app->getContainer();
$this->storage = $storage = $this->getMockBuilder('\OCP\Files\Folder')
@@ -84,3 +86,8 @@ would look like this:
}
}
+
+Make sure to extend the ``\Test\TestCase`` class with your test and always call the parent methods,
+when overwriting ``setUp()``, ``setUpBeforeClass()``, ``tearDown()`` or ``tearDownAfterClass()`` method
+from the TestCase. These methods set up important stuff and clean up the system after the test,
+so the next test can run without side effects, like remaining files and entries in the file cache, etc.
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-doc.git
More information about the Pkg-owncloud-commits
mailing list