SproutCMS

This is the code documentation for the SproutCMS project

source of /sprout/tests/subsitesTest.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\Subsites;
  15.  
  16. class subsitesTest extends PHPUnit_Framework_TestCase
  17. {
  18.  
  19. /**
  20.   * @expectedException InvalidArgumentException
  21.   **/
  22. public function testGetAbsRootMissing()
  23. {
  24. Subsites::getAbsRoot(0);
  25. }
  26.  
  27. public function testGetAbsRoot()
  28. {
  29. $result = Subsites::getAbsRoot(1);
  30. $this->assertNotNull($result);
  31. $this->assertContains('http://', $result);
  32. $this->assertNotContains('http:///', $result);
  33. $this->assertContains($_SERVER['HTTP_HOST'], $result);
  34. $this->assertContains(Kohana::config('config.site_domain'), $result);
  35. $this->assertNotFalse(preg_match('!/$!', $result));
  36. }
  37.  
  38. }
  39.