Merge branch 'master' of git@github.com:plainblack/webgui
This commit is contained in:
commit
fa40b99182
52 changed files with 3081 additions and 3155 deletions
|
|
@ -935,10 +935,12 @@ like($message, qr/Exported $numberCreatedAll pages/, "... returns correct messag
|
|||
$extrasSymlink = Path::Class::File->new($exportPath, $extrasUrl);
|
||||
$uploadsSymlink = Path::Class::File->new($exportPath, $uploadsUrl);
|
||||
|
||||
ok(-e $extrasSymlink->absolute->stringify, "exportAsHtml writes extras symlink");
|
||||
ok(-e $extrasSymlink->absolute->stringify, "exportAsHtml writes extras symlink")
|
||||
or diag "link not found at " . $extrasSymlink->absolute;
|
||||
is(readlink $extrasSymlink->absolute->stringify, $extrasPath, "exportAsHtml extras symlink points to right place");
|
||||
|
||||
ok(-e $uploadsSymlink->absolute->stringify, "exportAsHtml writes uploads symlink");
|
||||
ok(-e $uploadsSymlink->absolute->stringify, "exportAsHtml writes uploads symlink")
|
||||
or diag "link not found at " . $uploadsSymlink->absolute;
|
||||
is(readlink $uploadsSymlink->absolute->stringify, $uploadsPath, "exportAsHtml uploads symlink points to right place");
|
||||
|
||||
# next, make sure the root URL symlinking works.
|
||||
|
|
@ -946,6 +948,7 @@ eval { ($message) = $parent->exportAsHtml( { userId => 3, depth => 99, rootUr
|
|||
my $rootUrlSymlink = Path::Class::File->new($exportPath, 'index.html');
|
||||
is($@, '', 'exportAsHtml does not throw an error when linking root URL');
|
||||
like($message, qr/Exported $numberCreatedAll pages/, "... returns correct message");
|
||||
ok(-l $rootUrlSymlink->absolute->stringify, "... writes root URL symlink");
|
||||
ok(-l $rootUrlSymlink->absolute->stringify, "... writes root URL symlink")
|
||||
or diag "link not found at " . $rootUrlSymlink->absolute;
|
||||
is(readlink $rootUrlSymlink->absolute->stringify, WebGUI::Asset->getDefault($session)->exportGetUrlAsPath->absolute->stringify, "... root URL symlink points to right place");
|
||||
|
||||
|
|
|
|||
64
t/Asset/Post/Thread.t
Normal file
64
t/Asset/Post/Thread.t
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use FindBin;
|
||||
use strict;
|
||||
use lib "$FindBin::Bin/../../lib";
|
||||
use WebGUI::Test;
|
||||
use WebGUI::Session;
|
||||
use Test::More tests => 2; # increment this value for each test you create
|
||||
use Test::MockObject::Extends;
|
||||
use WebGUI::Asset::Wobject::Collaboration;
|
||||
use WebGUI::Asset::Post::Thread;
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
# Do our work in the import node
|
||||
my $node = WebGUI::Asset->getImportNode($session);
|
||||
|
||||
# Grab a named version tag
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"Collab setup"});
|
||||
addToCleanup($versionTag);
|
||||
|
||||
# Need to create a Collaboration system in which the post lives.
|
||||
my @addArgs = ( undef, undef, { skipAutoCommitWorkflows => 1, skipNotification => 1 } );
|
||||
my $collab = $node->addChild({className => 'WebGUI::Asset::Wobject::Collaboration', editTimeout => '1'}, @addArgs);
|
||||
|
||||
|
||||
# finally, add the post to the collaboration system
|
||||
my $props = {
|
||||
className => 'WebGUI::Asset::Post::Thread',
|
||||
content => 'hello, world!',
|
||||
ownerUserId => 1,
|
||||
};
|
||||
|
||||
my $thread = $collab->addChild($props, @addArgs);
|
||||
|
||||
$versionTag->commit();
|
||||
|
||||
# Test for a sane object type
|
||||
isa_ok($thread, 'WebGUI::Asset::Post::Thread');
|
||||
|
||||
my $env = $session->env;
|
||||
$env = Test::MockObject::Extends->new($env);
|
||||
|
||||
my %mockEnv = (
|
||||
REMOTE_ADDR => '192.168.0.2',
|
||||
);
|
||||
|
||||
$env->mock('get', sub { return $mockEnv{$_[1]}});
|
||||
|
||||
$session->user({userId => 3});
|
||||
$thread->rate(1);
|
||||
$thread->trash;
|
||||
is($thread->get('threadRating'), 0, 'trash does not die, and updates the threadRating to 0');
|
||||
|
||||
# vim: syntax=perl filetype=perl
|
||||
|
|
@ -122,6 +122,7 @@ $story = $archive->addChild({
|
|||
title => 'Story 1',
|
||||
subtitle => 'The story of a CMS',
|
||||
byline => 'JT Smith',
|
||||
story => 'WebGUI was originally called Web Done Right.',
|
||||
});
|
||||
|
||||
isa_ok($story, 'WebGUI::Asset::Story', 'Created a Story asset');
|
||||
|
|
@ -276,7 +277,7 @@ cmp_deeply(
|
|||
$story->getRssData,
|
||||
{
|
||||
title => 'Story 1',
|
||||
description => 'The story of a CMS',
|
||||
description => 'WebGUI was originally called Web Done Right.',
|
||||
'link' => re('story-1$'),
|
||||
author => 'JT Smith',
|
||||
date => $story->get('lastModified'),
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ use lib "$FindBin::Bin/../lib";
|
|||
|
||||
use WebGUI::Test;
|
||||
use WebGUI::Session;
|
||||
use Test::More tests => 18; # increment this value for each test you create
|
||||
use Test::More tests => 17; # increment this value for each test you create
|
||||
use WebGUI::Asset::Wobject::WikiMaster;
|
||||
use WebGUI::Asset::WikiPage;
|
||||
|
||||
|
|
@ -25,15 +25,16 @@ my $session = WebGUI::Test->session;
|
|||
my $node = WebGUI::Asset->getImportNode($session);
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"Wiki Test"});
|
||||
WebGUI::Test->tagsToRollback($versionTag);
|
||||
addToCleanup($versionTag);
|
||||
|
||||
my $wiki = $node->addChild({className=>'WebGUI::Asset::Wobject::WikiMaster'});
|
||||
$versionTag->commit;
|
||||
my $wikipage = $wiki->addChild({className=>'WebGUI::Asset::WikiPage'});
|
||||
my $wikipage = $wiki->addChild({className=>'WebGUI::Asset::WikiPage'}, undef, undef, {skipAutoCommitWorkflows => 1});
|
||||
|
||||
# Wikis create and autocommit a version tag when a child is added. Lets get the name so we can roll it back.
|
||||
my $secondVersionTag = WebGUI::VersionTag->new($session,$wikipage->get("tagId"));
|
||||
WebGUI::Test->tagsToRollback($secondVersionTag );
|
||||
$secondVersionTag->commit;
|
||||
addToCleanup($secondVersionTag );
|
||||
|
||||
# Test for sane object types
|
||||
isa_ok($wiki, 'WebGUI::Asset::Wobject::WikiMaster');
|
||||
|
|
@ -85,11 +86,3 @@ $comments = $wikipage->get('comments');
|
|||
is($comments->[0]{comment}, $secondComment, "you can delete a comment");
|
||||
is($wikipage->get('averageCommentRating'), 1, 'average rating is adjusted after deleting a comment');
|
||||
|
||||
|
||||
##################
|
||||
|
||||
TODO: {
|
||||
local $TODO = "Tests to make later";
|
||||
ok(0, 'Lots and lots to do');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ cmp_deeply(
|
|||
|
||||
$session->user({userId => 3});
|
||||
my $json = $matrix->www_getCompareFormData('score');
|
||||
diag $session->getId;
|
||||
note $session->getId;
|
||||
|
||||
my $compareFormData = JSON->new->decode($json);
|
||||
|
||||
|
|
|
|||
|
|
@ -266,6 +266,7 @@ like($storage->getFileContentsAsScalar($filename), qr{
|
|||
|
||||
}
|
||||
|
||||
$survey->getAdminConsole();
|
||||
my $adminConsole = $survey->getAdminConsole();
|
||||
cmp_deeply(
|
||||
$adminConsole->{_submenuItem},
|
||||
|
|
|
|||
|
|
@ -20,9 +20,11 @@ use Data::Dumper;
|
|||
|
||||
use WebGUI::Test;
|
||||
use WebGUI::Session;
|
||||
use Test::More tests => 20; # increment this value for each test you create
|
||||
use Test::More tests => 21; # increment this value for each test you create
|
||||
use Test::Deep;
|
||||
use WebGUI::Asset::Wobject::SyndicatedContent;
|
||||
use XML::FeedPP;
|
||||
use WebGUI::Cache;
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
my %var;
|
||||
|
|
@ -36,7 +38,7 @@ my $node = WebGUI::Asset->getImportNode($session);
|
|||
# Create a version tag to work in
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"SyndicatedContent Test"});
|
||||
WebGUI::Test->tagsToRollback($versionTag);
|
||||
addToCleanup($versionTag);
|
||||
my $syndicated_content = $node->addChild({className=>'WebGUI::Asset::Wobject::SyndicatedContent'});
|
||||
|
||||
##############################
|
||||
|
|
@ -138,3 +140,39 @@ EOFEED
|
|||
|
||||
my $vars = $syndicated_content->getTemplateVariables($feed);
|
||||
ok( defined $vars->{item_loop}->[0]->{description}, 'getTemplateVariables: description is not undefined');
|
||||
|
||||
####################################################################
|
||||
#
|
||||
# generateFeed, hasTerms
|
||||
#
|
||||
####################################################################
|
||||
|
||||
my $tbbUrl = 'http://www.plainblack.com/tbb.rss';
|
||||
$syndicated_content->update({
|
||||
rssUrl => $tbbUrl,
|
||||
hasTerms => 'WebGUI',
|
||||
});
|
||||
|
||||
my $cache = WebGUI::Cache->new($session, $tbbUrl, 'RSS');
|
||||
open my $rssFile, '<', WebGUI::Test->getTestCollateralPath('tbb.rss')
|
||||
or die "Unable to get RSS file";
|
||||
my $rssContent = do { local $/; <$rssFile>; };
|
||||
close $rssFile;
|
||||
$cache->set($rssContent, 60);
|
||||
|
||||
my $filteredFeed = $syndicated_content->generateFeed();
|
||||
|
||||
use Data::Dumper;
|
||||
diag Dumper($filteredFeed->get_item());
|
||||
|
||||
cmp_deeply(
|
||||
[ map { $_->title } $filteredFeed->get_item() ],
|
||||
[
|
||||
'Google Picasa Plugin for WebGUI Gallery',
|
||||
'WebGUI Roadmap',
|
||||
'WebGUI 8 Performance',
|
||||
],
|
||||
'generateFeed: filters items based on the terms being in title, or description'
|
||||
);
|
||||
|
||||
$cache->delete;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue