Make WordPress Core

Ticket #46043: #46043__return.php.patch

File #46043__return.php.patch, 1.0 KB (added by pbearne, 7 years ago)

Unittest

  • tests/phpunit/tests/functions/__return.php

     
     1<?php
     2/**
     3 * Tests for __return_** set of functions
     4 *
     5 * Here for competence
     6 *
     7 * @group functions.php
     8 * @ticket #46043
     9 */
     10class TEST__Return extends WP_UnitTestCase {
     11
     12        public function test__return_true(){
     13                $this->assertTrue( (boolean)__return_true() );
     14        }
     15
     16        public function test__return_false(){
     17                $this->assertFalse( (boolean)__return_false() );
     18        }
     19
     20        public function test__return_zero(){
     21                $this->assertEquals( 0, __return_zero() );
     22        }
     23
     24        public function test__return_empty_array(){
     25                $this->assertEquals( array(), __return_empty_array() );
     26        }
     27
     28        public function test__return_null(){
     29                $this->assertNull( __return_null() );
     30        }
     31
     32        public function test__return_empty_string(){
     33                $this->assertEquals( '', __return_empty_string() );
     34        }
     35}