for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare( strict_types = 1 );
namespace Maps\Tests\Util;
use CommentStoreComment;
use Title;
use User;
/**
* @licence GNU GPL v2+
* @author Jeroen De Dauw < [email protected] >
*/
class PageCreator {
public function createPage( string $title, string $content = null ) {
$titleObject = Title::newFromText( $title );
$this->createPageWithContent(
$title,
\ContentHandler::makeContent( $content ?? 'Content of ' . $title, $titleObject )
);
}
public function createPageWithContent( string $title, \Content $content ) {
$page = new \WikiPage( $titleObject );
$updater = $page->newPageUpdater( User::newSystemUser( 'TestUser' ) );
$updater->setContent( 'main', $content );
$updater->saveRevision( CommentStoreComment::newUnsavedComment( __CLASS__ . ' creating page ' . $title ) );