diff --git a/phpunit.xml b/phpunit.xml
index ddff8e0..caf8d97 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -13,8 +13,13 @@
-
- ./tests
-
+
+
+ ./tests/unit
+
+
+ ./tests/integration
+
+
diff --git a/tests/README.md b/tests/README.md
index a11a86a..0b9f4ee 100644
--- a/tests/README.md
+++ b/tests/README.md
@@ -9,3 +9,10 @@ composer create-project -s dev --prefer-source [--repository '{"type": "vcs", "u
```
./vendor/bin/phpunit [--no-coverage] [--coverage-html coverage]
```
+
+# Test interface availability
+
+These are not code tests. This call checks the accessibility and availability of the interface endpoints. The account login details are requested to perform these tests.
+```
+./vendor/bin/phpunit --no-coverage ~/KlicktippApi/tests/availability/
+```
\ No newline at end of file
diff --git a/tests/availability/AccountTest.php b/tests/availability/AccountTest.php
new file mode 100644
index 0000000..d2e94d9
--- /dev/null
+++ b/tests/availability/AccountTest.php
@@ -0,0 +1,39 @@
+
+ * @link https://www.oxidmodule.com
+ */
+
+declare(strict_types=1);
+
+namespace D3\KlicktippPhpClient\tests\availability;
+
+use D3\KlicktippPhpClient\Resources\Account;
+
+/**
+ * @coversNothing
+ */
+class AccountTest extends AvailabilityTestCase
+{
+ public function testFields(): void
+ {
+ $klicktipp = $this->getKlicktipp();
+ $endpoint = $klicktipp->account();
+
+ $properties = $endpoint->get();
+ $this->assertArrayHasKey(Account::USERNAME, $properties);
+ $this->assertEquals($properties[Account::USERNAME], trim(getenv(AvailabilityTestCase::CLIENT_VAR)));
+
+ $success = $endpoint->logout();
+ $this->assertTrue($success);
+ }
+}
diff --git a/tests/availability/AvailabilityTestCase.php b/tests/availability/AvailabilityTestCase.php
new file mode 100644
index 0000000..be5daec
--- /dev/null
+++ b/tests/availability/AvailabilityTestCase.php
@@ -0,0 +1,53 @@
+
+ * @link https://www.oxidmodule.com
+ */
+
+declare(strict_types=1);
+
+namespace D3\KlicktippPhpClient\tests\availability;
+
+use D3\KlicktippPhpClient\Connection;
+use D3\KlicktippPhpClient\Klicktipp;
+use D3\KlicktippPhpClient\tests\TestCase;
+
+/**
+ * @coversNothing
+ */
+abstract class AvailabilityTestCase extends TestCase
+{
+ public const CLIENT_VAR = 'KLICKTIPP_CLIENT_ENV';
+ public const SECRET_VAR = 'KLICKTIPP_SECRET_ENV';
+
+ public function setUp(): void
+ {
+ if (!strlen((string) getenv('KLICKTIPP_CLIENT_ENV')) || !strlen((string) getenv('KLICKTIPP_SECRET_ENV'))) {
+ fwrite(STDOUT, 'Insert your client key / username: ');
+ $clientKey = fgets(STDIN);
+ putenv(self::CLIENT_VAR.'=' . $clientKey);
+ fwrite(STDOUT, 'Enter your secret / password: ');
+ $secretKey = fgets(STDIN);
+ putenv(self::SECRET_VAR.'=' . $secretKey);
+ }
+
+ parent::setUp();
+ }
+
+ protected function getKlicktipp(): Klicktipp
+ {
+ return new Klicktipp(
+ getenv(self::CLIENT_VAR),
+ getenv(self::SECRET_VAR)
+ );
+ }
+}
diff --git a/tests/availability/FieldTest.php b/tests/availability/FieldTest.php
new file mode 100644
index 0000000..c172a3c
--- /dev/null
+++ b/tests/availability/FieldTest.php
@@ -0,0 +1,64 @@
+
+ * @link https://www.oxidmodule.com
+ */
+
+declare(strict_types=1);
+
+namespace D3\KlicktippPhpClient\tests\availability;
+
+use D3\KlicktippPhpClient\Exceptions\KlicktippExceptionInterface;
+use D3\KlicktippPhpClient\Resources\Field;
+use PHPUnit\Exception;
+
+/**
+ * @coversNothing
+ */
+class FieldTest extends AvailabilityTestCase
+{
+ public function testFields(): void
+ {
+ $klicktipp = $this->getKlicktipp();
+ $endpoint = $klicktipp->field();
+ $fieldId = null;
+
+ try {
+ $fieldId = $endpoint->create('testFieldName');
+ $this->assertNotEmpty($fieldId);
+
+ $properties = $endpoint->get($fieldId);
+ $this->assertArrayHasKey(Field::NAME, $properties);
+ $this->assertEquals($properties[Field::NAME], 'testFieldName');
+
+ $fieldList = $endpoint->index();
+ $this->assertArrayHasKey('field'.$fieldId, $fieldList->toArray());
+
+ $success = $endpoint->update($fieldId, 'updatedTestFieldName');
+ $this->assertTrue($success);
+
+ $success = $endpoint->delete($fieldId);
+ $this->assertTrue($success);
+
+ } catch (KlicktippExceptionInterface|Exception $exception) {
+ if ($fieldId) {
+ if (!$endpoint->delete($fieldId)) {
+ echo "can't delete field with id $fieldId\n";
+ };
+ }
+
+ throw $exception;
+ } finally {
+ $klicktipp->account()->logout();
+ }
+ }
+}
diff --git a/tests/availability/TagTest.php b/tests/availability/TagTest.php
new file mode 100644
index 0000000..210ee2b
--- /dev/null
+++ b/tests/availability/TagTest.php
@@ -0,0 +1,65 @@
+
+ * @link https://www.oxidmodule.com
+ */
+
+declare(strict_types=1);
+
+namespace D3\KlicktippPhpClient\tests\availability;
+
+use D3\KlicktippPhpClient\Exceptions\KlicktippExceptionInterface;
+use D3\KlicktippPhpClient\Resources\Tag;
+
+/**
+ * @coversNothing
+ */
+class TagTest extends AvailabilityTestCase
+{
+ /**
+ * @return void
+ * @throws KlicktippExceptionInterface
+ */
+ public function testFields(): void
+ {
+ $klicktipp = $this->getKlicktipp();
+ $endpoint = $klicktipp->tag();
+ $tagId = null;
+
+ try {
+ $tagId = $endpoint->create('testTagName');
+ $this->assertNotEmpty($tagId);
+
+ $properties = $endpoint->get($tagId);
+ $this->assertArrayHasKey(Tag::NAME, $properties);
+ $this->assertEquals('testTagName', $properties[Tag::NAME]);
+
+ $fieldList = $endpoint->index();
+ $this->assertArrayHasKey($tagId, $fieldList->toArray());
+
+ $success = $endpoint->update($tagId, 'updatedTestFieldName');
+ $this->assertTrue($success);
+
+ $success = $endpoint->delete($tagId);
+ $this->assertTrue($success);
+
+ } catch (KlicktippExceptionInterface $exception) {
+ if ($tagId) {
+ if (!$endpoint->delete($tagId)) {
+ echo "can't delete tag with id $tagId\n";
+ }
+ }
+
+ throw $exception;
+ }
+ }
+}