mirror of
https://github.com/maxkratz/documentation.git
synced 2024-09-16 19:29:06 +00:00
Merge pull request #7049 from nextcloud/backport/7047/stable21
[stable21] Update code examples
This commit is contained in:
commit
efdf690445
2 changed files with 6 additions and 24 deletions
|
@ -718,7 +718,7 @@ Because Nextcloud uses :doc:`Dependency Injection <requests/container>` to assem
|
|||
<?php
|
||||
namespace OCA\NotesTutorial\Tests\Unit\Controller;
|
||||
|
||||
use PHPUnit_Framework_TestCase;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
use OCP\AppFramework\Http;
|
||||
use OCP\AppFramework\Http\DataResponse;
|
||||
|
@ -726,7 +726,7 @@ Because Nextcloud uses :doc:`Dependency Injection <requests/container>` to assem
|
|||
use OCA\NotesTutorial\Service\NotFoundException;
|
||||
|
||||
|
||||
class NoteControllerTest extends PHPUnit_Framework_TestCase {
|
||||
class NoteControllerTest extends TestCase {
|
||||
|
||||
protected $controller;
|
||||
protected $service;
|
||||
|
@ -780,13 +780,13 @@ We can and should also create a test for the **NoteService** class:
|
|||
<?php
|
||||
namespace OCA\NotesTutorial\Tests\Unit\Service;
|
||||
|
||||
use PHPUnit_Framework_TestCase;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
use OCP\AppFramework\Db\DoesNotExistException;
|
||||
|
||||
use OCA\NotesTutorial\Db\Note;
|
||||
|
||||
class NoteServiceTest extends PHPUnit_Framework_TestCase {
|
||||
class NoteServiceTest extends TestCase {
|
||||
|
||||
private $service;
|
||||
private $mapper;
|
||||
|
|
|
@ -8,27 +8,9 @@ PHP unit testing
|
|||
Getting PHPUnit
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
Nextcloud uses PHPUnit >= 4.8 for unit testing.
|
||||
Nextcloud uses PHPUnit >= 8.5 for unit testing.
|
||||
|
||||
To install it, either get it via your package manager::
|
||||
|
||||
sudo apt-get install phpunit
|
||||
|
||||
or install it manually::
|
||||
|
||||
wget https://phar.phpunit.de/phpunit.phar
|
||||
chmod +x phpunit.phar
|
||||
sudo mv phpunit.phar /usr/local/bin/phpunit
|
||||
|
||||
After the installation the **phpunit** command is available::
|
||||
|
||||
phpunit --version
|
||||
|
||||
And you can update it using::
|
||||
|
||||
phpunit --self-update
|
||||
|
||||
You can find more information in the PHPUnit documentation: https://phpunit.de/manual/current/en/installation.html
|
||||
PHPUnit documentation: https://phpunit.de/documentation.html
|
||||
|
||||
Writing PHP unit tests
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
Loading…
Reference in a new issue