Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* start making messages more robust and important. This will allow us…
… to run the tests in PHPUnit or any testing library without having to change the tests. I could really use a hand if anyone wants to transform the Messages.php file to individual classes. If you do want to get involved, don't worry much about the name of the test. You can name it Test1, Test2, List1, List2. That's fine. Use as many directories as subdirectories as you want. The application will know what to do.
- Loading branch information
1 parent
cbcf7e2
commit 83640cf
Showing
7 changed files
with
161 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
class EmptyString implements MessageInterface | ||
{ | ||
public static function name() | ||
{ | ||
return 'Empty string'; | ||
} | ||
|
||
public static function input() | ||
{ | ||
return ''; | ||
} | ||
|
||
public static function stored() | ||
{ | ||
return ''; | ||
} | ||
|
||
public static function output() | ||
{ | ||
return ''; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
class VeryLong implements MessageInterface | ||
{ | ||
private static $string = 'This is a div with multiple classes and no ID. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec volutpat tellus vulputate dui venenatis quis euismod turpis pellentesque. Suspendisse [sit] amet ipsum eu odio sagittis ultrices at non sapien. Quisque viverra feugiat purus, eu mollis felis condimentum id. In luctus faucibus felis eget viverra. Vivamus et velit orci. In in tellus mauris, at fermentum diam. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed a magna nunc, vel tempor magna. Nam dictum, arcu in pretium varius, libero enim hendrerit nisl, et commodo enim sapien eu augue.'; | ||
|
||
public static function name() | ||
{ | ||
return 'Very long string with no BBC'; | ||
} | ||
|
||
public static function input() | ||
{ | ||
return str_repeat(self::$string, 5); | ||
} | ||
|
||
public static function stored() | ||
{ | ||
return str_repeat(self::$string, 5); | ||
} | ||
|
||
public static function output() | ||
{ | ||
return str_repeat(self::$string, 5); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
class SimpleList implements MessageInterface | ||
{ | ||
public static function name() | ||
{ | ||
return 'Simple List'; | ||
} | ||
|
||
public static function input() | ||
{ | ||
return '[list][li]short list[/li][/list]'; | ||
} | ||
|
||
public static function stored() | ||
{ | ||
return '[list][li]short list[/li][/list]'; | ||
} | ||
|
||
public static function output() | ||
{ | ||
return '<ul class="bbc_list"><li>simple</li><li>list</li></ul>'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
class SimpleListWithType implements MessageInterface | ||
{ | ||
public static function name() | ||
{ | ||
return 'Simple List With Type'; | ||
} | ||
|
||
public static function input() | ||
{ | ||
return '[list][li]short list[/li][/list]'; | ||
} | ||
|
||
public static function stored() | ||
{ | ||
return '[list][li]short list[/li][/list]'; | ||
} | ||
|
||
public static function output() | ||
{ | ||
return '<ul class="bbc_list" style="list-style-type: decimal;"><li>simple</li><li>list</li></ul>'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
interface MessageInterface | ||
{ | ||
/** | ||
* What the user inputs. | ||
* Used as input for the preparser | ||
* | ||
* @return string | ||
*/ | ||
public static function input(); | ||
|
||
/** | ||
* What is stored in the database | ||
* Used to check if the preparser works | ||
* Also used as input for the parser | ||
* | ||
* @return string | ||
*/ | ||
public static function stored(); | ||
|
||
/** | ||
* What is displayed to the user | ||
* Used to check if the parser works | ||
* | ||
* @return string | ||
*/ | ||
public static function output(); | ||
|
||
/** | ||
* Get a human readable name of this message | ||
* @return string | ||
*/ | ||
public static function name(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
class Bold implements MessageInterface | ||
{ | ||
public static function name() | ||
{ | ||
return 'Basic bold'; | ||
} | ||
|
||
public static function input() | ||
{ | ||
return '[b]Bold[/b]'; | ||
} | ||
|
||
public static function stored() | ||
{ | ||
return '[b]Bold[/b]'; | ||
} | ||
|
||
public static function output() | ||
{ | ||
return '<b>Bold</b>'; | ||
} | ||
} |