Merge pull request #218 from nextcloud/bugfix/noid/execute-the-tests-correctly-again

Execute the tests correctly again
This commit is contained in:
Joas Schilling 2020-07-10 13:27:53 +02:00 committed by GitHub
commit 1759d2176e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 10 additions and 21 deletions

View File

@ -2,6 +2,7 @@
namespace OCA\Registration\Tests\Integration\Controller; namespace OCA\Registration\Tests\Integration\Controller;
use OCA\Registration\Controller\RegisterController;
use OCA\Registration\Db\RegistrationMapper; use OCA\Registration\Db\RegistrationMapper;
use OCA\Registration\Service\MailService; use OCA\Registration\Service\MailService;
use OCA\Registration\Service\RegistrationService; use OCA\Registration\Service\RegistrationService;

View File

@ -5,6 +5,7 @@ namespace OCA\Registration\Tests\Integration\Service;
use OCA\Registration\Db\Registration; use OCA\Registration\Db\Registration;
use OCA\Registration\Db\RegistrationMapper; use OCA\Registration\Db\RegistrationMapper;
use OCA\Registration\Service\MailService; use OCA\Registration\Service\MailService;
use OCA\Registration\Service\RegistrationException;
use OCA\Registration\Service\RegistrationService; use OCA\Registration\Service\RegistrationService;
use OCP\Defaults; use OCP\Defaults;
use OCP\IConfig; use OCP\IConfig;
@ -133,11 +134,11 @@ class RegistrationServiceTest extends TestCase {
} }
/** /**
* @depends testValidateNewEmailWithinAllowedDomain * @depends testValidateNewEmailWithinAllowedDomain
* @expectedException OCA\Registration\Service\RegistrationException
*/ */
public function testValidateNewEmailNotWithinAllowedDomain() { public function testValidateNewEmailNotWithinAllowedDomain() {
$email2 = 'bbbb@gmail.com'; $email2 = 'bbbb@gmail.com';
$this->expectException(RegistrationException::class);
$this->service->validateEmail($email2); $this->service->validateEmail($email2);
} }
@ -155,11 +156,11 @@ class RegistrationServiceTest extends TestCase {
} }
/** /**
* @depends testValidateNewEmailWithinMultipleAllowedDomain * @depends testValidateNewEmailWithinMultipleAllowedDomain
* @expectedException OCA\Registration\Service\RegistrationException
*/ */
public function testValidateNewEmailNotWithinMultipleAllowedDomain() { public function testValidateNewEmailNotWithinMultipleAllowedDomain() {
$email2 = 'cccc@yahoo.com'; $email2 = 'cccc@yahoo.com';
$this->expectException(RegistrationException::class);
$this->service->validateEmail($email2); $this->service->validateEmail($email2);
} }
@ -213,7 +214,6 @@ class RegistrationServiceTest extends TestCase {
/** /**
* @depends testCreateAccountWebForm * @depends testCreateAccountWebForm
* @expectedException OCA\Registration\Service\RegistrationException
*/ */
public function testDuplicateUsernameWebForm() { public function testDuplicateUsernameWebForm() {
$reg = new Registration(); $reg = new Registration();
@ -223,6 +223,7 @@ class RegistrationServiceTest extends TestCase {
//$reg->setPassword("asdf"); //$reg->setPassword("asdf");
$reg->setEmailConfirmed(true); $reg->setEmailConfirmed(true);
$this->expectException(RegistrationException::class);
$resulting_user = $this->service->createAccount($reg, 'alice1', 'asdf'); $resulting_user = $this->service->createAccount($reg, 'alice1', 'asdf');
} }
@ -236,7 +237,6 @@ class RegistrationServiceTest extends TestCase {
/** /**
* @depends testCreateAccountWebForm * @depends testCreateAccountWebForm
* @expectedException OCA\Registration\Service\RegistrationException
*/ */
public function testDuplicateUsernameApi() { public function testDuplicateUsernameApi() {
$reg = new Registration(); $reg = new Registration();
@ -246,6 +246,7 @@ class RegistrationServiceTest extends TestCase {
$reg->setPassword("asdf"); $reg->setPassword("asdf");
$reg->setEmailConfirmed(true); $reg->setEmailConfirmed(true);
$this->expectException(RegistrationException::class);
$resulting_user = $this->service->createAccount($reg); $resulting_user = $this->service->createAccount($reg);
} }

View File

@ -11,6 +11,7 @@
namespace OCA\Registration\Tests\Unit\Controller; namespace OCA\Registration\Tests\Unit\Controller;
use OCA\Registration\Controller\ApiController;
use OCA\Registration\Db\Registration; use OCA\Registration\Db\Registration;
use OCA\Registration\Service\MailService; use OCA\Registration\Service\MailService;
use OCA\Registration\Service\RegistrationService; use OCA\Registration\Service\RegistrationService;

View File

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<phpunit bootstrap="bootstrap.php"
verbose="true"
>
<testsuite name='Registration app tests'>
<directory suffix='Test.php'>unit</directory>
</testsuite>
<!-- filters for code coverage -->
<filter>
<whitelist>
<directory suffix=".php">../</directory>
</whitelist>
</filter>
</phpunit>

View File

@ -3,7 +3,8 @@
verbose="true" verbose="true"
> >
<testsuite name='Registration app tests'> <testsuite name='Registration app tests'>
<directory suffix='Test.php'>integration</directory> <directory suffix='Test.php'>Integration</directory>
<directory suffix='Test.php'>Unit</directory>
</testsuite> </testsuite>
<!-- filters for code coverage --> <!-- filters for code coverage -->
<filter> <filter>

View File

@ -7,7 +7,6 @@ set -e
cd ${BUILD_APP_MODULE_DIR} cd ${BUILD_APP_MODULE_DIR}
composer install --prefer-dist --no-interaction -o composer install --prefer-dist --no-interaction -o
vendor/bin/phpunit -c tests/phpunit.unit.xml vendor/bin/phpunit -c tests/phpunit.xml
vendor/bin/phpunit -c tests/phpunit.integration.xml
echo "travis_fold:end:phpunit" echo "travis_fold:end:phpunit"