Skip to content

Instantly share code, notes, and snippets.

@muskie9
Created September 5, 2017 14:11
Show Gist options
  • Save muskie9/3c578d4a4a372214ffa06a444fd9775e to your computer and use it in GitHub Desktop.
Save muskie9/3c578d4a4a372214ffa06a444fd9775e to your computer and use it in GitHub Desktop.
<?php
namespace MySite\Tests;
use SilverStripe\Dev\SapphireTest;
/**
* Class PageTest
* @package MySite\Tests
*/
class PageTest extends SapphireTest
{
/**
* @var string
*/
protected static $fixture_file = '';
/**
*
*/
public function testLink()
{
$this->logInWithPermission('ADMIN');
$page = \Page::create(['title' => 'Hello World', 'URLSegment' => 'hello-world']);
$page->write();
$page->publishRecursive();
$expected = '/hello-world/';
$actual = $page->Link(); //- actual is absolute path to webroot /var/www/public/silverstripe4.dev
$this->assertEquals($expected, $actual);
$this->logOut();
}
}
@muskie9
Copy link
Author

muskie9 commented Sep 5, 2017

screen shot 2017-09-05 at 9 08 19 am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment