Making WordPress.org


Ignore:
Timestamp:
01/04/2021 11:41:00 PM (6 years ago)
Author:
iandunn
Message:

Events: Create permenant function for pinning one-off events.

This will make tasks like r10527 easier and quicker in the future.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/api.wordpress.org/public_html/events/1.0/tests/test-index-phpunit.php

    r10546 r10548  
    33namespace Dotorg\API\Events\Tests;
    44use PHPUnit\Framework\TestCase;
    5 use function Dotorg\API\Events\{ get_events, get_location, build_response, is_client_core };
     5use function Dotorg\API\Events\{ get_events, get_location, build_response, is_client_core, pin_one_off_events };
    66
    77/**
     
    10511051
    10521052        /**
     1053         * @covers ::pin_one_off_events
     1054         *
     1055         * @group unit
     1056         */
     1057        function test_pin_one_off_events() {
     1058                $seed_events = array();
     1059
     1060                // Don't forget to update the values here when they're updated in the FUT.
     1061                $actual_events_before_expiration = pin_one_off_events( $seed_events, strtotime( 'December 17, 2020' ) );
     1062                $actual_events_after_expiration  = pin_one_off_events( $seed_events, strtotime( 'December 18, 2020' ) );
     1063
     1064                $this->assertIsArray( $actual_events_after_expiration );
     1065                $this->assertEmpty( $actual_events_after_expiration );
     1066
     1067                $this->assertIsArray( $actual_events_before_expiration );
     1068                $this->assertSame( 'State of the Word', $actual_events_before_expiration[0]['title'] );
     1069        }
     1070
     1071        /**
    10531072         * @covers ::is_client_core
    10541073         *
Note: See TracChangeset for help on using the changeset viewer.