Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/registration.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPellaeon Lin <nfsmwlin@gmail.com>2017-09-17 11:48:38 +0300
committerPellaeon Lin <nfsmwlin@gmail.com>2017-10-03 10:44:52 +0300
commit96a73ee827d0fe6419f8827adebc2f3360de7489 (patch)
tree0c4f87e454902a2a6e82639e57f63ac812f72cae /tests
parent87f902a4f1f1488e23a9f6d2161dc580539dc3bb (diff)
Add some tests and enable travisCI
Diffstat (limited to 'tests')
-rw-r--r--tests/phpunit.xml12
-rw-r--r--tests/unit/controller/ApiControllerTest.php20
2 files changed, 22 insertions, 10 deletions
diff --git a/tests/phpunit.xml b/tests/phpunit.xml
new file mode 100644
index 0000000..ac9424d
--- /dev/null
+++ b/tests/phpunit.xml
@@ -0,0 +1,12 @@
+<phpunit bootstrap="autoloader.php" colors="true">
+ <testsuites>
+ <testsuite name="unit">
+ <directory>./unit</directory>
+ </testsuite>
+ </testsuites>
+ <filter>
+ <whitelist>
+ <directory suffix=".php">./</directory>
+ </whitelist>
+ </filter>
+</phpunit>
diff --git a/tests/unit/controller/ApiControllerTest.php b/tests/unit/controller/ApiControllerTest.php
index d16a43b..c466e10 100644
--- a/tests/unit/controller/ApiControllerTest.php
+++ b/tests/unit/controller/ApiControllerTest.php
@@ -122,10 +122,10 @@ class ApiControllerTest extends TestCase {
*/
public function testStatusNoRegistration() {
$this->registrationService
- ->method('getRegistrationForToken')
- ->with('ABCDEF')
+ ->method('getRegistrationForSecret')
+ ->with('L2qdLAtrJTx499ErjwkwnZqGmLdm3Acp')
->willThrowException(new DoesNotExistException(''));
- $this->controller->status('ABCDEF');
+ $this->controller->status('L2qdLAtrJTx499ErjwkwnZqGmLdm3Acp');
}
/**
@@ -136,10 +136,10 @@ class ApiControllerTest extends TestCase {
$registration = new Registration();
$registration->setEmailConfirmed(false);
$this->registrationService
- ->method('getRegistrationForToken')
- ->with('ABCDEF')
+ ->method('getRegistrationForSecret')
+ ->with('L2qdLAtrJTx499ErjwkwnZqGmLdm3Acp')
->willReturn($registration);
- $actual = $this->controller->status('ABCDEF');
+ $actual = $this->controller->status('L2qdLAtrJTx499ErjwkwnZqGmLdm3Acp');
}
public function testStatusConfirmedRegistration() {
@@ -148,8 +148,8 @@ class ApiControllerTest extends TestCase {
$registration->setClientSecret('mysecret');
$user = $this->createMock(IUser::class);
$this->registrationService
- ->method('getRegistrationForToken')
- ->with('ABCDEF')
+ ->method('getRegistrationForSecret')
+ ->with('mysecret')
->willReturn($registration);
$this->registrationService
->expects($this->once())
@@ -162,7 +162,7 @@ class ApiControllerTest extends TestCase {
$this->registrationService
->expects($this->once())
->method('generateAppPassword');
- $actual = $this->controller->status('ABCDEF');
+ $actual = $this->controller->status('mysecret');
$expected = new DataResponse([]);
$this->assertEquals($expected, $actual);
}
@@ -171,4 +171,4 @@ class ApiControllerTest extends TestCase {
}
-} \ No newline at end of file
+}