forked from jayallen/melody
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#642 state:resolved] Added new config directives, `SupportDirectoryU…
…RL` and `SupportDirectoryPath` which can be accessed through MT base class accessor methods, `support_directory_url()` and `support_directory_path()` and the template tag `mt:SupportDirectoryURL`
- Loading branch information
Showing
6 changed files
with
134 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
# Movable Type (r) Open Source (C) 2001-2010 Six Apart, Ltd. | ||
# This program is distributed under the terms of the | ||
# GNU General Public License, version 2. | ||
# | ||
# $Id: function.mtsupportdirectoryurl.php 5225 2010-01-27 07:14:14Z takayama $ | ||
|
||
function smarty_function_mtsupportdirectoryurl($args, &$ctx) { | ||
require_once "MTUtil.php"; | ||
$url = support_directory_url(); | ||
return $url; | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/usr/bin/perl | ||
|
||
use strict; | ||
use warnings; | ||
BEGIN { | ||
use lib qw( lib extlib t/lib ); | ||
$ENV{MT_CONFIG} = 'sqlite-test.cfg'; | ||
$ENV{MT_APP} = 'MT::App::CMS'; | ||
} | ||
|
||
use Test::More tests => 7; | ||
use MT; | ||
use MT::Test qw( :app :db ); | ||
use MT::Builder; | ||
use MT::Template::Context; | ||
|
||
my $app = MT::App::CMS->instance(); | ||
my $cfg = $app->config; | ||
|
||
diag('Now testing default SupportDirectoryPath and SupportDirectoryURL'); | ||
|
||
is( $cfg->get('SupportDirectoryPath'), '', | ||
'Default SupportDirectoryPath config'); #1 | ||
|
||
is( $cfg->get('SupportDirectoryURL'), '', | ||
'Default SupportDirectoryURL config' ); #2 | ||
|
||
is( $app->support_directory_path(), | ||
File::Spec->catdir( $app->static_file_path, 'support').'/', | ||
'Default $app->support_directory_path()' ); #3 | ||
|
||
is( $app->support_directory_url(), | ||
File::Spec->catdir($app->static_path, 'support').'/', | ||
'Default $app->support_directory_url()' ); #4 | ||
|
||
diag('Now setting SupportDirectoryPath and SupportDirectoryURL'); | ||
|
||
$cfg->set('SupportDirectoryPath', '/PATH/TO/SOME/SUPPORT' ); | ||
$cfg->set('SupportDirectoryURL', 'http://example.com/PATH/TO/SOME/SUPPORT' ); | ||
|
||
is( $app->support_directory_path(), | ||
'/PATH/TO/SOME/SUPPORT/', | ||
'Updated $app->support_directory_path()' ); #5 | ||
|
||
is( $app->support_directory_url(), | ||
'http://example.com/PATH/TO/SOME/SUPPORT/', | ||
'Updated $app->support_directory_path()' ); #6 | ||
|
||
my $builder = MT::Builder->new; | ||
my $ctx = MT::Template::Context->new; | ||
my $tokens = $builder->compile( $ctx, '<$mt:SupportDirectoryURL$>' ); #7 | ||
is( $builder->build( $ctx, $tokens ), | ||
$app->support_directory_url(), | ||
'<$mt:SupportDirectoryURL$>' ); #7 |