ultimix

- Main Page
- Data Structures
- Files
- Examples

- File List
- Globals

unit_tests.php
Go to the documentation of this file.
1 <?php
2
3 /*
4 * This source code is a part of the Ultimix Project.
5 * It is distributed under BSD license. All other third side source code (like tinyMCE) is distributed under
6 * it's own license wich could be found from the corresponding files or sources.
7 * This source code is provided "as is" without any warranties or garanties.
8 *
9 * Have a nice day!
10 *
11 * @url http://ultimix.sorceforge.net
12 *
13 * @author Alexey "gdever" Dodonov
14 */
15
26 class unit_tests{
27
38 var $ErrorLogController = false;
39 var $ErrorLogAccess = false;
40 var $Security = false;
41 var $Options = false;
42
57 function __construct()
58 {
59 try
60 {
61 $this->ErrorLogController = get_package( 'error_log::error_log_controller' , 'last' , __FILE__ );
62 $this->ErrorLogAccess = get_package( 'error_log::error_log_access' , 'last' , __FILE__ );
63 $this->Security = get_package( 'security' , 'last' , __FILE__ );
64 $this->Options = get_package_object( 'settings::settings' , 'last' , __FILE__ );
65 }
66 catch( Exception $e )
67 {
68 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
69 }
70 }
71
86 private function validate_test_controller_delete()
87 {
88 try
89 {
90 $Messages2 = $this->ErrorLogAccess->unsafe_select_messages( '1 ORDER BY id DESC LIMIT 0 , 1' );
91
92 if( $Messages2[ 0 ]->title == 'title_of_testing_record' )
93 {
94 $ErrorLogAccess->delete_error_log( $Messages2[ 0 ]->id );
95 return( 'ERROR' );
96 }
97
98 return( 'TEST PASSED' );
99 }
100 catch( Exception $e )
101 {
102 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
103 }
104 }
105
120 function test_controller_delete()
121 {
122 try
123 {
124 $this->ErrorLogAccess->add_message_to_log( 1 , 'title_of_testing_record' , 'description' );
125 $Messages1 = $this->ErrorLogAccess->unsafe_select_messages( '1 ORDER BY id DESC LIMIT 0 , 1' );
126 $this->Security->reset_p( '_id_'.$Messages1[ 0 ]->id , '_id_'.$Messages1[ 0 ]->id );
127 $this->Security->reset_p( 'error_action' , 'massive_delete' );
128 $Options->load_settings( 'delete_error=1;controller=1' );
129 $this->ErrorLogController->controller( $Options );
130
131 return( $this->validate_test_controller_delete() );
132 }
133 catch( Exception $e )
134 {
135 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
136 }
137 }
138 }
139
140 ?>