} element to specify the
- * language, as in {@code }. Any class that
- * starts with "lang-" followed by a file extension, specifies the file type.
- * See the "lang-*.js" files in this directory for code that implements
- * per-language file handlers.
- *
- * Change log:
- * cbeust, 2006/08/22
- *
- * Java annotations (start with "@") are now captured as literals ("lit")
- *
- * @requires console
- */
-
-// JSLint declarations
-/*global console, document, navigator, setTimeout, window */
-
-/**
- * Split {@code prettyPrint} into multiple timeouts so as not to interfere with
- * UI events.
- * If set to {@code false}, {@code prettyPrint()} is synchronous.
- */
-window['PR_SHOULD_USE_CONTINUATION'] = true;
-
-(function () {
- // Keyword lists for various languages.
- // We use things that coerce to strings to make them compact when minified
- // and to defeat aggressive optimizers that fold large string constants.
- var FLOW_CONTROL_KEYWORDS = ["break,continue,do,else,for,if,return,while"];
- var C_KEYWORDS = [FLOW_CONTROL_KEYWORDS,"auto,case,char,const,default," +
- "double,enum,extern,float,goto,int,long,register,short,signed,sizeof," +
- "static,struct,switch,typedef,union,unsigned,void,volatile"];
- var COMMON_KEYWORDS = [C_KEYWORDS,"catch,class,delete,false,import," +
- "new,operator,private,protected,public,this,throw,true,try,typeof"];
- var CPP_KEYWORDS = [COMMON_KEYWORDS,"alignof,align_union,asm,axiom,bool," +
- "concept,concept_map,const_cast,constexpr,decltype," +
- "dynamic_cast,explicit,export,friend,inline,late_check," +
- "mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast," +
- "template,typeid,typename,using,virtual,where"];
- var JAVA_KEYWORDS = [COMMON_KEYWORDS,
- "abstract,boolean,byte,extends,final,finally,implements,import," +
- "instanceof,null,native,package,strictfp,super,synchronized,throws," +
- "transient"];
- var CSHARP_KEYWORDS = [JAVA_KEYWORDS,
- "as,base,by,checked,decimal,delegate,descending,dynamic,event," +
- "fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock," +
- "object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed," +
- "stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];
- var COFFEE_KEYWORDS = "all,and,by,catch,class,else,extends,false,finally," +
- "for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then," +
- "true,try,unless,until,when,while,yes";
- var JSCRIPT_KEYWORDS = [COMMON_KEYWORDS,
- "debugger,eval,export,function,get,null,set,undefined,var,with," +
- "Infinity,NaN"];
- var PERL_KEYWORDS = "caller,delete,die,do,dump,elsif,eval,exit,foreach,for," +
- "goto,if,import,last,local,my,next,no,our,print,package,redo,require," +
- "sub,undef,unless,until,use,wantarray,while,BEGIN,END";
- var PYTHON_KEYWORDS = [FLOW_CONTROL_KEYWORDS, "and,as,assert,class,def,del," +
- "elif,except,exec,finally,from,global,import,in,is,lambda," +
- "nonlocal,not,or,pass,print,raise,try,with,yield," +
- "False,True,None"];
- var RUBY_KEYWORDS = [FLOW_CONTROL_KEYWORDS, "alias,and,begin,case,class," +
- "def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo," +
- "rescue,retry,self,super,then,true,undef,unless,until,when,yield," +
- "BEGIN,END"];
- var SH_KEYWORDS = [FLOW_CONTROL_KEYWORDS, "case,done,elif,esac,eval,fi," +
- "function,in,local,set,then,until"];
- var ALL_KEYWORDS = [
- CPP_KEYWORDS, CSHARP_KEYWORDS, JSCRIPT_KEYWORDS, PERL_KEYWORDS +
- PYTHON_KEYWORDS, RUBY_KEYWORDS, SH_KEYWORDS];
- var C_TYPES = /^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;
-
- // token style names. correspond to css classes
- /**
- * token style for a string literal
- * @const
- */
- var PR_STRING = 'str';
- /**
- * token style for a keyword
- * @const
- */
- var PR_KEYWORD = 'kwd';
- /**
- * token style for a comment
- * @const
- */
- var PR_COMMENT = 'com';
- /**
- * token style for a type
- * @const
- */
- var PR_TYPE = 'typ';
- /**
- * token style for a literal value. e.g. 1, null, true.
- * @const
- */
- var PR_LITERAL = 'lit';
- /**
- * token style for a punctuation string.
- * @const
- */
- var PR_PUNCTUATION = 'pun';
- /**
- * token style for a punctuation string.
- * @const
- */
- var PR_PLAIN = 'pln';
-
- /**
- * token style for an sgml tag.
- * @const
- */
- var PR_TAG = 'tag';
- /**
- * token style for a markup declaration such as a DOCTYPE.
- * @const
- */
- var PR_DECLARATION = 'dec';
- /**
- * token style for embedded source.
- * @const
- */
- var PR_SOURCE = 'src';
- /**
- * token style for an sgml attribute name.
- * @const
- */
- var PR_ATTRIB_NAME = 'atn';
- /**
- * token style for an sgml attribute value.
- * @const
- */
- var PR_ATTRIB_VALUE = 'atv';
-
- /**
- * A class that indicates a section of markup that is not code, e.g. to allow
- * embedding of line numbers within code listings.
- * @const
- */
- var PR_NOCODE = 'nocode';
-
-
-
-/**
- * A set of tokens that can precede a regular expression literal in
- * javascript
- * http://web.archive.org/web/20070717142515/http://www.mozilla.org/js/language/js20/rationale/syntax.html
- * has the full list, but I've removed ones that might be problematic when
- * seen in languages that don't support regular expression literals.
- *
- * Specifically, I've removed any keywords that can't precede a regexp
- * literal in a syntactically legal javascript program, and I've removed the
- * "in" keyword since it's not a keyword in many languages, and might be used
- * as a count of inches.
- *
- *
The link a above does not accurately describe EcmaScript rules since
- * it fails to distinguish between (a=++/b/i) and (a++/b/i) but it works
- * very well in practice.
- *
- * @private
- * @const
- */
-var REGEXP_PRECEDER_PATTERN = '(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*';
-
-// CAVEAT: this does not properly handle the case where a regular
-// expression immediately follows another since a regular expression may
-// have flags for case-sensitivity and the like. Having regexp tokens
-// adjacent is not valid in any language I'm aware of, so I'm punting.
-// TODO: maybe style special characters inside a regexp as punctuation.
-
-
- /**
- * Given a group of {@link RegExp}s, returns a {@code RegExp} that globally
- * matches the union of the sets of strings matched by the input RegExp.
- * Since it matches globally, if the input strings have a start-of-input
- * anchor (/^.../), it is ignored for the purposes of unioning.
- * @param {Array.} regexs non multiline, non-global regexs.
- * @return {RegExp} a global regex.
- */
- function combinePrefixPatterns(regexs) {
- var capturedGroupIndex = 0;
-
- var needToFoldCase = false;
- var ignoreCase = false;
- for (var i = 0, n = regexs.length; i < n; ++i) {
- var regex = regexs[i];
- if (regex.ignoreCase) {
- ignoreCase = true;
- } else if (/[a-z]/i.test(regex.source.replace(
- /\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi, ''))) {
- needToFoldCase = true;
- ignoreCase = false;
- break;
- }
- }
-
- var escapeCharToCodeUnit = {
- 'b': 8,
- 't': 9,
- 'n': 0xa,
- 'v': 0xb,
- 'f': 0xc,
- 'r': 0xd
- };
-
- function decodeEscape(charsetPart) {
- var cc0 = charsetPart.charCodeAt(0);
- if (cc0 !== 92 /* \\ */) {
- return cc0;
- }
- var c1 = charsetPart.charAt(1);
- cc0 = escapeCharToCodeUnit[c1];
- if (cc0) {
- return cc0;
- } else if ('0' <= c1 && c1 <= '7') {
- return parseInt(charsetPart.substring(1), 8);
- } else if (c1 === 'u' || c1 === 'x') {
- return parseInt(charsetPart.substring(2), 16);
- } else {
- return charsetPart.charCodeAt(1);
- }
- }
-
- function encodeEscape(charCode) {
- if (charCode < 0x20) {
- return (charCode < 0x10 ? '\\x0' : '\\x') + charCode.toString(16);
- }
- var ch = String.fromCharCode(charCode);
- if (ch === '\\' || ch === '-' || ch === '[' || ch === ']') {
- ch = '\\' + ch;
- }
- return ch;
- }
-
- function caseFoldCharset(charSet) {
- var charsetParts = charSet.substring(1, charSet.length - 1).match(
- new RegExp(
- '\\\\u[0-9A-Fa-f]{4}'
- + '|\\\\x[0-9A-Fa-f]{2}'
- + '|\\\\[0-3][0-7]{0,2}'
- + '|\\\\[0-7]{1,2}'
- + '|\\\\[\\s\\S]'
- + '|-'
- + '|[^-\\\\]',
- 'g'));
- var groups = [];
- var ranges = [];
- var inverse = charsetParts[0] === '^';
- for (var i = inverse ? 1 : 0, n = charsetParts.length; i < n; ++i) {
- var p = charsetParts[i];
- if (/\\[bdsw]/i.test(p)) { // Don't muck with named groups.
- groups.push(p);
- } else {
- var start = decodeEscape(p);
- var end;
- if (i + 2 < n && '-' === charsetParts[i + 1]) {
- end = decodeEscape(charsetParts[i + 2]);
- i += 2;
- } else {
- end = start;
- }
- ranges.push([start, end]);
- // If the range might intersect letters, then expand it.
- // This case handling is too simplistic.
- // It does not deal with non-latin case folding.
- // It works for latin source code identifiers though.
- if (!(end < 65 || start > 122)) {
- if (!(end < 65 || start > 90)) {
- ranges.push([Math.max(65, start) | 32, Math.min(end, 90) | 32]);
- }
- if (!(end < 97 || start > 122)) {
- ranges.push([Math.max(97, start) & ~32, Math.min(end, 122) & ~32]);
- }
- }
- }
- }
-
- // [[1, 10], [3, 4], [8, 12], [14, 14], [16, 16], [17, 17]]
- // -> [[1, 12], [14, 14], [16, 17]]
- ranges.sort(function (a, b) { return (a[0] - b[0]) || (b[1] - a[1]); });
- var consolidatedRanges = [];
- var lastRange = [NaN, NaN];
- for (var i = 0; i < ranges.length; ++i) {
- var range = ranges[i];
- if (range[0] <= lastRange[1] + 1) {
- lastRange[1] = Math.max(lastRange[1], range[1]);
- } else {
- consolidatedRanges.push(lastRange = range);
- }
- }
-
- var out = ['['];
- if (inverse) { out.push('^'); }
- out.push.apply(out, groups);
- for (var i = 0; i < consolidatedRanges.length; ++i) {
- var range = consolidatedRanges[i];
- out.push(encodeEscape(range[0]));
- if (range[1] > range[0]) {
- if (range[1] + 1 > range[0]) { out.push('-'); }
- out.push(encodeEscape(range[1]));
- }
- }
- out.push(']');
- return out.join('');
- }
-
- function allowAnywhereFoldCaseAndRenumberGroups(regex) {
- // Split into character sets, escape sequences, punctuation strings
- // like ('(', '(?:', ')', '^'), and runs of characters that do not
- // include any of the above.
- var parts = regex.source.match(
- new RegExp(
- '(?:'
- + '\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]' // a character set
- + '|\\\\u[A-Fa-f0-9]{4}' // a unicode escape
- + '|\\\\x[A-Fa-f0-9]{2}' // a hex escape
- + '|\\\\[0-9]+' // a back-reference or octal escape
- + '|\\\\[^ux0-9]' // other escape sequence
- + '|\\(\\?[:!=]' // start of a non-capturing group
- + '|[\\(\\)\\^]' // start/emd of a group, or line start
- + '|[^\\x5B\\x5C\\(\\)\\^]+' // run of other characters
- + ')',
- 'g'));
- var n = parts.length;
-
- // Maps captured group numbers to the number they will occupy in
- // the output or to -1 if that has not been determined, or to
- // undefined if they need not be capturing in the output.
- var capturedGroups = [];
-
- // Walk over and identify back references to build the capturedGroups
- // mapping.
- for (var i = 0, groupIndex = 0; i < n; ++i) {
- var p = parts[i];
- if (p === '(') {
- // groups are 1-indexed, so max group index is count of '('
- ++groupIndex;
- } else if ('\\' === p.charAt(0)) {
- var decimalValue = +p.substring(1);
- if (decimalValue && decimalValue <= groupIndex) {
- capturedGroups[decimalValue] = -1;
- }
- }
- }
-
- // Renumber groups and reduce capturing groups to non-capturing groups
- // where possible.
- for (var i = 1; i < capturedGroups.length; ++i) {
- if (-1 === capturedGroups[i]) {
- capturedGroups[i] = ++capturedGroupIndex;
- }
- }
- for (var i = 0, groupIndex = 0; i < n; ++i) {
- var p = parts[i];
- if (p === '(') {
- ++groupIndex;
- if (capturedGroups[groupIndex] === undefined) {
- parts[i] = '(?:';
- }
- } else if ('\\' === p.charAt(0)) {
- var decimalValue = +p.substring(1);
- if (decimalValue && decimalValue <= groupIndex) {
- parts[i] = '\\' + capturedGroups[groupIndex];
- }
- }
- }
-
- // Remove any prefix anchors so that the output will match anywhere.
- // ^^ really does mean an anchored match though.
- for (var i = 0, groupIndex = 0; i < n; ++i) {
- if ('^' === parts[i] && '^' !== parts[i + 1]) { parts[i] = ''; }
- }
-
- // Expand letters to groups to handle mixing of case-sensitive and
- // case-insensitive patterns if necessary.
- if (regex.ignoreCase && needToFoldCase) {
- for (var i = 0; i < n; ++i) {
- var p = parts[i];
- var ch0 = p.charAt(0);
- if (p.length >= 2 && ch0 === '[') {
- parts[i] = caseFoldCharset(p);
- } else if (ch0 !== '\\') {
- // TODO: handle letters in numeric escapes.
- parts[i] = p.replace(
- /[a-zA-Z]/g,
- function (ch) {
- var cc = ch.charCodeAt(0);
- return '[' + String.fromCharCode(cc & ~32, cc | 32) + ']';
- });
- }
- }
- }
-
- return parts.join('');
- }
-
- var rewritten = [];
- for (var i = 0, n = regexs.length; i < n; ++i) {
- var regex = regexs[i];
- if (regex.global || regex.multiline) { throw new Error('' + regex); }
- rewritten.push(
- '(?:' + allowAnywhereFoldCaseAndRenumberGroups(regex) + ')');
- }
-
- return new RegExp(rewritten.join('|'), ignoreCase ? 'gi' : 'g');
- }
-
-
- /**
- * Split markup into a string of source code and an array mapping ranges in
- * that string to the text nodes in which they appear.
- *
- *
- * The HTML DOM structure:
- *
- * (Element "p"
- * (Element "b"
- * (Text "print ")) ; #1
- * (Text "'Hello '") ; #2
- * (Element "br") ; #3
- * (Text " + 'World';")) ; #4
- *
- *
- * corresponds to the HTML
- * {@code
print 'Hello ' + 'World';
}.
- *
- *
- * It will produce the output:
- *
- * {
- * sourceCode: "print 'Hello '\n + 'World';",
- * // 1 2
- * // 012345678901234 5678901234567
- * spans: [0, #1, 6, #2, 14, #3, 15, #4]
- * }
- *
- *
- * where #1 is a reference to the {@code "print "} text node above, and so
- * on for the other text nodes.
- *
- *
- *
- * The {@code} spans array is an array of pairs. Even elements are the start
- * indices of substrings, and odd elements are the text nodes (or BR elements)
- * that contain the text for those substrings.
- * Substrings continue until the next index or the end of the source.
- *
- *
- * @param {Node} node an HTML DOM subtree containing source-code.
- * @return {Object} source code and the text nodes in which they occur.
- */
- function extractSourceSpans(node) {
- var nocode = /(?:^|\s)nocode(?:\s|$)/;
-
- var chunks = [];
- var length = 0;
- var spans = [];
- var k = 0;
-
- var whitespace;
- if (node.currentStyle) {
- whitespace = node.currentStyle.whiteSpace;
- } else if (window.getComputedStyle) {
- whitespace = document.defaultView.getComputedStyle(node, null)
- .getPropertyValue('white-space');
- }
- var isPreformatted = whitespace && 'pre' === whitespace.substring(0, 3);
-
- function walk(node) {
- switch (node.nodeType) {
- case 1: // Element
- if (nocode.test(node.className)) { return; }
- for (var child = node.firstChild; child; child = child.nextSibling) {
- walk(child);
- }
- var nodeName = node.nodeName;
- if ('BR' === nodeName || 'LI' === nodeName) {
- chunks[k] = '\n';
- spans[k << 1] = length++;
- spans[(k++ << 1) | 1] = node;
- }
- break;
- case 3: case 4: // Text
- var text = node.nodeValue;
- if (text.length) {
- if (!isPreformatted) {
- text = text.replace(/[ \t\r\n]+/g, ' ');
- } else {
- text = text.replace(/\r\n?/g, '\n'); // Normalize newlines.
- }
- // TODO: handle tabs here?
- chunks[k] = text;
- spans[k << 1] = length;
- length += text.length;
- spans[(k++ << 1) | 1] = node;
- }
- break;
- }
- }
-
- walk(node);
-
- return {
- sourceCode: chunks.join('').replace(/\n$/, ''),
- spans: spans
- };
- }
-
-
- /**
- * Apply the given language handler to sourceCode and add the resulting
- * decorations to out.
- * @param {number} basePos the index of sourceCode within the chunk of source
- * whose decorations are already present on out.
- */
- function appendDecorations(basePos, sourceCode, langHandler, out) {
- if (!sourceCode) { return; }
- var job = {
- sourceCode: sourceCode,
- basePos: basePos
- };
- langHandler(job);
- out.push.apply(out, job.decorations);
- }
-
- var notWs = /\S/;
-
- /**
- * Given an element, if it contains only one child element and any text nodes
- * it contains contain only space characters, return the sole child element.
- * Otherwise returns undefined.
- *
- * This is meant to return the CODE element in {@code
} when
- * there is a single child element that contains all the non-space textual
- * content, but not to return anything where there are multiple child elements
- * as in {@code ...
...
} or when there
- * is textual content.
- */
- function childContentWrapper(element) {
- var wrapper = undefined;
- for (var c = element.firstChild; c; c = c.nextSibling) {
- var type = c.nodeType;
- wrapper = (type === 1) // Element Node
- ? (wrapper ? element : c)
- : (type === 3) // Text Node
- ? (notWs.test(c.nodeValue) ? element : wrapper)
- : wrapper;
- }
- return wrapper === element ? undefined : wrapper;
- }
-
- /** Given triples of [style, pattern, context] returns a lexing function,
- * The lexing function interprets the patterns to find token boundaries and
- * returns a decoration list of the form
- * [index_0, style_0, index_1, style_1, ..., index_n, style_n]
- * where index_n is an index into the sourceCode, and style_n is a style
- * constant like PR_PLAIN. index_n-1 <= index_n, and style_n-1 applies to
- * all characters in sourceCode[index_n-1:index_n].
- *
- * The stylePatterns is a list whose elements have the form
- * [style : string, pattern : RegExp, DEPRECATED, shortcut : string].
- *
- * Style is a style constant like PR_PLAIN, or can be a string of the
- * form 'lang-FOO', where FOO is a language extension describing the
- * language of the portion of the token in $1 after pattern executes.
- * E.g., if style is 'lang-lisp', and group 1 contains the text
- * '(hello (world))', then that portion of the token will be passed to the
- * registered lisp handler for formatting.
- * The text before and after group 1 will be restyled using this decorator
- * so decorators should take care that this doesn't result in infinite
- * recursion. For example, the HTML lexer rule for SCRIPT elements looks
- * something like ['lang-js', /<[s]cript>(.+?)<\/script>/]. This may match
- * '
+
+
+
+
+ {if="$SYNTAXHIGHLIGHTING"}
+ {/if}
+
+
+
+
+
+
+
+ {if="strlen($NOTICE)"}
+
+ {$NOTICE|htmlspecialchars}
+
{/if}{if="strlen($STATUS)"}
+ {$STATUS|htmlspecialchars}
{/if}
+ {$ERROR|htmlspecialchars}
+ Javascript is required for ZeroBin to work. Sorry for the inconvenience.
+ ZeroBin requires a modern browser to work.
+ Still using Internet Explorer? Do yourself a favor, switch to a modern browser:
+
Firefox ,
+
Opera ,
+
Chrome ,
+
Safari ...
+
+
+
+
+
+
+ {$CIPHERDATA}
+
+
diff --git a/tpl/page.html b/tpl/page.html
index 64abada..b501d7c 100644
--- a/tpl/page.html
+++ b/tpl/page.html
@@ -1,23 +1,21 @@
-
+
ZeroBin
-
-
-
-
-
-
- {if="$SYNTAXHIGHLIGHTING"}
- {/if}
-
+ {if="$SYNTAXHIGHLIGHTING"}
+ {if="strlen($SYNTAXHIGHLIGHTINGTHEME)"}
+ {/if}{/if}
+
+
+
+
+ {if="$SYNTAXHIGHLIGHTING"}
+ {/if}
+
-
@@ -25,9 +23,8 @@
ZeroBin is a minimalist, opensource online pastebin where the server has zero knowledge of pasted data.
Data is encrypted/decrypted
in the browser using 256 bits AES.
- More information on the
project page .
-
▶ Note: This is a test service:
- Data may be deleted anytime. Kittens will die if you abuse this service.
+ More information on the
project page .
{if="strlen($NOTICE)"}
+
▶ {$NOTICE}{/if}
ZeroBin
Because ignorance is bliss
diff --git a/tst/RainTPL.php b/tst/RainTPL.php
index 8892a68..d5250bb 100644
--- a/tst/RainTPL.php
+++ b/tst/RainTPL.php
@@ -24,8 +24,8 @@ class RainTPLTest extends PHPUnit_Framework_TestCase
/* Setup Routine */
$page = new RainTPL;
$page::configure(array('cache_dir' => 'tmp/'));
+ $page::$path_replace = false;
- $page = new RainTPL;
// We escape it here because ENT_NOQUOTES can't be used in RainTPL templates.
$page->assign('CIPHERDATA', htmlspecialchars(self::$data, ENT_NOQUOTES));
$page->assign('ERROR', self::$error);
@@ -34,6 +34,9 @@ class RainTPLTest extends PHPUnit_Framework_TestCase
$page->assign('BURNAFTERREADINGSELECTED', false);
$page->assign('OPENDISCUSSION', false);
$page->assign('SYNTAXHIGHLIGHTING', true);
+ $page->assign('SYNTAXHIGHLIGHTINGTHEME', 'sons-of-obsidian');
+ $page->assign('BASE64JSVERSION', '2.1.9');
+ $page->assign('NOTICE', 'example');
$page->assign('EXPIRE', self::$expire);
$page->assign('EXPIREDEFAULT', self::$expire_default);
ob_start();
diff --git a/tst/bootstrap.php b/tst/bootstrap.php
index 117a0aa..6315530 100644
--- a/tst/bootstrap.php
+++ b/tst/bootstrap.php
@@ -2,30 +2,91 @@
error_reporting( E_ALL | E_STRICT );
// change this, if your php files and data is outside of your webservers document root
-define('PATH', '..' . DIRECTORY_SEPARATOR);
+if (!defined('PATH')) define('PATH', '..' . DIRECTORY_SEPARATOR);
require PATH . 'lib/auto.php';
class helper
{
- public static function rmdir($path)
- {
- $path .= DIRECTORY_SEPARATOR;
- $dir = dir($path);
- while(false !== ($file = $dir->read())) {
- if($file != '.' && $file != '..') {
- if(is_dir($path . $file)) {
- self::rmdir($path . $file);
- } elseif(is_file($path . $file)) {
- if(!@unlink($path . $file)) {
- throw new Exception('Error deleting file "' . $path . $file . '".');
- }
- }
- }
- }
- $dir->close();
- if(!@rmdir($path)) {
- throw new Exception('Error deleting directory "' . $path . '".');
- }
- }
+ /**
+ * delete directory and all its contents recursively
+ *
+ * @param string $path
+ * @throws Exception
+ */
+ public static function rmdir($path)
+ {
+ $path .= DIRECTORY_SEPARATOR;
+ $dir = dir($path);
+ while(false !== ($file = $dir->read())) {
+ if($file != '.' && $file != '..') {
+ if(is_dir($path . $file)) {
+ self::rmdir($path . $file);
+ } elseif(is_file($path . $file)) {
+ if(!@unlink($path . $file)) {
+ throw new Exception('Error deleting file "' . $path . $file . '".');
+ }
+ }
+ }
+ }
+ $dir->close();
+ if(!@rmdir($path)) {
+ throw new Exception('Error deleting directory "' . $path . '".');
+ }
+ }
+
+ /**
+ * create ini file
+ *
+ * @param string $pathToFile
+ * @param array $values
+ */
+ public static function createIniFile($pathToFile, $values)
+ {
+ if (count($values)) {
+ @unlink($pathToFile);
+ $ini = fopen($pathToFile, 'a');
+ foreach ($values as $section => $options) {
+ fwrite($ini, "[$section]" . PHP_EOL);
+ foreach($options as $option => $setting) {
+ if (is_null($setting)) {
+ continue;
+ } elseif (is_string($setting)) {
+ $setting = '"' . $setting . '"';
+ } else {
+ $setting = var_export($setting, true);
+ }
+ fwrite($ini, "$option = $setting" . PHP_EOL);
+ }
+ fwrite($ini, PHP_EOL);
+ }
+ fclose($ini);
+ }
+ }
+
+ /**
+ * a var_export that returns arrays without line breaks
+ * by linus@flowingcreativity.net via php.net
+ *
+ * @param mixed $var
+ * @param bool $return
+ * @return void|string
+ */
+ public static function var_export_min($var, $return = false)
+ {
+ if (is_array($var)) {
+ $toImplode = array();
+ foreach ($var as $key => $value) {
+ $toImplode[] = var_export($key, true) . ' => ' . self::var_export_min($value, true);
+ }
+ $code = 'array(' . implode(', ', $toImplode) . ')';
+ if ($return) {
+ return $code;
+ } else {
+ echo $code;
+ }
+ } else {
+ return var_export($var, $return);
+ }
+ }
}
\ No newline at end of file
diff --git a/tst/configGenerator.php b/tst/configGenerator.php
new file mode 100755
index 0000000..796f3a4
--- /dev/null
+++ b/tst/configGenerator.php
@@ -0,0 +1,751 @@
+#!/usr/bin/env php
+ array(
+ array(
+ 'setting' => true,
+ 'tests' => array(
+ array(
+ 'conditions' => array('steps' => $vrd),
+ 'type' => 'NotTag',
+ 'args' => array(
+ array(
+ 'id' => 'opendiscussion',
+ 'attributes' => array(
+ 'disabled' => 'disabled',
+ ),
+ ),
+ '$content',
+ 'outputs enabled discussion correctly'
+ ),
+ ), array(
+ 'conditions' => array('steps' => array('create'), 'traffic/limit' => 10),
+ 'settings' => array('$_POST["opendiscussion"] = "neither 1 nor 0"'),
+ 'type' => 'Equals',
+ 'args' => array(
+ 1,
+ '$response["status"]',
+ 'when discussions are enabled, but invalid flag posted, fail to create paste'
+ ),
+ ), array(
+ 'conditions' => array('steps' => array('create'), 'traffic/limit' => 10),
+ 'settings' => array('$_POST["opendiscussion"] = "neither 1 nor 0"'),
+ 'type' => 'False',
+ 'args' => array(
+ '$this->_model->exists(self::$pasteid)',
+ 'when discussions are enabled, but invalid flag posted, paste is not created'
+ ),
+ ),
+ ),
+ 'affects' => $vcud
+ ), array(
+ 'setting' => false,
+ 'tests' => array(
+ array(
+ 'type' => 'Tag',
+ 'args' => array(
+ array(
+ 'id' => 'opendiscussion',
+ 'attributes' => array(
+ 'disabled' => 'disabled',
+ ),
+ ),
+ '$content',
+ 'outputs disabled discussion correctly'
+ ),
+ ),
+ ),
+ 'affects' => $vrd
+ ),
+ ),
+ 'main/syntaxhighlighting' => array(
+ array(
+ 'setting' => true,
+ 'tests' => array(
+ array(
+ 'type' => 'Tag',
+ 'args' => array(
+ array(
+ 'tag' => 'link',
+ 'attributes' => array(
+ 'type' => 'text/css',
+ 'rel' => 'stylesheet',
+ 'href' => 'regexp:#css/prettify/prettify\.css#',
+ ),
+ ),
+ '$content',
+ 'outputs prettify stylesheet correctly',
+ ),
+ ), array(
+ 'type' => 'Tag',
+ 'args' => array(
+ array(
+ 'tag' => 'script',
+ 'attributes' => array(
+ 'type' => 'text/javascript',
+ 'src' => 'regexp:#js/prettify\.js#'
+ ),
+ ),
+ '$content',
+ 'outputs prettify javascript correctly',
+ ),
+ ),
+ ),
+ 'affects' => $vrd,
+ ), array(
+ 'setting' => false,
+ 'tests' => array(
+ array(
+ 'type' => 'NotTag',
+ 'args' => array(
+ array(
+ 'tag' => 'link',
+ 'attributes' => array(
+ 'type' => 'text/css',
+ 'rel' => 'stylesheet',
+ 'href' => 'regexp:#css/prettify/prettify\.css#',
+ ),
+ ),
+ '$content',
+ 'removes prettify stylesheet correctly',
+ ),
+ ), array(
+ 'type' => 'NotTag',
+ 'args' => array(
+ array(
+ 'tag' => 'script',
+ 'attributes' => array(
+ 'type' => 'text/javascript',
+ 'src' => 'regexp:#js/prettify\.js#',
+ ),
+ ),
+ '$content',
+ 'removes prettify javascript correctly',
+ ),
+ ),
+ ),
+ 'affects' => $vrd,
+ ),
+ ),
+ 'main/syntaxhighlightingtheme' => array(
+ array(
+ 'setting' => 'sons-of-obsidian',
+ 'tests' => array(
+ array(
+ 'conditions' => array('main/syntaxhighlighting' => true),
+ 'type' => 'Tag',
+ 'args' => array(
+ array(
+ 'tag' => 'link',
+ 'attributes' => array(
+ 'type' => 'text/css',
+ 'rel' => 'stylesheet',
+ 'href' => 'regexp:#css/prettify/sons-of-obsidian\.css#',
+ ),
+ ),
+ '$content',
+ 'outputs prettify theme stylesheet correctly',
+ ),
+ ), array(
+ 'conditions' => array('main/syntaxhighlighting' => false),
+ 'type' => 'NotTag',
+ 'args' => array(
+ array(
+ 'tag' => 'link',
+ 'attributes' => array(
+ 'type' => 'text/css',
+ 'rel' => 'stylesheet',
+ 'href' => 'regexp:#css/prettify/sons-of-obsidian\.css#',
+ ),
+ ),
+ '$content',
+ 'removes prettify theme stylesheet correctly',
+ ),
+ ),
+ ),
+ 'affects' => $vrd,
+ ), array(
+ 'setting' => null, // option not set
+ 'tests' => array(
+ array(
+ 'type' => 'NotTag',
+ 'args' => array(
+ array(
+ 'tag' => 'link',
+ 'attributes' => array(
+ 'type' => 'text/css',
+ 'rel' => 'stylesheet',
+ 'href' => 'regexp:#css/prettify/sons-of-obsidian\.css#',
+ ),
+ ),
+ '$content',
+ 'removes prettify theme stylesheet correctly',
+ ),
+ ),
+ ),
+ 'affects' => $vrd,
+ ),
+ ),
+ 'main/burnafterreadingselected' => array(
+ array(
+ 'setting' => true,
+ 'tests' => array(
+ array(
+ 'type' => 'Tag',
+ 'args' => array(
+ array(
+ 'id' => 'burnafterreading',
+ 'attributes' => array(
+ 'checked' => 'checked',
+ ),
+ ),
+ '$content',
+ 'preselects burn after reading option',
+ ),
+ ),
+ ),
+ 'affects' => array('view'),
+ ), array(
+ 'setting' => false,
+ 'tests' => array(
+ array(
+ 'type' => 'NotTag',
+ 'args' => array(
+ array(
+ 'id' => 'burnafterreading',
+ 'attributes' => array(
+ 'checked' => 'checked',
+ ),
+ ),
+ '$content',
+ 'burn after reading option is unchecked',
+ ),
+ ),
+ ),
+ 'affects' => array('view'),
+ ),
+ ),
+ 'main/template' => array(
+ array(
+ 'setting' => 'page',
+ 'tests' => array(
+ array(
+ 'type' => 'Tag',
+ 'args' => array(
+ array(
+ 'tag' => 'link',
+ 'attributes' => array(
+ 'type' => 'text/css',
+ 'rel' => 'stylesheet',
+ 'href' => 'regexp:#css/zerobin\.css#',
+ ),
+ ),
+ '$content',
+ 'outputs "page" stylesheet correctly',
+ ),
+ ), array(
+ 'type' => 'NotTag',
+ 'args' => array(
+ array(
+ 'tag' => 'link',
+ 'attributes' => array(
+ 'type' => 'text/css',
+ 'rel' => 'stylesheet',
+ 'href' => 'regexp:#css/bootstrap/bootstrap-\d[\d\.]+\d\.css#',
+ ),
+ ),
+ '$content',
+ 'removes "bootstrap" stylesheet correctly',
+ ),
+ ),
+ ),
+ 'affects' => $vrd,
+ ), array(
+ 'setting' => 'bootstrap',
+ 'tests' => array(
+ array(
+ 'type' => 'NotTag',
+ 'args' => array(
+ array(
+ 'tag' => 'link',
+ 'attributes' => array(
+ 'type' => 'text/css',
+ 'rel' => 'stylesheet',
+ 'href' => 'regexp:#css/zerobin.css#',
+ ),
+ ),
+ '$content',
+ 'removes "page" stylesheet correctly',
+ ),
+ ), array(
+ 'type' => 'Tag',
+ 'args' => array(
+ array(
+ 'tag' => 'link',
+ 'attributes' => array(
+ 'type' => 'text/css',
+ 'rel' => 'stylesheet',
+ 'href' => 'regexp:#css/bootstrap/bootstrap-\d[\d\.]+\d\.css#',
+ ),
+ ),
+ '$content',
+ 'outputs "bootstrap" stylesheet correctly',
+ ),
+ ),
+ ),
+ 'affects' => $vrd,
+ ),
+ ),
+ 'main/sizelimit' => array(
+ array(
+ 'setting' => 10,
+ 'tests' => array(
+ array(
+ 'conditions' => array('steps' => array('create'), 'traffic/limit' => 10),
+ 'type' => 'Equals',
+ 'args' => array(
+ 1,
+ '$response["status"]',
+ 'when sizelimit limit exceeded, fail to create paste'
+ ),
+ ),
+ ),
+ 'affects' => array('create')
+ ), array(
+ 'setting' => 2097152,
+ 'tests' => array(
+ array(
+ 'conditions' => array('steps' => array('create'), 'traffic/limit' => 0, 'main/burnafterreadingselected' => true),
+ 'settings' => array('sleep(3)'),
+ 'type' => 'Equals',
+ 'args' => array(
+ 0,
+ '$response["status"]',
+ 'when sizelimit limit is not reached, successfully create paste'
+ ),
+ ), array(
+ 'conditions' => array('steps' => array('create'), 'traffic/limit' => 0, 'main/burnafterreadingselected' => true),
+ 'settings' => array('sleep(3)'),
+ 'type' => 'True',
+ 'args' => array(
+ '$this->_model->exists($response["id"])',
+ 'when sizelimit limit is not reached, paste exists after posting data'
+ ),
+ ),
+ ),
+ 'affects' => array('create')
+ ),
+ ),
+ 'traffic/limit' => array(
+ array(
+ 'setting' => 0,
+ 'tests' => array(
+ array(
+ 'conditions' => array('steps' => array('create'), 'main/sizelimit' => 2097152),
+ 'type' => 'Equals',
+ 'args' => array(
+ 0,
+ '$response["status"]',
+ 'when traffic limit is disabled, successfully create paste'
+ ),
+ ), array(
+ 'conditions' => array('steps' => array('create'), 'main/sizelimit' => 2097152),
+ 'type' => 'True',
+ 'args' => array(
+ '$this->_model->exists($response["id"])',
+ 'when traffic limit is disabled, paste exists after posting data'
+ ),
+ ),
+ ),
+ 'affects' => array('create')
+ ), array(
+ 'setting' => 10,
+ 'tests' => array(
+ array(
+ 'conditions' => array('steps' => array('create')),
+ 'type' => 'Equals',
+ 'args' => array(
+ 1,
+ '$response["status"]',
+ 'when traffic limit is on and we do not wait, fail to create paste'
+ ),
+ ),
+ ),
+ 'affects' => array('create')
+ ), array(
+ 'setting' => 2,
+ 'tests' => array(
+ array(
+ 'conditions' => array('steps' => array('create'), 'main/sizelimit' => 2097152),
+ 'settings' => array('sleep(3)'),
+ 'type' => 'Equals',
+ 'args' => array(
+ 0,
+ '$response["status"]',
+ 'when traffic limit is on and we wait, successfully create paste'
+ ),
+ ), array(
+ 'conditions' => array('steps' => array('create'), 'main/sizelimit' => 2097152),
+ 'settings' => array('sleep(3)'),
+ 'type' => 'True',
+ 'args' => array(
+ '$this->_model->exists($response["id"])',
+ 'when traffic limit is on and we wait, paste exists after posting data'
+ ),
+ ),
+ ),
+ 'affects' => array('create')
+ ),
+ ),
+));
+
+class configurationTestGenerator
+{
+ /**
+ * endless loop protection, since we're working with a recursive function,
+ * creating factorial configurations
+ * @var int
+ */
+ const MAX_ITERATIONS = 1000;
+
+ /**
+ * options to test
+ * @var array
+ */
+ private $_options;
+
+ /**
+ * iteration count to guarantee timely end
+ * @var int
+ */
+ private $_iterationCount = 0;
+
+ /**
+ * generated configurations
+ * @var array
+ */
+ private $_configurations = array(
+ array('options' => array(), 'tests' => array(), 'affects' => array())
+ );
+
+ /**
+ * constructor, generates the configuration test
+ * @param array $options
+ */
+ public function __construct($options) {
+ $this->_options = $options;
+ // generate all possible combinations of options: options^settings
+ $this->_generateConfigurations();
+ $this->_writeConfigurationTest();
+ }
+
+ /**
+ * write configuration test file based on generated configuration array
+ */
+ private function _writeConfigurationTest()
+ {
+ $defaultOptions = parse_ini_file(PATH . 'cfg' . DIRECTORY_SEPARATOR . 'conf.ini', true);
+ $code = $this->_getHeader();
+ foreach ($this->_configurations as $key => $conf) {
+ $fullOptions = array_replace_recursive($defaultOptions, $conf['options']);
+ $options = helper::var_export_min($fullOptions, true);
+ foreach ($conf['affects'] as $step) {
+ $testCode = $preCode = array();
+ foreach ($conf['tests'] as $tests) {
+ foreach ($tests[0] as $test) {
+ // skip if test does not affect this step
+ if (!in_array($step, $tests[1])) {
+ continue;
+ }
+ // skip if not all test conditions are met
+ if (array_key_exists('conditions', $test)) {
+ while (list($path, $setting) = each($test['conditions'])) {
+ if ($path == 'steps' && !in_array($step, $setting)) {
+ continue 2;
+ } elseif($path != 'steps') {
+ list($section, $option) = explode('/', $path);
+ if ($fullOptions[$section][$option] !== $setting) {
+ continue 2;
+ }
+ }
+ }
+ }
+ if (array_key_exists('settings', $test)) {
+ foreach ($test['settings'] as $setting) {
+ $preCode[$setting] = $setting;
+ }
+ }
+ $args = array();
+ foreach ($test['args'] as $arg) {
+ if (is_string($arg) && strpos($arg, '$') === 0) {
+ $args[] = $arg;
+ } else {
+ $args[] = helper::var_export_min($arg, true);
+ }
+ }
+ $testCode[] = array($test['type'], implode(', ', $args));
+ }
+ }
+ $code .= $this->_getFunction(
+ ucfirst($step), $key, $options, $preCode, $testCode
+ );
+ }
+ }
+ $code .= '}' . PHP_EOL;
+ file_put_contents('configuration.php', $code);
+ }
+
+ /**
+ * get header of configuration test file
+ *
+ * @return string
+ */
+ private function _getHeader()
+ {
+ return <<<'EOT'
+ '{"iv":"EN39/wd5Nk8HAiSG2K5AsQ","v":1,"iter":1000,"ks":128,"ts":64,"mode":"ccm","adata":"","cipher":"aes","salt":"QKN1DBXe5PI","ct":"8hA83xDdXjD7K2qfmw5NdA"}',
+ 'meta' => array(
+ 'postdate' => 1344803344,
+ 'opendiscussion' => true,
+ ),
+ );
+
+ private $_model;
+
+ private $_conf;
+
+ public function setUp()
+ {
+ /* Setup Routine */
+ $this->_conf = PATH . 'cfg' . DIRECTORY_SEPARATOR . 'conf.ini';
+ if (!is_file($this->_conf . '.bak') && is_file($this->_conf))
+ rename($this->_conf, $this->_conf . '.bak');
+
+ $this->_model = zerobin_data::getInstance(array('dir' => PATH . 'data'));
+ serversalt::setPath(PATH . 'data');
+ $this->reset();
+ }
+
+ public function tearDown()
+ {
+ /* Tear Down Routine */
+ rename($this->_conf . '.bak', $this->_conf);
+}
+
+ public function reset($configuration = array())
+ {
+ $_POST = array();
+ $_GET = array();
+ $_SERVER = array();
+ if ($this->_model->exists(self::$pasteid))
+ $this->_model->delete(self::$pasteid);
+ helper::createIniFile($this->_conf, $configuration);
+ }
+
+
+EOT;
+ }
+
+ /**
+ * get unit tests function block
+ *
+ * @param string $step
+ * @param int $key
+ * @param array $options
+ * @param array $preCode
+ * @param array $testCode
+ * @return string
+ */
+ private function _getFunction($step, $key, &$options, $preCode, $testCode)
+ {
+ if (count($testCode) == 0) {
+ echo "skipping creation of test$step$key, no valid tests found for configuration: $options". PHP_EOL;
+ return '';
+ }
+
+ $preString = $testString = '';
+ foreach ($preCode as $setting) {
+ $preString .= " $setting;" . PHP_EOL;
+ }
+ foreach ($testCode as $test) {
+ $type = $test[0];
+ $args = $test[1];
+ $testString .= " \$this->assert$type($args);" . PHP_EOL;
+ }
+ $code = <<reset($options);
+EOT;
+
+ // step specific initialization
+ switch ($step) {
+ case 'Create':
+ $code .= PHP_EOL . <<<'EOT'
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+EOT;
+ break;
+ case 'Read':
+ $code .= PHP_EOL . <<<'EOT'
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+EOT;
+ break;
+ case 'Delete':
+ $code .= PHP_EOL . <<<'EOT'
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+EOT;
+ break;
+ }
+
+ // all steps
+ $code .= PHP_EOL . $preString;
+ $code .= <<<'EOT'
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+EOT;
+
+ // step specific tests
+ switch ($step) {
+ case 'Create':
+ $code .= <<<'EOT'
+
+ $response = json_decode($content, true);
+EOT;
+ break;
+ case 'Read':
+ $code .= <<<'EOT'
+
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+EOT;
+ break;
+ case 'Delete':
+ $code .= <<<'EOT'
+
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+EOT;
+ break;
+ }
+ return $code . PHP_EOL . PHP_EOL . $testString . ' }' . PHP_EOL . PHP_EOL;
+ }
+
+ /**
+ * recursive function to generate configurations based on options
+ *
+ * @throws Exception
+ * @return array
+ */
+ private function _generateConfigurations()
+ {
+ // recursive factorial function
+ if (++$this->_iterationCount > self::MAX_ITERATIONS) {
+ echo 'max iterations reached, stopping', PHP_EOL;
+ return $this->_configurations;
+ }
+ echo "generateConfigurations: iteration $this->_iterationCount", PHP_EOL;
+ $continue = list($path, $settings) = each($this->_options);
+ if ($continue === false) {
+ return $this->_configurations;
+ }
+ list($section, $option) = explode('/', $path);
+ for ($c = 0, $max = count($this->_configurations); $c < $max; ++$c) {
+ if (!array_key_exists($section, $this->_configurations[$c]['options'])) {
+ $this->_configurations[$c]['options'][$section] = array();
+ }
+ if (count($settings) == 0) {
+ throw new Exception("Check your \$options: option $option has no settings!");
+ }
+ // set the first setting in the original configuration
+ $setting = current($settings);
+ $this->_addSetting($this->_configurations[$c], $setting, $section, $option);
+
+ // create clones for each of the other settings
+ while ($setting = next($settings)) {
+ $clone = $this->_configurations[$c];
+ $this->_configurations[] = $this->_addSetting($clone, $setting, $section, $option);
+ }
+ reset($settings);
+ }
+ return $this->_generateConfigurations();
+ }
+
+ /**
+ * add a setting to the given configuration
+ *
+ * @param array $configuration
+ * @param array $setting
+ * @param string $section
+ * @param string $option
+ * @throws Exception
+ * @return array
+ */
+ private function _addSetting(&$configuration, &$setting, &$section, &$option) {
+ if (++$this->_iterationCount > self::MAX_ITERATIONS) {
+ echo 'max iterations reached, stopping', PHP_EOL;
+ return $configuration;
+ }
+ echo "addSetting: iteration $this->_iterationCount", PHP_EOL;
+ if (
+ array_key_exists($option, $configuration['options'][$section]) &&
+ $configuration['options'][$section][$option] === $setting['setting']
+ ) {
+ $val = helper::var_export_min($setting['setting'], true);
+ throw new Exception("Endless loop or error in options detected: option '$option' already exists with setting '$val' in one of the configurations!");
+ }
+ $configuration['options'][$section][$option] = $setting['setting'];
+ $configuration['tests'][$option] = array($setting['tests'], $setting['affects']);
+ foreach ($setting['affects'] as $affects) {
+ if (!in_array($affects, $configuration['affects'])) {
+ $configuration['affects'][] = $affects;
+ }
+ }
+ return $configuration;
+ }
+}
diff --git a/tst/configuration.php b/tst/configuration.php
new file mode 100644
index 0000000..eb24719
--- /dev/null
+++ b/tst/configuration.php
@@ -0,0 +1,17345 @@
+ '{"iv":"EN39/wd5Nk8HAiSG2K5AsQ","v":1,"iter":1000,"ks":128,"ts":64,"mode":"ccm","adata":"","cipher":"aes","salt":"QKN1DBXe5PI","ct":"8hA83xDdXjD7K2qfmw5NdA"}',
+ 'meta' => array(
+ 'postdate' => 1344803344,
+ 'opendiscussion' => true,
+ ),
+ );
+
+ private $_model;
+
+ private $_conf;
+
+ public function setUp()
+ {
+ /* Setup Routine */
+ $this->_conf = PATH . 'cfg' . DIRECTORY_SEPARATOR . 'conf.ini';
+ if (!is_file($this->_conf . '.bak') && is_file($this->_conf))
+ rename($this->_conf, $this->_conf . '.bak');
+
+ $this->_model = zerobin_data::getInstance(array('dir' => PATH . 'data'));
+ serversalt::setPath(PATH . 'data');
+ $this->reset();
+ }
+
+ public function tearDown()
+ {
+ /* Tear Down Routine */
+ rename($this->_conf . '.bak', $this->_conf);
+}
+
+ public function reset($configuration = array())
+ {
+ $_POST = array();
+ $_GET = array();
+ $_SERVER = array();
+ if ($this->_model->exists(self::$pasteid))
+ $this->_model->delete(self::$pasteid);
+ helper::createIniFile($this->_conf, $configuration);
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView0()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead0()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete0()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView1()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead1()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete1()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView2()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead2()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete2()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView3()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead3()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete3()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView4()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead4()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete4()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView5()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead5()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete5()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView6()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead6()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete6()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView7()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead7()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete7()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView8()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead8()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete8()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView9()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead9()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete9()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView10()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead10()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete10()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView11()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead11()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete11()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView12()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead12()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete12()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView13()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead13()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete13()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView14()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead14()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete14()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView15()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead15()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete15()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView16()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead16()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete16()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView17()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead17()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete17()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView18()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead18()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete18()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView19()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead19()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete19()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView20()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead20()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete20()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView21()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead21()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete21()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView22()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead22()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete22()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView23()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead23()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete23()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView24()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead24()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete24()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView25()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead25()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete25()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView26()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead26()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete26()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView27()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead27()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete27()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView28()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead28()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete28()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView29()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead29()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete29()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView30()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead30()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete30()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView31()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead31()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete31()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView32()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate32()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when sizelimit limit is not reached, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when sizelimit limit is not reached, paste exists after posting data');
+ $this->assertEquals(0, $response["status"], 'when traffic limit is disabled, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is disabled, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead32()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete32()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView33()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate33()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when sizelimit limit is not reached, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when sizelimit limit is not reached, paste exists after posting data');
+ $this->assertEquals(0, $response["status"], 'when traffic limit is disabled, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is disabled, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead33()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete33()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView34()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate34()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when sizelimit limit is not reached, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when sizelimit limit is not reached, paste exists after posting data');
+ $this->assertEquals(0, $response["status"], 'when traffic limit is disabled, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is disabled, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead34()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete34()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView35()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate35()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when sizelimit limit is not reached, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when sizelimit limit is not reached, paste exists after posting data');
+ $this->assertEquals(0, $response["status"], 'when traffic limit is disabled, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is disabled, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead35()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete35()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView36()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate36()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when sizelimit limit is not reached, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when sizelimit limit is not reached, paste exists after posting data');
+ $this->assertEquals(0, $response["status"], 'when traffic limit is disabled, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is disabled, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead36()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete36()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView37()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate37()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when sizelimit limit is not reached, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when sizelimit limit is not reached, paste exists after posting data');
+ $this->assertEquals(0, $response["status"], 'when traffic limit is disabled, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is disabled, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead37()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete37()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView38()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate38()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when sizelimit limit is not reached, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when sizelimit limit is not reached, paste exists after posting data');
+ $this->assertEquals(0, $response["status"], 'when traffic limit is disabled, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is disabled, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead38()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete38()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView39()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate39()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when sizelimit limit is not reached, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when sizelimit limit is not reached, paste exists after posting data');
+ $this->assertEquals(0, $response["status"], 'when traffic limit is disabled, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is disabled, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead39()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete39()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView40()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate40()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is disabled, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is disabled, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead40()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete40()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView41()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate41()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is disabled, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is disabled, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead41()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete41()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView42()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate42()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is disabled, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is disabled, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead42()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete42()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView43()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate43()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is disabled, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is disabled, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead43()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete43()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView44()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate44()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is disabled, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is disabled, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead44()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete44()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView45()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate45()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is disabled, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is disabled, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead45()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete45()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView46()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate46()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is disabled, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is disabled, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead46()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete46()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView47()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate47()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is disabled, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is disabled, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead47()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete47()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView48()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate48()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when sizelimit limit is not reached, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when sizelimit limit is not reached, paste exists after posting data');
+ $this->assertEquals(0, $response["status"], 'when traffic limit is disabled, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is disabled, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead48()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete48()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView49()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate49()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when sizelimit limit is not reached, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when sizelimit limit is not reached, paste exists after posting data');
+ $this->assertEquals(0, $response["status"], 'when traffic limit is disabled, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is disabled, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead49()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete49()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView50()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate50()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when sizelimit limit is not reached, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when sizelimit limit is not reached, paste exists after posting data');
+ $this->assertEquals(0, $response["status"], 'when traffic limit is disabled, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is disabled, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead50()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete50()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView51()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate51()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when sizelimit limit is not reached, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when sizelimit limit is not reached, paste exists after posting data');
+ $this->assertEquals(0, $response["status"], 'when traffic limit is disabled, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is disabled, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead51()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete51()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView52()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate52()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when sizelimit limit is not reached, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when sizelimit limit is not reached, paste exists after posting data');
+ $this->assertEquals(0, $response["status"], 'when traffic limit is disabled, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is disabled, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead52()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete52()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView53()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate53()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when sizelimit limit is not reached, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when sizelimit limit is not reached, paste exists after posting data');
+ $this->assertEquals(0, $response["status"], 'when traffic limit is disabled, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is disabled, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead53()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete53()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView54()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate54()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when sizelimit limit is not reached, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when sizelimit limit is not reached, paste exists after posting data');
+ $this->assertEquals(0, $response["status"], 'when traffic limit is disabled, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is disabled, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead54()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete54()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView55()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate55()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when sizelimit limit is not reached, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when sizelimit limit is not reached, paste exists after posting data');
+ $this->assertEquals(0, $response["status"], 'when traffic limit is disabled, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is disabled, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead55()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete55()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView56()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate56()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is disabled, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is disabled, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead56()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete56()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView57()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate57()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is disabled, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is disabled, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead57()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete57()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView58()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate58()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is disabled, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is disabled, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead58()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete58()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView59()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate59()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is disabled, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is disabled, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead59()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete59()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView60()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate60()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is disabled, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is disabled, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead60()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete60()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView61()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate61()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is disabled, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is disabled, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead61()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete61()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView62()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate62()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is disabled, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is disabled, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead62()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete62()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView63()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate63()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is disabled, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is disabled, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead63()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete63()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 0, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView64()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate64()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ $_POST["opendiscussion"] = "neither 1 nor 0";
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when discussions are enabled, but invalid flag posted, fail to create paste');
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'when discussions are enabled, but invalid flag posted, paste is not created');
+ $this->assertEquals(1, $response["status"], 'when sizelimit limit exceeded, fail to create paste');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead64()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete64()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView65()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead65()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete65()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView66()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate66()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when sizelimit limit exceeded, fail to create paste');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead66()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete66()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView67()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead67()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete67()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView68()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate68()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ $_POST["opendiscussion"] = "neither 1 nor 0";
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when discussions are enabled, but invalid flag posted, fail to create paste');
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'when discussions are enabled, but invalid flag posted, paste is not created');
+ $this->assertEquals(1, $response["status"], 'when sizelimit limit exceeded, fail to create paste');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead68()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete68()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView69()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead69()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete69()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView70()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate70()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when sizelimit limit exceeded, fail to create paste');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead70()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete70()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView71()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead71()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete71()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView72()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate72()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ $_POST["opendiscussion"] = "neither 1 nor 0";
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when discussions are enabled, but invalid flag posted, fail to create paste');
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'when discussions are enabled, but invalid flag posted, paste is not created');
+ $this->assertEquals(1, $response["status"], 'when sizelimit limit exceeded, fail to create paste');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead72()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete72()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView73()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead73()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete73()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView74()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate74()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when sizelimit limit exceeded, fail to create paste');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead74()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete74()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView75()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead75()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete75()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView76()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate76()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ $_POST["opendiscussion"] = "neither 1 nor 0";
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when discussions are enabled, but invalid flag posted, fail to create paste');
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'when discussions are enabled, but invalid flag posted, paste is not created');
+ $this->assertEquals(1, $response["status"], 'when sizelimit limit exceeded, fail to create paste');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead76()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete76()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView77()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead77()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete77()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView78()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate78()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when sizelimit limit exceeded, fail to create paste');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead78()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete78()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView79()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead79()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete79()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView80()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate80()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ $_POST["opendiscussion"] = "neither 1 nor 0";
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when discussions are enabled, but invalid flag posted, fail to create paste');
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'when discussions are enabled, but invalid flag posted, paste is not created');
+ $this->assertEquals(1, $response["status"], 'when sizelimit limit exceeded, fail to create paste');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead80()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete80()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView81()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead81()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete81()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView82()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate82()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when sizelimit limit exceeded, fail to create paste');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead82()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete82()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView83()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead83()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete83()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView84()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate84()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ $_POST["opendiscussion"] = "neither 1 nor 0";
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when discussions are enabled, but invalid flag posted, fail to create paste');
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'when discussions are enabled, but invalid flag posted, paste is not created');
+ $this->assertEquals(1, $response["status"], 'when sizelimit limit exceeded, fail to create paste');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead84()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete84()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView85()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead85()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete85()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView86()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate86()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when sizelimit limit exceeded, fail to create paste');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead86()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete86()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView87()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead87()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete87()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView88()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate88()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ $_POST["opendiscussion"] = "neither 1 nor 0";
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when discussions are enabled, but invalid flag posted, fail to create paste');
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'when discussions are enabled, but invalid flag posted, paste is not created');
+ $this->assertEquals(1, $response["status"], 'when sizelimit limit exceeded, fail to create paste');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead88()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete88()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView89()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead89()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete89()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView90()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate90()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when sizelimit limit exceeded, fail to create paste');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead90()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete90()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView91()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead91()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete91()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView92()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate92()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ $_POST["opendiscussion"] = "neither 1 nor 0";
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when discussions are enabled, but invalid flag posted, fail to create paste');
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'when discussions are enabled, but invalid flag posted, paste is not created');
+ $this->assertEquals(1, $response["status"], 'when sizelimit limit exceeded, fail to create paste');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead92()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete92()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView93()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead93()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete93()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView94()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate94()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when sizelimit limit exceeded, fail to create paste');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead94()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete94()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView95()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead95()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete95()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView96()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate96()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ $_POST["opendiscussion"] = "neither 1 nor 0";
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when discussions are enabled, but invalid flag posted, fail to create paste');
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'when discussions are enabled, but invalid flag posted, paste is not created');
+ $this->assertEquals(1, $response["status"], 'when sizelimit limit exceeded, fail to create paste');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead96()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete96()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView97()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead97()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete97()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView98()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate98()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when sizelimit limit exceeded, fail to create paste');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead98()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete98()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView99()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead99()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete99()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView100()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate100()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ $_POST["opendiscussion"] = "neither 1 nor 0";
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when discussions are enabled, but invalid flag posted, fail to create paste');
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'when discussions are enabled, but invalid flag posted, paste is not created');
+ $this->assertEquals(1, $response["status"], 'when sizelimit limit exceeded, fail to create paste');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead100()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete100()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView101()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead101()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete101()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView102()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate102()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when sizelimit limit exceeded, fail to create paste');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead102()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete102()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView103()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead103()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete103()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView104()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate104()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ $_POST["opendiscussion"] = "neither 1 nor 0";
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when discussions are enabled, but invalid flag posted, fail to create paste');
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'when discussions are enabled, but invalid flag posted, paste is not created');
+ $this->assertEquals(1, $response["status"], 'when sizelimit limit exceeded, fail to create paste');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead104()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete104()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView105()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead105()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete105()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView106()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate106()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when sizelimit limit exceeded, fail to create paste');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead106()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete106()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView107()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead107()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete107()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView108()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate108()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ $_POST["opendiscussion"] = "neither 1 nor 0";
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when discussions are enabled, but invalid flag posted, fail to create paste');
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'when discussions are enabled, but invalid flag posted, paste is not created');
+ $this->assertEquals(1, $response["status"], 'when sizelimit limit exceeded, fail to create paste');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead108()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete108()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView109()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead109()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete109()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView110()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate110()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when sizelimit limit exceeded, fail to create paste');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead110()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete110()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView111()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead111()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete111()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView112()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate112()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ $_POST["opendiscussion"] = "neither 1 nor 0";
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when discussions are enabled, but invalid flag posted, fail to create paste');
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'when discussions are enabled, but invalid flag posted, paste is not created');
+ $this->assertEquals(1, $response["status"], 'when sizelimit limit exceeded, fail to create paste');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead112()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete112()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView113()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead113()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete113()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView114()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate114()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when sizelimit limit exceeded, fail to create paste');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead114()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete114()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView115()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead115()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete115()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView116()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate116()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ $_POST["opendiscussion"] = "neither 1 nor 0";
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when discussions are enabled, but invalid flag posted, fail to create paste');
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'when discussions are enabled, but invalid flag posted, paste is not created');
+ $this->assertEquals(1, $response["status"], 'when sizelimit limit exceeded, fail to create paste');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead116()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete116()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView117()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead117()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete117()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView118()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate118()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when sizelimit limit exceeded, fail to create paste');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead118()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete118()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView119()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead119()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete119()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView120()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate120()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ $_POST["opendiscussion"] = "neither 1 nor 0";
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when discussions are enabled, but invalid flag posted, fail to create paste');
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'when discussions are enabled, but invalid flag posted, paste is not created');
+ $this->assertEquals(1, $response["status"], 'when sizelimit limit exceeded, fail to create paste');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead120()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete120()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView121()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead121()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete121()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView122()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate122()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when sizelimit limit exceeded, fail to create paste');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead122()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete122()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView123()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead123()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete123()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView124()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate124()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ $_POST["opendiscussion"] = "neither 1 nor 0";
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when discussions are enabled, but invalid flag posted, fail to create paste');
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'when discussions are enabled, but invalid flag posted, paste is not created');
+ $this->assertEquals(1, $response["status"], 'when sizelimit limit exceeded, fail to create paste');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead124()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete124()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView125()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead125()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete125()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView126()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate126()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when sizelimit limit exceeded, fail to create paste');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead126()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete126()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView127()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead127()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete127()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 10, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView128()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate128()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ $_POST["opendiscussion"] = "neither 1 nor 0";
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when discussions are enabled, but invalid flag posted, fail to create paste');
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'when discussions are enabled, but invalid flag posted, paste is not created');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead128()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete128()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView129()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate129()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is on and we wait, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is on and we wait, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead129()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete129()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView130()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate130()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead130()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete130()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView131()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate131()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is on and we wait, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is on and we wait, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead131()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete131()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView132()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate132()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ $_POST["opendiscussion"] = "neither 1 nor 0";
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when discussions are enabled, but invalid flag posted, fail to create paste');
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'when discussions are enabled, but invalid flag posted, paste is not created');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead132()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete132()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView133()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate133()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is on and we wait, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is on and we wait, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead133()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete133()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView134()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate134()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead134()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete134()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView135()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate135()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is on and we wait, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is on and we wait, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead135()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete135()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView136()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate136()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ $_POST["opendiscussion"] = "neither 1 nor 0";
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when discussions are enabled, but invalid flag posted, fail to create paste');
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'when discussions are enabled, but invalid flag posted, paste is not created');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead136()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete136()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView137()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate137()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is on and we wait, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is on and we wait, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead137()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete137()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView138()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate138()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead138()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete138()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView139()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate139()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is on and we wait, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is on and we wait, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead139()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete139()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView140()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate140()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ $_POST["opendiscussion"] = "neither 1 nor 0";
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when discussions are enabled, but invalid flag posted, fail to create paste');
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'when discussions are enabled, but invalid flag posted, paste is not created');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead140()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete140()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView141()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate141()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is on and we wait, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is on and we wait, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead141()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete141()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView142()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate142()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead142()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete142()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView143()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate143()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is on and we wait, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is on and we wait, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead143()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete143()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView144()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate144()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ $_POST["opendiscussion"] = "neither 1 nor 0";
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when discussions are enabled, but invalid flag posted, fail to create paste');
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'when discussions are enabled, but invalid flag posted, paste is not created');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead144()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete144()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView145()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate145()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is on and we wait, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is on and we wait, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead145()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete145()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView146()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate146()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead146()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete146()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView147()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate147()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is on and we wait, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is on and we wait, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead147()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete147()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView148()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate148()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ $_POST["opendiscussion"] = "neither 1 nor 0";
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when discussions are enabled, but invalid flag posted, fail to create paste');
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'when discussions are enabled, but invalid flag posted, paste is not created');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead148()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete148()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView149()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate149()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is on and we wait, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is on and we wait, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead149()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete149()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView150()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate150()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead150()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete150()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView151()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate151()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is on and we wait, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is on and we wait, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead151()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete151()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView152()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate152()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ $_POST["opendiscussion"] = "neither 1 nor 0";
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when discussions are enabled, but invalid flag posted, fail to create paste');
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'when discussions are enabled, but invalid flag posted, paste is not created');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead152()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete152()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView153()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate153()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is on and we wait, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is on and we wait, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead153()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete153()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView154()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate154()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead154()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete154()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView155()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate155()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is on and we wait, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is on and we wait, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead155()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete155()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView156()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate156()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ $_POST["opendiscussion"] = "neither 1 nor 0";
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when discussions are enabled, but invalid flag posted, fail to create paste');
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'when discussions are enabled, but invalid flag posted, paste is not created');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead156()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete156()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView157()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate157()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is on and we wait, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is on and we wait, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead157()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete157()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView158()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate158()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead158()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete158()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView159()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate159()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is on and we wait, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is on and we wait, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead159()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete159()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'page', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin\\.css#')), $content, 'outputs "page" stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'removes "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView160()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate160()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ $_POST["opendiscussion"] = "neither 1 nor 0";
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when discussions are enabled, but invalid flag posted, fail to create paste');
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'when discussions are enabled, but invalid flag posted, paste is not created');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead160()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete160()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView161()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate161()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is on and we wait, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is on and we wait, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead161()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete161()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView162()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate162()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead162()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete162()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView163()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate163()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is on and we wait, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is on and we wait, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead163()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete163()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView164()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate164()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ $_POST["opendiscussion"] = "neither 1 nor 0";
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when discussions are enabled, but invalid flag posted, fail to create paste');
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'when discussions are enabled, but invalid flag posted, paste is not created');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead164()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete164()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView165()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate165()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is on and we wait, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is on and we wait, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead165()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete165()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView166()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate166()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead166()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete166()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView167()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate167()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is on and we wait, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is on and we wait, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead167()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete167()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView168()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate168()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ $_POST["opendiscussion"] = "neither 1 nor 0";
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when discussions are enabled, but invalid flag posted, fail to create paste');
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'when discussions are enabled, but invalid flag posted, paste is not created');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead168()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete168()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView169()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate169()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is on and we wait, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is on and we wait, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead169()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete169()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView170()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate170()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead170()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete170()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView171()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate171()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is on and we wait, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is on and we wait, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead171()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete171()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView172()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate172()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ $_POST["opendiscussion"] = "neither 1 nor 0";
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when discussions are enabled, but invalid flag posted, fail to create paste');
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'when discussions are enabled, but invalid flag posted, paste is not created');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead172()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete172()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView173()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate173()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is on and we wait, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is on and we wait, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead173()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete173()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView174()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate174()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead174()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete174()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView175()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'preselects burn after reading option');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate175()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is on and we wait, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is on and we wait, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead175()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete175()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => true, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView176()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate176()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ $_POST["opendiscussion"] = "neither 1 nor 0";
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when discussions are enabled, but invalid flag posted, fail to create paste');
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'when discussions are enabled, but invalid flag posted, paste is not created');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead176()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete176()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView177()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate177()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is on and we wait, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is on and we wait, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead177()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete177()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView178()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate178()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead178()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete178()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView179()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate179()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is on and we wait, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is on and we wait, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead179()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete179()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'outputs prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView180()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate180()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ $_POST["opendiscussion"] = "neither 1 nor 0";
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when discussions are enabled, but invalid flag posted, fail to create paste');
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'when discussions are enabled, but invalid flag posted, paste is not created');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead180()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete180()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView181()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate181()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is on and we wait, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is on and we wait, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead181()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete181()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView182()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate182()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead182()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete182()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView183()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate183()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is on and we wait, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is on and we wait, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead183()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete183()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => 'sons-of-obsidian'), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView184()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate184()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ $_POST["opendiscussion"] = "neither 1 nor 0";
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when discussions are enabled, but invalid flag posted, fail to create paste');
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'when discussions are enabled, but invalid flag posted, paste is not created');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead184()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete184()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView185()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate185()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is on and we wait, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is on and we wait, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead185()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete185()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView186()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate186()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead186()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete186()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView187()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate187()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is on and we wait, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is on and we wait, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead187()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete187()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => true, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'outputs prettify stylesheet correctly');
+ $this->assertTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'outputs prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView188()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate188()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ $_POST["opendiscussion"] = "neither 1 nor 0";
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when discussions are enabled, but invalid flag posted, fail to create paste');
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'when discussions are enabled, but invalid flag posted, paste is not created');
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead188()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete188()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView189()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate189()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is on and we wait, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is on and we wait, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead189()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete189()
+ {
+ $this->reset(array('main' => array('opendiscussion' => true, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertNotTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs enabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView190()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate190()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(1, $response["status"], 'when traffic limit is on and we do not wait, fail to create paste');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead190()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete190()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 10, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView191()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('id' => 'burnafterreading', 'attributes' => array('checked' => 'checked')), $content, 'burn after reading option is unchecked');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate191()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(3);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+
+ $this->assertEquals(0, $response["status"], 'when traffic limit is on and we wait, successfully create paste');
+ $this->assertTrue($this->_model->exists($response["id"]), 'when traffic limit is on and we wait, paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead191()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete191()
+ {
+ $this->reset(array('main' => array('opendiscussion' => false, 'syntaxhighlighting' => false, 'burnafterreadingselected' => false, 'sizelimit' => 2097152, 'template' => 'bootstrap', 'base64version' => '2.1.9', 'syntaxhighlightingtheme' => NULL), 'expire' => array('default' => '1month'), 'expire_options' => array('5min' => '300', '10min' => '600', '1hour' => '3600', '1day' => '86400', '1week' => '604800', '1month' => '2592000', '1year' => '31536000', 'never' => '0'), 'expire_labels' => array('5min' => '5 minutes', '10min' => '10 minutes', '1hour' => '1 hour', '1day' => '1 day', '1week' => '1 week', '1month' => '1 month', '1year' => '1 year', 'never' => 'Never'), 'traffic' => array('limit' => 2, 'dir' => '../data'), 'model' => array('class' => 'zerobin_data'), 'model_options' => array('dir' => '../data')));
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+
+ $this->assertTag(array('id' => 'opendiscussion', 'attributes' => array('disabled' => 'disabled')), $content, 'outputs disabled discussion correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/prettify\\.css#')), $content, 'removes prettify stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'script', 'attributes' => array('type' => 'text/javascript', 'src' => 'regexp:#js/prettify\\.js#')), $content, 'removes prettify javascript correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/prettify/sons-of-obsidian\\.css#')), $content, 'removes prettify theme stylesheet correctly');
+ $this->assertNotTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/zerobin.css#')), $content, 'removes "page" stylesheet correctly');
+ $this->assertTag(array('tag' => 'link', 'attributes' => array('type' => 'text/css', 'rel' => 'stylesheet', 'href' => 'regexp:#css/bootstrap/bootstrap-\\d[\\d\\.]+\\d\\.css#')), $content, 'outputs "bootstrap" stylesheet correctly');
+ }
+
+}
diff --git a/tst/mcrypt_mock.php b/tst/mcrypt_mock.php
deleted file mode 100644
index 96b0ed3..0000000
--- a/tst/mcrypt_mock.php
+++ /dev/null
@@ -1,17 +0,0 @@
-
./
- mcrypt_mock.php
+ configGenerator.php
diff --git a/tst/serversalt.php b/tst/serversalt.php
new file mode 100644
index 0000000..d11454f
--- /dev/null
+++ b/tst/serversalt.php
@@ -0,0 +1,115 @@
+_path = PATH . 'data';
+ if(!is_dir($this->_path)) mkdir($this->_path);
+ serversalt::setPath($this->_path);
+
+ $this->_otherPath = $this->_path . DIRECTORY_SEPARATOR . 'foo';
+
+ $this->_invalidPath = $this->_path . DIRECTORY_SEPARATOR . 'bar';
+ if(!is_dir($this->_invalidPath)) mkdir($this->_invalidPath);
+ $this->_invalidFile = $this->_invalidPath . DIRECTORY_SEPARATOR . 'salt.php';
+ }
+
+ public function tearDown()
+ {
+ /* Tear Down Routine */
+ chmod($this->_invalidPath, 0700);
+ helper::rmdir($this->_path);
+ }
+
+ public function testGeneration()
+ {
+ // generating new salt
+ serversalt::setPath($this->_path);
+ $salt = serversalt::get();
+
+ // mcrypt mock
+ if (!defined('MCRYPT_DEV_URANDOM')) define('MCRYPT_DEV_URANDOM', 1);
+ function mcrypt_create_iv($int, $flag)
+ {
+ $randomSalt = '';
+ for($i = 0; $i < 256; ++$i) {
+ $randomSalt .= base_convert(mt_rand(), 10, 16);
+ }
+ // hex2bin requires an even length, pad if necessary
+ if (strlen($randomSalt) % 2)
+ {
+ $randomSalt = '0' . $randomSalt;
+ }
+ return hex2bin($randomSalt);
+ }
+ $this->assertNotEquals($salt, serversalt::generate());
+
+ // try setting a different path and resetting it
+ serversalt::setPath($this->_otherPath);
+ $this->assertNotEquals($salt, serversalt::get());
+ serversalt::setPath($this->_path);
+ $this->assertEquals($salt, serversalt::get());
+ }
+
+ /**
+ * @expectedException Exception
+ * @expectedExceptionCode 11
+ */
+ public function testPathShenanigans()
+ {
+ // try setting an invalid path
+ chmod($this->_invalidPath, 0000);
+ serversalt::setPath($this->_invalidPath);
+ serversalt::get();
+ }
+
+ /**
+ * @expectedException Exception
+ * @expectedExceptionCode 20
+ */
+ public function testFileRead()
+ {
+ // try setting an invalid file
+ chmod($this->_invalidPath, 0700);
+ file_put_contents($this->_invalidFile, '');
+ chmod($this->_invalidFile, 0000);
+ serversalt::setPath($this->_invalidPath);
+ serversalt::get();
+ }
+
+ /**
+ * @expectedException Exception
+ * @expectedExceptionCode 13
+ */
+ public function testFileWrite()
+ {
+ // try setting an invalid file
+ chmod($this->_invalidPath, 0700);
+ @unlink($this->_invalidFile);
+ file_put_contents($this->_invalidPath . DIRECTORY_SEPARATOR . '.htaccess', '');
+ chmod($this->_invalidPath, 0500);
+ serversalt::setPath($this->_invalidPath);
+ serversalt::get();
+ }
+
+ /**
+ * @expectedException Exception
+ * @expectedExceptionCode 10
+ */
+ public function testPermissionShenanigans()
+ {
+ // try creating an invalid path
+ chmod($this->_invalidPath, 0000);
+ serversalt::setPath($this->_invalidPath . DIRECTORY_SEPARATOR . 'baz');
+ serversalt::get();
+ }
+}
diff --git a/tst/vizhash16x16.php b/tst/vizhash16x16.php
index b33d48d..c810c54 100644
--- a/tst/vizhash16x16.php
+++ b/tst/vizhash16x16.php
@@ -10,22 +10,20 @@ class vizhash16x16Test extends PHPUnit_Framework_TestCase
public function setUp()
{
/* Setup Routine */
- $this->_path = PATH . 'data' . DIRECTORY_SEPARATOR;
- $this->_dataDirCreated = !is_dir($this->_path);
- if($this->_dataDirCreated) mkdir($this->_path);
- $this->_file = $this->_path . 'vizhash.png';
+ $this->_path = PATH . 'data';
+ if(!is_dir($this->_path)) mkdir($this->_path);
+ $this->_file = $this->_path . DIRECTORY_SEPARATOR . 'vizhash.png';
+ serversalt::setPath($this->_path);
}
public function tearDown()
{
/* Tear Down Routine */
- if($this->_dataDirCreated) {
- helper::rmdir($this->_path);
- } else {
- if(!@unlink($this->_file)) {
- throw new Exception('Error deleting file "' . $this->_file . '".');
- }
+ chmod($this->_path, 0700);
+ if(!@unlink($this->_file)) {
+ throw new Exception('Error deleting file "' . $this->_file . '".');
}
+ helper::rmdir($this->_path);
}
public function testVizhashGeneratesUniquePngsPerIp()
@@ -37,10 +35,5 @@ class vizhash16x16Test extends PHPUnit_Framework_TestCase
$this->assertEquals('image/png', $finfo->file($this->_file));
$this->assertNotEquals($pngdata, $vz->generate('2001:1620:2057:dead:beef::cafe:babe'));
$this->assertEquals($pngdata, $vz->generate('127.0.0.1'));
-
- // generating new salt
- $salt = serversalt::get();
- require 'mcrypt_mock.php';
- $this->assertNotEquals($salt, serversalt::generate());
}
}
diff --git a/tst/zerobin.php b/tst/zerobin.php
new file mode 100644
index 0000000..3f64ad4
--- /dev/null
+++ b/tst/zerobin.php
@@ -0,0 +1,530 @@
+ '{"iv":"EN39/wd5Nk8HAiSG2K5AsQ","v":1,"iter":1000,"ks":128,"ts":64,"mode":"ccm","adata":"","cipher":"aes","salt":"QKN1DBXe5PI","ct":"8hA83xDdXjD7K2qfmw5NdA"}',
+ 'meta' => array(
+ 'postdate' => 1344803344,
+ 'opendiscussion' => true,
+ ),
+ );
+
+ private static $commentid = '5a52eebf11c4c94b';
+
+ private static $comment = array(
+ 'data' => '{"iv":"Pd4pOKWkmDTT9uPwVwd5Ag","v":1,"iter":1000,"ks":128,"ts":64,"mode":"ccm","adata":"","cipher":"aes","salt":"ZIUhFTliVz4","ct":"6nOCU3peNDclDDpFtJEBKA"}',
+ 'meta' => array(
+ 'nickname' => '{"iv":"76MkAtOGC4oFogX/aSMxRA","v":1,"iter":1000,"ks":128,"ts":64,"mode":"ccm","adata":"","cipher":"aes","salt":"ZIUhFTliVz4","ct":"b6Ae/U1xJdsX/+lATud4sQ"}',
+ 'vizhash' => 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABGUlEQVQokWOsl5/94983CNKQMjnxaOePf98MeKwPfNjkLZ3AgARab6b9+PeNEVnDj3/ff/z7ZiHnzsDA8Pv7H2TVPJw8EAYLAwb48OaVgIgYKycLsrYv378wMDB8//qdCVMDRA9EKSsnCwRBxNsepaLboMFlyMDAICAi9uHNK24GITQ/MDAwoNhgIGMLtwGrzegaLjw5jMz9+vUdnN17uwDCQDhJgk0O07yvX9+teDX1x79v6DYIsIjgcgMaYGFgYOBg4kJx2JejkAiBxAw+PzAwMNz4dp6wDXDw4MdNNOl0rWYsNkD89OLXI/xmo9sgzatJjAYmBgYGDiauD3/ePP18nVgb4MF89+M5ZX6js293wUMpnr8KTQMAxsCJnJ30apMAAAAASUVORK5CYII=',
+ 'postdate' => 1344803528,
+ ),
+ );
+
+ private $_model;
+
+ public function setUp()
+ {
+ /* Setup Routine */
+ $this->_model = zerobin_data::getInstance(array('dir' => PATH . 'data'));
+ serversalt::setPath(PATH . 'data');
+ $this->reset();
+ }
+
+ public function tearDown()
+ {
+ /* Tear Down Routine */
+ }
+
+ public function reset()
+ {
+ $_POST = array();
+ $_GET = array();
+ $_SERVER = array();
+ if ($this->_model->exists(self::$pasteid))
+ $this->_model->delete(self::$pasteid);
+ $conf = PATH . 'cfg' . DIRECTORY_SEPARATOR . 'conf.ini';
+ if (is_file($conf . '.bak'))
+ rename($conf . '.bak', $conf);
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testView()
+ {
+ $this->reset();
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'tag' => 'title',
+ 'content' => 'ZeroBin'
+ ),
+ $content,
+ 'outputs title correctly'
+ );
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testHtaccess()
+ {
+ $this->reset();
+ $dirs = array('cfg', 'lib');
+ foreach ($dirs as $dir) {
+ $file = PATH . $dir . DIRECTORY_SEPARATOR . '.htaccess';
+ @unlink($file);
+ }
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ foreach ($dirs as $dir) {
+ $file = PATH . $dir . DIRECTORY_SEPARATOR . '.htaccess';
+ $this->assertFileExists(
+ $file,
+ "$dir htaccess recreated"
+ );
+ }
+ }
+
+ /**
+ * @expectedException Exception
+ * @expectedExceptionCode 2
+ */
+ public function testConf()
+ {
+ $this->reset();
+ $conf = PATH . 'cfg' . DIRECTORY_SEPARATOR . 'conf.ini';
+ if (!is_file($conf . '.bak') && is_file($conf))
+ rename($conf, $conf . '.bak');
+ file_put_contents($conf, '');
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testConfMissingExpireLabel()
+ {
+ $this->reset();
+ $conf = PATH . 'cfg' . DIRECTORY_SEPARATOR . 'conf.ini';
+ $options = parse_ini_file($conf, true);
+ $options['expire_options']['foobar123'] = 10;
+ if (!is_file($conf . '.bak') && is_file($conf))
+ rename($conf, $conf . '.bak');
+ helper::createIniFile($conf, $options);
+ ini_set('magic_quotes_gpc', 1);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreate()
+ {
+ $this->reset();
+ $_POST = self::$paste;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+ $this->assertEquals(0, $response['status'], 'outputs status');
+ $this->assertEquals(
+ hash_hmac('sha1', $response['id'], serversalt::get()),
+ $response['deletetoken'],
+ 'outputs valid delete token'
+ );
+ $this->assertTrue($this->_model->exists($response['id']), 'paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreateValidExpire()
+ {
+ $this->reset();
+ $_POST = self::$paste;
+ $_POST['expire'] = '5min';
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(11);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+ $this->assertEquals(0, $response['status'], 'outputs status');
+ $this->assertEquals(
+ hash_hmac('sha1', $response['id'], serversalt::get()),
+ $response['deletetoken'],
+ 'outputs valid delete token'
+ );
+ $this->assertTrue($this->_model->exists($response['id']), 'paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreateInvalidExpire()
+ {
+ $this->reset();
+ $_POST = self::$paste;
+ $_POST['expire'] = 'foo';
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(11);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+ $this->assertEquals(0, $response['status'], 'outputs status');
+ $this->assertEquals(
+ hash_hmac('sha1', $response['id'], serversalt::get()),
+ $response['deletetoken'],
+ 'outputs valid delete token'
+ );
+ $this->assertTrue($this->_model->exists($response['id']), 'paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreateInvalidBurn()
+ {
+ $this->reset();
+ $_POST = self::$paste;
+ $_POST['burnafterreading'] = 'neither 1 nor 0';
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(11);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+ $this->assertEquals(1, $response['status'], 'outputs error status');
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreateInvalidOpenDiscussion()
+ {
+ $this->reset();
+ $_POST = self::$paste;
+ $_POST['opendiscussion'] = 'neither 1 nor 0';
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(11);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+ $this->assertEquals(1, $response['status'], 'outputs error status');
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreateValidNick()
+ {
+ $this->reset();
+ $_POST = self::$paste;
+ $_POST['nickname'] = self::$comment['meta']['nickname'];
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(11);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+ $this->assertEquals(0, $response['status'], 'outputs status');
+ $this->assertEquals(
+ hash_hmac('sha1', $response['id'], serversalt::get()),
+ $response['deletetoken'],
+ 'outputs valid delete token'
+ );
+ $this->assertTrue($this->_model->exists($response['id']), 'paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreateInvalidNick()
+ {
+ $this->reset();
+ $_POST = self::$paste;
+ $_POST['nickname'] = 'foo';
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(11);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+ $this->assertEquals(1, $response['status'], 'outputs error status');
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreateComment()
+ {
+ $this->reset();
+ $_POST = self::$comment;
+ $_POST['pasteid'] = self::$pasteid;
+ $_POST['parentid'] = self::$pasteid;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ $this->_model->create(self::$pasteid, self::$paste);
+ sleep(11);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+ $this->assertEquals(0, $response['status'], 'outputs status');
+ $this->assertTrue($this->_model->existsComment(self::$pasteid, self::$pasteid, $response['id']), 'paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreateCommentDiscussionDisabled()
+ {
+ $this->reset();
+ $_POST = self::$comment;
+ $_POST['pasteid'] = self::$pasteid;
+ $_POST['parentid'] = self::$pasteid;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ $paste = self::$paste;
+ $paste['meta']['opendiscussion'] = false;
+ $this->_model->create(self::$pasteid, $paste);
+ sleep(11);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+ $this->assertEquals(1, $response['status'], 'outputs error status');
+ $this->assertFalse($this->_model->existsComment(self::$pasteid, self::$pasteid, self::$commentid), 'paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testCreateCommentInvalidPaste()
+ {
+ $this->reset();
+ $_POST = self::$comment;
+ $_POST['pasteid'] = self::$pasteid;
+ $_POST['parentid'] = self::$pasteid;
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ sleep(11);
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $response = json_decode($content, true);
+ $this->assertEquals(1, $response['status'], 'outputs error status');
+ $this->assertFalse($this->_model->existsComment(self::$pasteid, self::$pasteid, self::$commentid), 'paste exists after posting data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testRead()
+ {
+ $this->reset();
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode(self::$paste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testReadInvalidId()
+ {
+ $this->reset();
+ $_SERVER['QUERY_STRING'] = 'foo';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'errormessage',
+ 'content' => 'Invalid paste ID'
+ ),
+ $content,
+ 'outputs error correctly'
+ );
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testReadNonexisting()
+ {
+ $this->reset();
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'errormessage',
+ 'content' => 'Paste does not exist'
+ ),
+ $content,
+ 'outputs error correctly'
+ );
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testReadExpired()
+ {
+ $this->reset();
+ $expiredPaste = self::$paste;
+ $expiredPaste['meta']['expire_date'] = $expiredPaste['meta']['postdate'];
+ $this->_model->create(self::$pasteid, $expiredPaste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'errormessage',
+ 'content' => 'Paste does not exist'
+ ),
+ $content,
+ 'outputs error correctly'
+ );
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testReadBurn()
+ {
+ $this->reset();
+ $burnPaste = self::$paste;
+ $burnPaste['meta']['burnafterreading'] = true;
+ $this->_model->create(self::$pasteid, $burnPaste);
+ $_SERVER['QUERY_STRING'] = self::$pasteid;
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'cipherdata',
+ 'content' => htmlspecialchars(json_encode($burnPaste), ENT_NOQUOTES)
+ ),
+ $content,
+ 'outputs data correctly'
+ );
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDelete()
+ {
+ $this->reset();
+ $this->_model->create(self::$pasteid, self::$paste);
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists before deleting data');
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = hash_hmac('sha1', self::$pasteid, serversalt::get());
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'status',
+ 'content' => 'Paste was properly deleted'
+ ),
+ $content,
+ 'outputs deleted status correctly'
+ );
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDeleteInvalidId()
+ {
+ $this->reset();
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_GET['pasteid'] = 'foo';
+ $_GET['deletetoken'] = 'bar';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'errormessage',
+ 'content' => 'Invalid paste ID'
+ ),
+ $content,
+ 'outputs delete error correctly'
+ );
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists after failing to delete data');
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDeleteInexistantId()
+ {
+ $this->reset();
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = 'bar';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'errormessage',
+ 'content' => 'Paste does not exist'
+ ),
+ $content,
+ 'outputs delete error correctly'
+ );
+ }
+
+ /**
+ * @runInSeparateProcess
+ */
+ public function testDeleteInvalidToken()
+ {
+ $this->reset();
+ $this->_model->create(self::$pasteid, self::$paste);
+ $_GET['pasteid'] = self::$pasteid;
+ $_GET['deletetoken'] = 'bar';
+ ob_start();
+ new zerobin;
+ $content = ob_get_contents();
+ $this->assertTag(
+ array(
+ 'id' => 'errormessage',
+ 'content' => 'Wrong deletion token'
+ ),
+ $content,
+ 'outputs delete error correctly'
+ );
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists after failing to delete data');
+ }
+}
\ No newline at end of file
diff --git a/tst/zerobin/data.php b/tst/zerobin/data.php
index 0dce94e..3e49643 100644
--- a/tst/zerobin/data.php
+++ b/tst/zerobin/data.php
@@ -1,7 +1,7 @@
'{"iv":"EN39/wd5Nk8HAiSG2K5AsQ","v":1,"iter":1000,"ks":128,"ts":64,"mode":"ccm","adata":"","cipher":"aes","salt":"QKN1DBXe5PI","ct":"8hA83xDdXjD7K2qfmw5NdA"}',
@@ -12,7 +12,7 @@ class zerobin_dataTest extends PHPUnit_Framework_TestCase
),
);
- private static $commentid = 'c47efb4741195f42';
+ private static $commentid = '5a52eebf11c4c94b';
private static $comment = array(
'data' => '{"iv":"Pd4pOKWkmDTT9uPwVwd5Ag","v":1,"iter":1000,"ks":128,"ts":64,"mode":"ccm","adata":"","cipher":"aes","salt":"ZIUhFTliVz4","ct":"6nOCU3peNDclDDpFtJEBKA"}',
diff --git a/tst/zerobin/db.php b/tst/zerobin/db.php
index 1bb5eb0..4bea54a 100644
--- a/tst/zerobin/db.php
+++ b/tst/zerobin/db.php
@@ -1,68 +1,145 @@
- '{"iv":"EN39/wd5Nk8HAiSG2K5AsQ","v":1,"iter":1000,"ks":128,"ts":64,"mode":"ccm","adata":"","cipher":"aes","salt":"QKN1DBXe5PI","ct":"8hA83xDdXjD7K2qfmw5NdA"}',
- 'meta' => array(
- 'postdate' => 1344803344,
- 'expire_date' => 1344803644,
- 'opendiscussion' => true,
- ),
- );
-
- private static $commentid = 'c47efb4741195f42';
-
- private static $comment = array(
- 'data' => '{"iv":"Pd4pOKWkmDTT9uPwVwd5Ag","v":1,"iter":1000,"ks":128,"ts":64,"mode":"ccm","adata":"","cipher":"aes","salt":"ZIUhFTliVz4","ct":"6nOCU3peNDclDDpFtJEBKA"}',
- 'meta' => array(
- 'nickname' => '{"iv":"76MkAtOGC4oFogX/aSMxRA","v":1,"iter":1000,"ks":128,"ts":64,"mode":"ccm","adata":"","cipher":"aes","salt":"ZIUhFTliVz4","ct":"b6Ae/U1xJdsX/+lATud4sQ"}',
- 'vizhash' => 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABGUlEQVQokWOsl5/94983CNKQMjnxaOePf98MeKwPfNjkLZ3AgARab6b9+PeNEVnDj3/ff/z7ZiHnzsDA8Pv7H2TVPJw8EAYLAwb48OaVgIgYKycLsrYv378wMDB8//qdCVMDRA9EKSsnCwRBxNsepaLboMFlyMDAICAi9uHNK24GITQ/MDAwoNhgIGMLtwGrzegaLjw5jMz9+vUdnN17uwDCQDhJgk0O07yvX9+teDX1x79v6DYIsIjgcgMaYGFgYOBg4kJx2JejkAiBxAw+PzAwMNz4dp6wDXDw4MdNNOl0rWYsNkD89OLXI/xmo9sgzatJjAYmBgYGDiauD3/ePP18nVgb4MF89+M5ZX6js293wUMpnr8KTQMAxsCJnJ30apMAAAAASUVORK5CYII=',
- 'postdate' => 1344803528,
- ),
- );
-
- private $_model;
-
- public function setUp()
- {
- /* Setup Routine */
- $this->_model = zerobin_db::getInstance(
- array(
- 'dsn' => 'sqlite::memory:',
- 'usr' => null,
- 'pwd' => null,
- 'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION),
- )
- );
- }
-
- public function testDatabaseBasedDataStoreWorks()
- {
- // storing pastes
- $this->assertFalse($this->_model->exists(self::$pasteid), 'paste does not yet exist');
- $this->assertTrue($this->_model->create(self::$pasteid, self::$paste), 'store new paste');
- $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists after storing it');
- $this->assertFalse($this->_model->create(self::$pasteid, self::$paste), 'unable to store the same paste twice');
- $this->assertEquals(json_decode(json_encode(self::$paste)), $this->_model->read(self::$pasteid));
-
- // storing comments
- $this->assertFalse($this->_model->existsComment(self::$pasteid, self::$pasteid, self::$commentid), 'comment does not yet exist');
- $this->assertTrue($this->_model->createComment(self::$pasteid, self::$pasteid, self::$commentid, self::$comment) !== false, 'store comment');
- $this->assertTrue($this->_model->existsComment(self::$pasteid, self::$pasteid, self::$commentid), 'comment exists after storing it');
- $comment = json_decode(json_encode(self::$comment));
- $comment->meta->commentid = self::$commentid;
- $comment->meta->parentid = self::$pasteid;
- $this->assertEquals(
- array($comment->meta->postdate => $comment),
- $this->_model->readComments(self::$pasteid)
- );
-
- // deleting pastes
- $this->_model->delete(self::$pasteid);
- $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
- $this->assertFalse($this->_model->existsComment(self::$pasteid, self::$pasteid, self::$commentid), 'comment was deleted with paste');
- $this->assertFalse($this->_model->read(self::$pasteid), 'paste can no longer be found');
- }
-}
+ '{"iv":"EN39/wd5Nk8HAiSG2K5AsQ","v":1,"iter":1000,"ks":128,"ts":64,"mode":"ccm","adata":"","cipher":"aes","salt":"QKN1DBXe5PI","ct":"8hA83xDdXjD7K2qfmw5NdA"}',
+ 'meta' => array(
+ 'postdate' => 1344803344,
+ 'expire_date' => 1344803644,
+ 'opendiscussion' => true,
+ ),
+ );
+
+ private static $commentid = '5a52eebf11c4c94b';
+
+ private static $comment = array(
+ 'data' => '{"iv":"Pd4pOKWkmDTT9uPwVwd5Ag","v":1,"iter":1000,"ks":128,"ts":64,"mode":"ccm","adata":"","cipher":"aes","salt":"ZIUhFTliVz4","ct":"6nOCU3peNDclDDpFtJEBKA"}',
+ 'meta' => array(
+ 'nickname' => '{"iv":"76MkAtOGC4oFogX/aSMxRA","v":1,"iter":1000,"ks":128,"ts":64,"mode":"ccm","adata":"","cipher":"aes","salt":"ZIUhFTliVz4","ct":"b6Ae/U1xJdsX/+lATud4sQ"}',
+ 'vizhash' => 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABGUlEQVQokWOsl5/94983CNKQMjnxaOePf98MeKwPfNjkLZ3AgARab6b9+PeNEVnDj3/ff/z7ZiHnzsDA8Pv7H2TVPJw8EAYLAwb48OaVgIgYKycLsrYv378wMDB8//qdCVMDRA9EKSsnCwRBxNsepaLboMFlyMDAICAi9uHNK24GITQ/MDAwoNhgIGMLtwGrzegaLjw5jMz9+vUdnN17uwDCQDhJgk0O07yvX9+teDX1x79v6DYIsIjgcgMaYGFgYOBg4kJx2JejkAiBxAw+PzAwMNz4dp6wDXDw4MdNNOl0rWYsNkD89OLXI/xmo9sgzatJjAYmBgYGDiauD3/ePP18nVgb4MF89+M5ZX6js293wUMpnr8KTQMAxsCJnJ30apMAAAAASUVORK5CYII=',
+ 'postdate' => 1344803528,
+ ),
+ );
+
+ private $_model;
+
+ public function setUp()
+ {
+ /* Setup Routine */
+ $this->_model = zerobin_db::getInstance(
+ array(
+ 'dsn' => 'sqlite::memory:',
+ 'usr' => null,
+ 'pwd' => null,
+ 'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION),
+ )
+ );
+ }
+
+ public function testDatabaseBasedDataStoreWorks()
+ {
+ // storing pastes
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste does not yet exist');
+ $this->assertTrue($this->_model->create(self::$pasteid, self::$paste), 'store new paste');
+ $this->assertTrue($this->_model->exists(self::$pasteid), 'paste exists after storing it');
+ $this->assertFalse($this->_model->create(self::$pasteid, self::$paste), 'unable to store the same paste twice');
+ $this->assertEquals(json_decode(json_encode(self::$paste)), $this->_model->read(self::$pasteid));
+
+ // storing comments
+ $this->assertFalse($this->_model->existsComment(self::$pasteid, self::$pasteid, self::$commentid), 'comment does not yet exist');
+ $this->assertTrue($this->_model->createComment(self::$pasteid, self::$pasteid, self::$commentid, self::$comment) !== false, 'store comment');
+ $this->assertTrue($this->_model->existsComment(self::$pasteid, self::$pasteid, self::$commentid), 'comment exists after storing it');
+ $comment = json_decode(json_encode(self::$comment));
+ $comment->meta->commentid = self::$commentid;
+ $comment->meta->parentid = self::$pasteid;
+ $this->assertEquals(
+ array($comment->meta->postdate => $comment),
+ $this->_model->readComments(self::$pasteid)
+ );
+
+ // deleting pastes
+ $this->_model->delete(self::$pasteid);
+ $this->assertFalse($this->_model->exists(self::$pasteid), 'paste successfully deleted');
+ $this->assertFalse($this->_model->existsComment(self::$pasteid, self::$pasteid, self::$commentid), 'comment was deleted with paste');
+ $this->assertFalse($this->_model->read(self::$pasteid), 'paste can no longer be found');
+ }
+
+ /**
+ * @expectedException PDOException
+ */
+ public function testGetIbmInstance()
+ {
+ zerobin_db::getInstance(array(
+ 'dsn' => 'ibm:', 'usr' => null, 'pwd' => null,
+ 'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
+ ));
+ }
+
+ /**
+ * @expectedException PDOException
+ */
+ public function testGetInformixInstance()
+ {
+ zerobin_db::getInstance(array(
+ 'dsn' => 'informix:', 'usr' => null, 'pwd' => null,
+ 'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
+ ));
+ }
+
+ /**
+ * @expectedException PDOException
+ */
+ public function testGetMssqlInstance()
+ {
+ zerobin_db::getInstance(array(
+ 'dsn' => 'mssql:', 'usr' => null, 'pwd' => null,
+ 'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
+ ));
+ }
+
+ /**
+ * @expectedException PDOException
+ */
+ public function testGetMysqlInstance()
+ {
+ zerobin_db::getInstance(array(
+ 'dsn' => 'mysql:', 'usr' => null, 'pwd' => null,
+ 'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
+ ));
+ }
+
+ /**
+ * @expectedException PDOException
+ */
+ public function testGetOciInstance()
+ {
+ zerobin_db::getInstance(array(
+ 'dsn' => 'oci:', 'usr' => null, 'pwd' => null,
+ 'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
+ ));
+ }
+
+ /**
+ * @expectedException PDOException
+ */
+ public function testGetPgsqlInstance()
+ {
+ zerobin_db::getInstance(array(
+ 'dsn' => 'pgsql:', 'usr' => null, 'pwd' => null,
+ 'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
+ ));
+ }
+
+ /**
+ * @expectedException Exception
+ * @expectedExceptionCode 5
+ */
+ public function testGetFooInstance()
+ {
+ zerobin_db::getInstance(array(
+ 'dsn' => 'foo:', 'usr' => null, 'pwd' => null, 'opt' => null
+ ));
+ }
+}