SproutCMS

This is the code documentation for the SproutCMS project

source of /sprout/tests/tagsTest.php

  1. <?php
  2. /*
  3.  * Copyright (C) 2017 Karmabunny Pty Ltd.
  4.  *
  5.  * This file is a part of SproutCMS.
  6.  *
  7.  * SproutCMS is free software: you can redistribute it and/or modify it under the terms
  8.  * of the GNU General Public License as published by the Free Software Foundation, either
  9.  * version 2 of the License, or (at your option) any later version.
  10.  *
  11.  * For more information, visit <http://getsproutcms.com>.
  12.  */
  13.  
  14. use Sprout\Helpers\Tags;
  15.  
  16.  
  17. class tagsTest extends PHPUnit_Framework_TestCase
  18. {
  19.  
  20. public function dataSplitupTags()
  21. {
  22. return [
  23. ['', []],
  24. ['hey', ['hey']],
  25. ['HEY', ['hey']],
  26. ['!!hey!!', ['hey']],
  27. ['hi,bye', ['hi', 'bye']],
  28. [' hi,bye', ['hi', 'bye']],
  29. ['hi, bye', ['hi', 'bye']],
  30. ['hi ,bye', ['hi', 'bye']],
  31. ['hi,bye ', ['hi', 'bye']],
  32. ['hi,bye, ', ['hi', 'bye']],
  33. [' , hi , bye , ', ['hi', 'bye']],
  34. ['hi,hi', ['hi']],
  35. ['hi,,bye', ['hi', 'bye']],
  36. ];
  37. }
  38.  
  39. /**
  40.   * @dataProvider dataSplitupTags
  41.   */
  42. public function testSplitupTags($string, $expect)
  43. {
  44. $this->assertEquals($expect, Tags::splitupTags($string));
  45. }
  46.  
  47. }
  48.