writers.php 867 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. /**
  3. * Test WP_Export_*_Writer classes
  4. *
  5. * @group export
  6. * @ticket 22435
  7. */
  8. class Test_WP_Export_Writers extends WP_UnitTestCase {
  9. function test_export_returner_returns_all_the_return_values() {
  10. if ( ! class_exists( 'WP_Export_Returner' ) ) {
  11. $this->markTestSkipped( "WP_Export_Returner class doesn't exist" );
  12. }
  13. $returner = new WP_Export_Returner( $this->get_x_formatter() );
  14. $this->assertEquals( 'xxx' , $returner->export() );
  15. }
  16. private function get_x_formatter() {
  17. $methods = array( 'before_posts', 'posts', 'after_posts' );
  18. $formatter = $this->getMock( 'WP_Export_WXR_Formatter', $methods, array( null ) );
  19. foreach( $methods as $method ) {
  20. $return = 'posts' == $method? array( 'x' ) : 'x';
  21. $formatter->expects( $this->once() )->method( $method )->with()->will( $this->returnValue( $return ) );
  22. }
  23. return $formatter;
  24. }
  25. }