SproutCMS

This is the code documentation for the SproutCMS project

source of /sprout/tests/registerTest.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\Register;
  15.  
  16. class registerTest extends PHPUnit_Framework_TestCase
  17. {
  18.  
  19. public function testModerator()
  20. {
  21. Register::moderator('Abc');
  22. $mods = Register::getModerators();
  23.  
  24. $this->assertInternalType('array', $mods);
  25. $this->assertTrue(in_array('Abc', $mods));
  26. }
  27.  
  28.  
  29. public function testExtrapage()
  30. {
  31. Register::extraPage('abc', 'Abc');
  32. $extra = Register::getExtraPages();
  33.  
  34. $this->assertInternalType('array', $extra);
  35. $this->assertTrue($extra['abc'] == 'Abc');
  36. }
  37.  
  38.  
  39. public function testPageattr()
  40. {
  41. Register::pageattr('abc', 'Abc');
  42. Register::pageattr('def', 'Def', 'Sprout\\Helpers\\AttrEditorImage');
  43.  
  44. $attrs = Register::getPageattrs();
  45.  
  46. $this->assertInternalType('array', $attrs);
  47. $this->assertEquals(array('Abc', 'Sprout\\Helpers\\AttrEditorTextbox'), $attrs['abc']);
  48. $this->assertEquals(array('Def', 'Sprout\\Helpers\\AttrEditorImage'), $attrs['def']);
  49. }
  50. }
  51.