Changeset 720 for trunk/tests


Ignore:
Timestamp:
Mar 9, 2020 3:14:25 AM (4 years ago)
Author:
anonymous
Message:

Update CSS reset with inspiration from https://github.com/hankchizljaw/modern-css-reset

Location:
trunk/tests
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/AppTest.php

    r547 r720  
    5454    {
    5555        $thisapp =& App::getInstance();
    56         $this->assertTrue(serialize($thisapp) === serialize($this->App), 'Objects do not match across instantiations.');
     56        $this->assertTrue($thisapp === $this->App, 'Objects do not match across instantiations.');
    5757    }
    5858
     
    8080        $this->App->stop();
    8181        $this->App->start();
    82 
    8382        $this->assertEquals(ini_get('error_reporting'), E_ALL, 'Error reporting not set to E_ALL.');
    84         $this->assertTrue($this->App->db->dbh && is_resource($this->App->db->dbh), 'DB handler not a resource');
    8583        $this->assertTrue(isset($_SESSION), '$_SESSION is not set.');
    8684        $_SESSION['sess_test_value'] = 'okay';
     
    115113        $app =& App::getInstance();
    116114        ob_start();
    117         $this->test_raisemsg();  //had to add this line for phpunit ver. 3.7 ///
     115        $this->test_raisemsg();  //had to add this line for phpunit ver. 3.7
    118116        $app->printraisedmessages();
    119117        $result = ob_get_clean();
     
    137135    {
    138136        $app =& App::getInstance();
    139         $_GET['arg1'] = 'A';
     137        $_REQUEST['arg1'] = 'A';
    140138        $result = $app->ohref('/some/url.php', array('arg1'), true);
    141139        $this->assertContains(session_name(), $result, 'SSID not found in URL.');
  • trunk/tests/FormValidatorTest.php

    r468 r720  
    44 * For details visit the project site: <http://trac.strangecode.com/codebase/>
    55 * Copyright 2001-2012 Strangecode, LLC
    6  * 
     6 *
    77 * This file is part of The Strangecode Codebase.
    88 *
     
    1111 * Free Software Foundation, either version 3 of the License, or (at your option)
    1212 * any later version.
    13  * 
     13 *
    1414 * The Strangecode Codebase is distributed in the hope that it will be useful, but
    1515 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1616 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    1717 * details.
    18  * 
     18 *
    1919 * You should have received a copy of the GNU General Public License along with
    2020 * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
     
    9797    {
    9898        // This should not generate any error.
    99         $_POST['some_field'] = 'a non empty string';
     99        $_REQUEST['some_field'] = 'a non empty string';
     100        $this->FormValidator->notEmpty('some_field', _("Error message"));
     101        $this->assertFalse($this->FormValidator->anyerrors());
     102
     103        // This one is an error!
     104        $_REQUEST['some_field'] = '';
    100105        $this->FormValidator->isempty('some_field', _("Error message"));
    101         $this->assertFalse($this->FormValidator->anyerrors());
    102        
    103         // This one is an error!
    104         $_POST['some_field'] = '';
     106        $this->assertTrue($this->FormValidator->anyerrors());
     107    }
     108
     109    function test_isempty()
     110    {
     111        // This should not generate any error.
     112        $_REQUEST['some_field'] = 'a non empty string';
    105113        $this->FormValidator->isempty('some_field', _("Error message"));
    106         $this->assertTrue($this->FormValidator->anyerrors());
    107     }
    108 
    109     function test_isempty()
    110     {
    111         // This should not generate any error.
    112         $_POST['some_field'] = 'a non empty string';
     114        $this->assertFalse($this->FormValidator->anyerrors());
     115
     116        // This one is an error!
     117        $_REQUEST['some_field'] = '';
    113118        $this->FormValidator->isempty('some_field', _("Error message"));
    114         $this->assertFalse($this->FormValidator->anyerrors());
    115        
    116         // This one is an error!
    117         $_POST['some_field'] = '';
    118         $this->FormValidator->isempty('some_field', _("Error message"));
    119119        $this->assertTrue($this->FormValidator->anyerrors());
    120120    }
     
    123123    {
    124124        // This should not generate any error.
    125         $_POST['some_field'] = 'this is a string';
     125        $_REQUEST['some_field'] = 'this is a string';
    126126        $this->FormValidator->isstring('some_field', _("Error message"));
    127127        $this->assertFalse($this->FormValidator->anyerrors());
    128        
    129         // This one is an error!
    130         $_POST['some_field'] = 12.3248; // not a string.
     128
     129        // This one is an error!
     130        $_REQUEST['some_field'] = 12.3248; // not a string.
    131131        $this->FormValidator->isstring('some_field', _("Error message"));
    132132        $this->assertTrue($this->FormValidator->anyerrors());
     
    136136    {
    137137        // This should not generate any error.
    138         $_POST['some_field'] = '1234.453';
     138        $_REQUEST['some_field'] = '1234.453';
    139139        $this->FormValidator->isnumber('some_field', _("Error message"));
    140140        $this->assertFalse($this->FormValidator->anyerrors());
    141        
    142         // This one is an error!
    143         $_POST['some_field'] = 'not a number';
     141
     142        // This one is an error!
     143        $_REQUEST['some_field'] = 'not a number';
    144144        $this->FormValidator->isnumber('some_field', _("Error message"));
    145145        $this->assertTrue($this->FormValidator->anyerrors());
     
    149149    {
    150150        // This should not generate any error.
    151         $_POST['some_field'] = '1234';
     151        $_REQUEST['some_field'] = '1234';
    152152        $this->FormValidator->isinteger('some_field', _("Error message"));
    153153        $this->assertFalse($this->FormValidator->anyerrors());
    154        
    155         // This one is an error!
    156         $_POST['some_field'] = '1234.1';
     154
     155        // This one is an error!
     156        $_REQUEST['some_field'] = '1234.1';
    157157        $this->FormValidator->isinteger('some_field', _("Error message"));
    158158        $this->assertTrue($this->FormValidator->anyerrors());
     
    162162    {
    163163        // This should not generate any error.
    164         $_POST['some_field'] = '123.1234';
     164        $_REQUEST['some_field'] = '123.1234';
    165165        $this->FormValidator->isfloat('some_field', _("Error message"));
    166166        $this->assertFalse($this->FormValidator->anyerrors());
    167        
    168         // This one is an error!
    169         $_POST['some_field'] = 'some falsity';
     167
     168        // This one is an error!
     169        $_REQUEST['some_field'] = 'some falsity';
    170170        $this->FormValidator->isfloat('some_field', _("Error message"));
    171171        $this->assertTrue($this->FormValidator->anyerrors());
     
    175175    {
    176176        // This should not generate any error.
    177         $_POST['some_field'] = array('asdf', 123);
     177        $_REQUEST['some_field'] = array('asdf', 123);
    178178        $this->FormValidator->isarray('some_field', _("Error message"));
    179179        $this->assertFalse($this->FormValidator->anyerrors());
    180        
    181         // This one is an error!
    182         $_POST['some_field'] = 'some falsity';
     180
     181        // This one is an error!
     182        $_REQUEST['some_field'] = 'some falsity';
    183183        $this->FormValidator->isarray('some_field', _("Error message"));
    184184        $this->assertTrue($this->FormValidator->anyerrors());
     
    188188    {
    189189        // This should not generate any error.
    190         $_POST['some_field'] = '1234abcd';
     190        $_REQUEST['some_field'] = '1234abcd';
    191191        $this->FormValidator->checkregex('some_field', '/\d{4}[a-d]{4}/', true, _("Error message"));
    192192        $this->assertFalse($this->FormValidator->anyerrors());
    193        
    194         // This should not generate any error.
    195         $_POST['some_field'] = 'no digits here';
     193
     194        // This should not generate any error.
     195        $_REQUEST['some_field'] = 'no digits here';
    196196        $this->FormValidator->checkregex('some_field', '/\d/', false, _("Error message"));
    197197        $this->assertFalse($this->FormValidator->anyerrors());
    198        
    199         // This one is an error!
    200         $_POST['some_field'] = 'oops, a d1git';
     198
     199        // This one is an error!
     200        $_REQUEST['some_field'] = 'oops, a d1git';
    201201        $this->FormValidator->checkregex('some_field', '/\d/', false, _("Error message"));
    202202        $this->assertTrue($this->FormValidator->anyerrors());
     
    206206    {
    207207        // This should not generate any error.
    208         $_POST['some_field'] = 'some truth';
     208        $_REQUEST['some_field'] = 'some truth';
    209209        $this->FormValidator->stringLength('some_field', 0, 255, _("Error message"));
    210210        $this->assertFalse($this->FormValidator->anyerrors());
    211        
    212         // This one is an error!
    213         $_POST['some_field'] = 'some falsity';
     211
     212        // This one is an error!
     213        $_REQUEST['some_field'] = 'some falsity';
    214214        $this->FormValidator->stringLength('some_field', 0, 4, _("Error message"));
    215215        $this->assertTrue($this->FormValidator->anyerrors());
     
    219219    {
    220220        // This should not generate any error.
    221         $_POST['some_field'] = '12';
     221        $_REQUEST['some_field'] = '12';
    222222        $this->FormValidator->numericrange('some_field', 3, 22, _("Error message"));
    223223        $this->assertFalse($this->FormValidator->anyerrors());
    224        
    225         // This one is an error!
    226         $_POST['some_field'] = '12';
     224
     225        // This one is an error!
     226        $_REQUEST['some_field'] = '12';
    227227        $this->FormValidator->numericrange('some_field', 300, 2200, _("Error message"));
    228228        $this->assertTrue($this->FormValidator->anyerrors());
     
    232232    {
    233233        // This should not generate any error.
    234         $_POST['some_field'] = 'Quinn the Kook <quinn@strangecode.com>';
     234        $_REQUEST['some_field'] = 'Quinn the Kook <quinn@strangecode.com>';
    235235        $this->FormValidator->validateemail('some_field', _("Error message"));
    236236        $this->assertFalse($this->FormValidator->anyerrors());
    237                
    238         // This one is an error!
    239         $_POST['some_field'] = 'quinn@kook.com.';
     237
     238        // This one is an error!
     239        $_REQUEST['some_field'] = 'quinn@kook.com.';
    240240        $this->FormValidator->validateemail('some_field', _("Error message"));
    241241        $this->assertTrue($this->FormValidator->anyerrors());
     
    245245    {
    246246        // This should not generate any error.
    247         $_POST['some_field'] = '+1 (530) 555-1212';
     247        $_REQUEST['some_field'] = '+1 (530) 555-1212';
    248248        $this->FormValidator->validatephone('some_field', _("Error message"));
    249249        $this->assertFalse($this->FormValidator->anyerrors());
    250        
    251         // This one is an error!
    252         $_POST['some_field'] = 'd321/654*9875 ';
     250
     251        // This one is an error!
     252        $_REQUEST['some_field'] = 'd321/654*9875 ';
    253253        $this->FormValidator->validatephone('some_field', _("Error message"));
    254254        $this->assertTrue($this->FormValidator->anyerrors());
     
    258258    {
    259259        // This should not generate any error.
    260         $_POST['some_field'] = 'next tuesday';
     260        $_REQUEST['some_field'] = 'next tuesday';
    261261        $this->FormValidator->validatestrdate('some_field', _("Error message"));
    262262        $this->assertFalse($this->FormValidator->anyerrors());
    263        
    264         // This one is an error!
    265         $_POST['some_field'] = 'in a galaxy far far away';
     263
     264        // This one is an error!
     265        $_REQUEST['some_field'] = 'in a galaxy far far away';
    266266        $this->FormValidator->validatestrdate('some_field', _("Error message"));
    267267        $this->assertTrue($this->FormValidator->anyerrors());
     
    271271    {
    272272        // This should not generate any error.
    273         $_POST['some_field'] = '2323-2005-7766-3554';
     273        $_REQUEST['some_field'] = '2323-2005-7766-3554';
    274274        $this->FormValidator->validateccnumber('some_field', null);
    275275        $this->assertFalse($this->FormValidator->anyerrors());
    276        
    277         // This one is an error!
    278         $_POST['some_field'] = '1234 1234 1234 1234';
     276
     277        // This one is an error!
     278        $_REQUEST['some_field'] = '1234 1234 1234 1234';
    279279        $this->FormValidator->validateccnumber('some_field', null);
    280280        $this->assertTrue($this->FormValidator->anyerrors());
  • trunk/tests/VersionTest.php

    r695 r720  
    111111    {
    112112        $result = $this->Version->create('test_user_tbl', 'user_id', '1', 'Test User', 'First version of user');
    113         $this->assertSame(1, $result);
     113        $this->assertSame('1', $result);
    114114    }
    115115
Note: See TracChangeset for help on using the changeset viewer.