ValidatorTest.php 816 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace Test\RichObjectStrings;
  7. use OC\RichObjectStrings\Validator;
  8. use OCP\RichObjectStrings\Definitions;
  9. use Test\TestCase;
  10. class ValidatorTest extends TestCase {
  11. public function test() {
  12. $v = new Validator(new Definitions());
  13. $v->validate('test', []);
  14. $v->validate('test {string1} test {foo} test {bar}.', [
  15. 'string1' => [
  16. 'type' => 'user',
  17. 'id' => 'johndoe',
  18. 'name' => 'John Doe',
  19. ],
  20. 'foo' => [
  21. 'type' => 'user-group',
  22. 'id' => 'sample',
  23. 'name' => 'Sample Group',
  24. ],
  25. 'bar' => [
  26. 'type' => 'file',
  27. 'id' => '42',
  28. 'name' => 'test.txt',
  29. 'path' => 'path/to/test.txt',
  30. ],
  31. ]);
  32. $this->addToAssertionCount(2);
  33. }
  34. }