Make WordPress Core

Ticket #23907: 23907.4.unit-test.diff

File 23907.4.unit-test.diff, 1.9 KB (added by tlamedia, 13 years ago)
  • tests/phpunit/tests/formatting/RemoveAccents.php

     
    9494
    9595                remove_filter( 'locale', array( $this, '_remove_accents_germanic_umlauts_cb' ) );
    9696        }
     97       
     98        public function _set_locale_to_danish() {
     99                return 'da_DK';
     100        }
     101       
     102        /**
     103         * @ticket 23907
     104         */
     105        public function test_remove_danish_accents() {
     106                add_filter( 'locale', array( $this, '_set_locale_to_danish' ) );
     107               
     108                $this->assertEquals( 'AeOeAaaeoeaa', remove_accents( 'ÆØÅæøå' ) );
     109               
     110                remove_filter( 'locale', array( $this, '_set_locale_to_danish' ) );
     111        }
     112       
     113        public function _set_locale_to_swedish() {
     114                return 'sv_SE';
     115        }
     116       
     117        /**
     118         * @ticket 23907
     119         */
     120        public function test_remove_swedish_accents() {
     121                add_filter( 'locale', array( $this, '_set_locale_to_swedish' ) );
     122               
     123                $this->assertEquals( 'AeOeAaaeoeaa', remove_accents( 'ÆØÅæøå' ) );
     124               
     125                remove_filter( 'locale', array( $this, '_set_locale_to_swedish' ) );
     126        }
     127       
     128        public function _set_locale_to_norwegian_bokmaal() {
     129                return 'nb_NO';
     130        }
     131       
     132        /**
     133         * @ticket 23907
     134         */
     135        public function test_remove_norwegian_bokmaal_accents() {
     136                add_filter( 'locale', array( $this, '_set_locale_to_norwegian_bokmaal' ) );
     137               
     138                $this->assertEquals( 'AeOeAaaeoeaa', remove_accents( 'ÆØÅæøå' ) );
     139               
     140                remove_filter( 'locale', array( $this, '_set_locale_to_norwegian_bokmaal' ) );
     141        }
     142       
     143        public function _set_locale_to_norwegian_nynorsk() {
     144                return 'nn_NO';
     145        }
     146       
     147        /**
     148         * @ticket 23907
     149         */
     150        public function test_remove_norwegian_nynorsk_accents() {
     151                add_filter( 'locale', array( $this, '_set_locale_to_norwegian_nynorsk' ) );
     152               
     153                $this->assertEquals( 'AeOeAaaeoeaa', remove_accents( 'ÆØÅæøå' ) );
     154               
     155                remove_filter( 'locale', array( $this, '_set_locale_to_norwegian_nynorsk' ) );
     156        }
    97157}