��I n d e x :   s r c / w p - i n c l u d e s / r e s t - a p i / e n d p o i n t s / c l a s s - w p - r e s t - p o s t s - c o n t r o l l e r . p h p 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - -   s r c / w p - i n c l u d e s / r e s t - a p i / e n d p o i n t s / c l a s s - w p - r e s t - p o s t s - c o n t r o l l e r . p h p 	 ( r e v i s i o n   3 9 3 7 0 ) 
 
 + + +   s r c / w p - i n c l u d e s / r e s t - a p i / e n d p o i n t s / c l a s s - w p - r e s t - p o s t s - c o n t r o l l e r . p h p 	 ( w o r k i n g   c o p y ) 
 
 @ @   - 2 0 3 8 , 1 2   + 2 0 3 8 , 1 6   @ @ 
 
   	 	 	 ' t y p e '                               = >   ' s t r i n g ' , 
 
   	 	 	 ' d e f a u l t '                         = >   ' d a t e ' , 
 
   	 	 	 ' e n u m '                               = >   a r r a y ( 
 
 + 	 	 	 	 ' a u t h o r ' , 
 
   	 	 	 	 ' d a t e ' , 
 
 - 	 	 	 	 ' r e l e v a n c e ' , 
 
   	 	 	 	 ' i d ' , 
 
   	 	 	 	 ' i n c l u d e ' , 
 
 + 	 	 	 	 ' m o d i f i e d ' , 
 
 + 	 	 	 	 ' n o n e ' , 
 
 + 	 	 	 	 ' p a r e n t ' , 
 
 + 	 	 	 	 ' r e l e v a n c e ' , 
 
 + 	 	 	 	 ' s l u g ' , 
 
   	 	 	 	 ' t i t l e ' , 
 
 - 	 	 	 	 ' s l u g ' , 
 
   	 	 	 ) , 
 
   	 	 ) ; 
 
   
 
 I n d e x :   t e s t s / p h p u n i t / t e s t s / r e s t - a p i / r e s t - p o s t s - c o n t r o l l e r . p h p 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 - - -   t e s t s / p h p u n i t / t e s t s / r e s t - a p i / r e s t - p o s t s - c o n t r o l l e r . p h p 	 ( r e v i s i o n   3 9 3 7 0 ) 
 
 + + +   t e s t s / p h p u n i t / t e s t s / r e s t - a p i / r e s t - p o s t s - c o n t r o l l e r . p h p 	 ( w o r k i n g   c o p y ) 
 
 @ @   - 2 2 7 , 6   + 2 2 7 , 8 1   @ @ 
 
   	 	 $ t h i s - > a s s e r t E r r o r R e s p o n s e (   ' r e s t _ i n v a l i d _ p a r a m ' ,   $ r e s p o n s e ,   4 0 0   ) ; 
 
   	 } 
 
   
 
 + 	 p u b l i c   f u n c t i o n   t e s t _ g e t _ i t e m s _ o r d e r b y _ a u t h o r _ q u e r y ( )   { 
 
 + 	 	 $ i d 2   =   $ t h i s - > f a c t o r y - > p o s t - > c r e a t e (   a r r a y (   ' p o s t _ s t a t u s '   = >   ' p u b l i s h ' ,   ' p o s t _ a u t h o r '   = >   s e l f : : $ e d i t o r _ i d   )   ) ; 
 
 + 	 	 $ i d 3   =   $ t h i s - > f a c t o r y - > p o s t - > c r e a t e (   a r r a y (   ' p o s t _ s t a t u s '   = >   ' p u b l i s h ' ,   ' p o s t _ a u t h o r '   = >   s e l f : : $ e d i t o r _ i d   )   ) ; 
 
 + 	 	 $ i d 1   =   $ t h i s - > f a c t o r y - > p o s t - > c r e a t e (   a r r a y (   ' p o s t _ s t a t u s '   = >   ' p u b l i s h ' ,   ' p o s t _ a u t h o r '   = >   s e l f : : $ a u t h o r _ i d   )   ) ; 
 
 + 
 
 + 	 	 $ r e q u e s t   =   n e w   W P _ R E S T _ R e q u e s t (   ' G E T ' ,   ' / w p / v 2 / p o s t s '   ) ; 
 
 + 	 	 $ r e q u e s t - > s e t _ p a r a m (   ' i n c l u d e ' ,   a r r a y (   $ i d 1 ,   $ i d 2 ,   $ i d 3   )   ) ; 
 
 + 	 	 $ r e q u e s t - > s e t _ p a r a m (   ' o r d e r b y ' ,   ' a u t h o r '   ) ; 
 
 + 
 
 + 	 	 $ r e s p o n s e   =   $ t h i s - > s e r v e r - > d i s p a t c h (   $ r e q u e s t   ) ; 
 
 + 	 	 $ d a t a   =   $ r e s p o n s e - > g e t _ d a t a ( ) ; 
 
 + 
 
 + 	 	 $ t h i s - > a s s e r t E q u a l s (   2 0 0 ,   $ r e s p o n s e - > g e t _ s t a t u s ( )   ) ; 
 
 + 	 	 $ t h i s - > a s s e r t E q u a l s (   s e l f : : $ a u t h o r _ i d ,   $ d a t a [ 0 ] [ ' a u t h o r ' ]   ) ; 
 
 + 	 	 $ t h i s - > a s s e r t E q u a l s (   s e l f : : $ e d i t o r _ i d ,   $ d a t a [ 1 ] [ ' a u t h o r ' ]   ) ; 
 
 + 	 	 $ t h i s - > a s s e r t E q u a l s (   s e l f : : $ e d i t o r _ i d ,   $ d a t a [ 2 ] [ ' a u t h o r ' ]   ) ; 
 
 + 	 } 
 
 + 
 
 + 	 p u b l i c   f u n c t i o n   t e s t _ g e t _ i t e m s _ o r d e r b y _ m o d i f i e d _ q u e r y ( )   { 
 
 + 	 	 $ i d 1   =   $ t h i s - > f a c t o r y - > p o s t - > c r e a t e (   a r r a y (   ' p o s t _ s t a t u s '   = >   ' p u b l i s h '   )   ) ; 
 
 + 	 	 $ i d 2   =   $ t h i s - > f a c t o r y - > p o s t - > c r e a t e (   a r r a y (   ' p o s t _ s t a t u s '   = >   ' p u b l i s h '   )   ) ; 
 
 + 	 	 $ i d 3   =   $ t h i s - > f a c t o r y - > p o s t - > c r e a t e (   a r r a y (   ' p o s t _ s t a t u s '   = >   ' p u b l i s h '   )   ) ; 
 
 + 
 
 + 	 	 $ t h i s - > u p d a t e _ p o s t _ m o d i f i e d (   $ i d 1 ,   ' 2 0 1 6 - 0 4 - 2 0   4 : 2 6 : 2 0 '   ) ; 
 
 + 	 	 $ t h i s - > u p d a t e _ p o s t _ m o d i f i e d (   $ i d 2 ,   ' 2 0 1 6 - 0 2 - 0 1   2 0 : 2 4 : 0 2 '   ) ; 
 
 + 	 	 $ t h i s - > u p d a t e _ p o s t _ m o d i f i e d (   $ i d 3 ,   ' 2 0 1 6 - 0 2 - 2 1   1 2 : 2 4 : 0 2 '   ) ; 
 
 + 
 
 + 	 	 $ r e q u e s t   =   n e w   W P _ R E S T _ R e q u e s t (   ' G E T ' ,   ' / w p / v 2 / p o s t s '   ) ; 
 
 + 	 	 $ r e q u e s t - > s e t _ p a r a m (   ' i n c l u d e ' ,   a r r a y (   $ i d 1 ,   $ i d 2 ,   $ i d 3   )   ) ; 
 
 + 	 	 $ r e q u e s t - > s e t _ p a r a m (   ' o r d e r b y ' ,   ' m o d i f i e d '   ) ; 
 
 + 
 
 + 	 	 $ r e s p o n s e   =   $ t h i s - > s e r v e r - > d i s p a t c h (   $ r e q u e s t   ) ; 
 
 + 	 	 $ d a t a   =   $ r e s p o n s e - > g e t _ d a t a ( ) ; 
 
 + 
 
 + 	 	 $ t h i s - > a s s e r t E q u a l s (   2 0 0 ,   $ r e s p o n s e - > g e t _ s t a t u s ( )   ) ; 
 
 + 	 	 $ t h i s - > a s s e r t E q u a l s (   $ i d 1 ,   $ d a t a [ 0 ] [ ' i d ' ]   ) ; 
 
 + 	 	 $ t h i s - > a s s e r t E q u a l s (   $ i d 3 ,   $ d a t a [ 1 ] [ ' i d ' ]   ) ; 
 
 + 	 	 $ t h i s - > a s s e r t E q u a l s (   $ i d 2 ,   $ d a t a [ 2 ] [ ' i d ' ]   ) ; 
 
 + 	 } 
 
 + 
 
 + 	 p u b l i c   f u n c t i o n   t e s t _ g e t _ i t e m s _ o r d e r b y _ n o n e _ q u e r y ( )   { 
 
 + 	 	 $ i d 1   =   $ t h i s - > f a c t o r y - > p o s t - > c r e a t e (   a r r a y (   ' p o s t _ s t a t u s '   = >   ' p u b l i s h '   )   ) ; 
 
 + 	 	 $ i d 2   =   $ t h i s - > f a c t o r y - > p o s t - > c r e a t e (   a r r a y (   ' p o s t _ s t a t u s '   = >   ' p u b l i s h '   )   ) ; 
 
 + 	 	 $ i d 3   =   $ t h i s - > f a c t o r y - > p o s t - > c r e a t e (   a r r a y (   ' p o s t _ s t a t u s '   = >   ' p u b l i s h '   )   ) ; 
 
 + 
 
 + 	 	 $ r e q u e s t   =   n e w   W P _ R E S T _ R e q u e s t (   ' G E T ' ,   ' / w p / v 2 / p o s t s '   ) ; 
 
 + 	 	 $ r e q u e s t - > s e t _ p a r a m (   ' i n c l u d e ' ,   a r r a y (   $ i d 1 ,   $ i d 2 ,   $ i d 3   )   ) ; 
 
 + 	 	 $ r e q u e s t - > s e t _ p a r a m (   ' o r d e r b y ' ,   ' n o n e '   ) ; 
 
 + 
 
 + 	 	 $ r e s p o n s e   =   $ t h i s - > s e r v e r - > d i s p a t c h (   $ r e q u e s t   ) ; 
 
 + 	 	 $ d a t a   =   $ r e s p o n s e - > g e t _ d a t a ( ) ; 
 
 + 
 
 + 	 	 $ t h i s - > a s s e r t E q u a l s (   2 0 0 ,   $ r e s p o n s e - > g e t _ s t a t u s ( )   ) ; 
 
 + 	 } 
 
 + 
 
 + 	 p u b l i c   f u n c t i o n   t e s t _ g e t _ i t e m s _ o r d e r b y _ p a r e n t _ q u e r y ( )   { 
 
 + 	 	 $ i d 1   =   $ t h i s - > f a c t o r y - > p o s t - > c r e a t e (   a r r a y (   ' p o s t _ s t a t u s '   = >   ' p u b l i s h ' ,   ' p o s t _ t y p e '   = >   ' p a g e '   )   ) ; 
 
 + 	 	 $ i d 2   =   $ t h i s - > f a c t o r y - > p o s t - > c r e a t e (   a r r a y (   ' p o s t _ s t a t u s '   = >   ' p u b l i s h ' ,   ' p o s t _ t y p e '   = >   ' p a g e '   )   ) ; 
 
 + 	 	 $ i d 3   =   $ t h i s - > f a c t o r y - > p o s t - > c r e a t e (   a r r a y (   ' p o s t _ s t a t u s '   = >   ' p u b l i s h ' ,   ' p o s t _ t y p e '   = >   ' p a g e ' ,   ' p o s t _ p a r e n t '   = >   $ i d 1   )   ) ; 
 
 + 
 
 + 	 	 $ r e q u e s t   =   n e w   W P _ R E S T _ R e q u e s t (   ' G E T ' ,   ' / w p / v 2 / p a g e s '   ) ; 
 
 + 	 	 $ r e q u e s t - > s e t _ p a r a m (   ' i n c l u d e ' ,   a r r a y (   $ i d 1 ,   $ i d 2 ,   $ i d 3   )   ) ; 
 
 + 	 	 $ r e q u e s t - > s e t _ p a r a m (   ' o r d e r b y ' ,   ' p a r e n t '   ) ; 
 
 + 
 
 + 	 	 $ r e s p o n s e   =   $ t h i s - > s e r v e r - > d i s p a t c h (   $ r e q u e s t   ) ; 
 
 + 	 	 $ d a t a   =   $ r e s p o n s e - > g e t _ d a t a ( ) ; 
 
 + 
 
 + 	 	 $ t h i s - > a s s e r t E q u a l s (   2 0 0 ,   $ r e s p o n s e - > g e t _ s t a t u s ( )   ) ; 
 
 + 	 	 $ t h i s - > a s s e r t E q u a l s (   $ i d 3 ,   $ d a t a [ 0 ] [ ' i d ' ]   ) ; 
 
 + 	 	 / /   C h e c k   o r d e r i n g .   D e f a u l t   O R D E R   i s   D E S C . 
 
 + 	 	 $ t h i s - > a s s e r t E q u a l s (   $ i d 1 ,   $ d a t a [ 0 ] [ ' p a r e n t ' ]   ) ; 
 
 + 	 	 $ t h i s - > a s s e r t E q u a l s (   0 ,   $ d a t a [ 1 ] [ ' p a r e n t ' ]   ) ; 
 
 + 	 	 $ t h i s - > a s s e r t E q u a l s (   0 ,   $ d a t a [ 2 ] [ ' p a r e n t ' ]   ) ; 
 
 + 	 } 
 
 + 
 
   	 p u b l i c   f u n c t i o n   t e s t _ g e t _ i t e m s _ e x c l u d e _ q u e r y ( )   { 
 
   	 	 $ i d 1   =   $ t h i s - > f a c t o r y - > p o s t - > c r e a t e (   a r r a y (   ' p o s t _ s t a t u s '   = >   ' p u b l i s h '   )   ) ; 
 
   	 	 $ i d 2   =   $ t h i s - > f a c t o r y - > p o s t - > c r e a t e (   a r r a y (   ' p o s t _ s t a t u s '   = >   ' p u b l i s h '   )   ) ; 
 
 @ @   - 2 6 4 7 , 4   + 2 7 2 2 , 2 8   @ @ 
 
   	 	 	 ' p o s t - m y - t e s t - t e m p l a t e . p h p '   = >   ' M y   T e s t   T e m p l a t e ' , 
 
   	 	 ) ; 
 
   	 } 
 
 + 
 
 + 	 / * * 
 
 + 	   *   T h e r e ' s   n o   w a y   t o   c h a n g e   p o s t _ m o d i f i e d   t h r o u g h   t h e   A P I . 
 
 + 	   * / 
 
 + 	 p r o t e c t e d   f u n c t i o n   u p d a t e _ p o s t _ m o d i f i e d (   $ p o s t _ i d ,   $ d a t e   )   { 
 
 + 	 	 g l o b a l   $ w p d b ; 
 
 + 	 	 r e t u r n   $ w p d b - > u p d a t e ( 
 
 + 	 	 	 $ w p d b - > p o s t s , 
 
 + 	 	 	 a r r a y ( 
 
 + 	 	 	 	 ' p o s t _ m o d i f i e d '   = >   $ d a t e , 
 
 + 	 	 	 	 ' p o s t _ m o d i f i e d _ g m t '   = >   $ d a t e , 
 
 + 	 	 	 ) , 
 
 + 	 	 	 a r r a y ( 
 
 + 	 	 	 	 ' I D '   = >   $ p o s t _ i d , 
 
 + 	 	 	 ) , 
 
 + 	 	 	 a r r a y ( 
 
 + 	 	 	 	 ' % s ' , 
 
 + 	 	 	 	 ' % s ' , 
 
 + 	 	 	 ) , 
 
 + 	 	 	 a r r a y ( 
 
 + 	 	 	 	 ' % d ' , 
 
 + 	 	 	 ) 
 
 + 	 	 ) ; 
 
 + 	 } 
 
   } 
 
 
