Loading s3-uploads.php +5 −0 Original line number Diff line number Diff line Loading @@ -21,7 +21,12 @@ function s3_uploads_init() { return; } if ( ! defined( 'S3_UPLOADS_REGION' ) ) { wp_die( 'S3_UPLOADS_REGION constant is required. Please define it in your wp-config.php' ); } $instance = S3_Uploads::get_instance(); $instance->register_stream_wrapper(); add_filter( 'upload_dir', array( $instance, 'filter_upload_dir' ) ); add_filter( 'wp_image_editors', array( $instance, 'filter_editors' ), 9 ); Loading tests/test-s3-uploads.php 0 → 100644 +18 −0 Original line number Diff line number Diff line <?php class Test_S3_Uploads extends WP_UnitTestCase { function test_get_s3_bucket_location() { $uploads = new S3_Uploads( 'hmn-uploads', S3_UPLOADS_KEY, S3_UPLOADS_SECRET, S3_UPLOADS_REGION ); $region = $uploads->get_s3_bucket_region(); $this->assertEquals( 'us-east-1', $region ); } function test_get_s3_bucket() { $uploads = new S3_Uploads( 'hmn-uploads/something', S3_UPLOADS_KEY, S3_UPLOADS_SECRET, S3_UPLOADS_REGION ); $this->assertEquals( 'hmn-uploads', $uploads->get_s3_bucket() ); } } No newline at end of file Loading
s3-uploads.php +5 −0 Original line number Diff line number Diff line Loading @@ -21,7 +21,12 @@ function s3_uploads_init() { return; } if ( ! defined( 'S3_UPLOADS_REGION' ) ) { wp_die( 'S3_UPLOADS_REGION constant is required. Please define it in your wp-config.php' ); } $instance = S3_Uploads::get_instance(); $instance->register_stream_wrapper(); add_filter( 'upload_dir', array( $instance, 'filter_upload_dir' ) ); add_filter( 'wp_image_editors', array( $instance, 'filter_editors' ), 9 ); Loading
tests/test-s3-uploads.php 0 → 100644 +18 −0 Original line number Diff line number Diff line <?php class Test_S3_Uploads extends WP_UnitTestCase { function test_get_s3_bucket_location() { $uploads = new S3_Uploads( 'hmn-uploads', S3_UPLOADS_KEY, S3_UPLOADS_SECRET, S3_UPLOADS_REGION ); $region = $uploads->get_s3_bucket_region(); $this->assertEquals( 'us-east-1', $region ); } function test_get_s3_bucket() { $uploads = new S3_Uploads( 'hmn-uploads/something', S3_UPLOADS_KEY, S3_UPLOADS_SECRET, S3_UPLOADS_REGION ); $this->assertEquals( 'hmn-uploads', $uploads->get_s3_bucket() ); } } No newline at end of file