diff --git a/tests/test-load-textdomain.php b/tests/test-load-textdomain.php index d2f524a..e0ea889 100644 --- a/tests/test-load-textdomain.php +++ b/tests/test-load-textdomain.php @@ -1,73 +1,32 @@ user->create( - array( - 'role' => 'administrator', - 'locale' => 'ja', - ) - ); - } - - /** - * @covers ::geolonia_gis_load_textdomain - */ - public function test_load_textdomain() { + public function set_up() { + parent::set_up(); add_filter('locale', function() { return 'ja'; }); - $this->assertTrue( geolonia_gis_load_textdomain() ); - } - /** - * @covers ::geolonia_gis_load_textdomain - */ - public function test_load_textdomain_by_plugin_locale() { - add_filter('plugin_locale', function() { - return 'ja'; - }); - $this->assertTrue( geolonia_gis_load_textdomain() ); - } - - /** - * @covers ::geolonia_gis_load_textdomain - */ - public function test_load_textdomain_when_locale_is_english() { - add_filter('locale', function() { - return 'en_US'; - }); - $this->assertFalse( geolonia_gis_load_textdomain() ); + load_plugin_textdomain( 'geolonia-open-gis', false, dirname(dirname( plugin_basename( __FILE__ ) )). '/languages' ); } - /** - * @covers ::geolonia_gis_load_textdomain - */ - public function test_load_textdomain_plugin_locale_is_english() { - add_filter('plugin_locale', function() { - return 'en_US'; - }); - $this->assertFalse( geolonia_gis_load_textdomain() ); - } - - /** - * @covers ::geolonia_gis_load_textdomain - */ - public function test_load_textdomain_user_locale_is_japanese() { - - add_filter('locale', function() { - return 'en_US'; - }); - - set_current_screen( 'dashboard' ); - wp_set_current_user( self::$user_id ); - - $this->assertTrue( geolonia_gis_load_textdomain() ); + public function test_translation() { + + $domain = 'geolonia-open-gis'; + + $this->assertSame( 'GeoJSON をアップロードしてください', __( 'Upload GeoJSON', $domain ) ); + $this->assertSame( '座標', __( 'Coordinates', $domain ) ); + $this->assertSame( '現在の座標を使用する', __( 'Use the current coordinates', $domain ) ); + $this->assertSame( 'ズーム', __( 'Zoom', $domain ) ); + $this->assertSame( '現在のズームレベルを使用する', __( 'Use the current zoom level', $domain ) ); + $this->assertSame( 'スタイル', __( 'Style', $domain ) ); + $this->assertSame( '地物の数: ', __( 'Number of features: ', $domain ) ); + $this->assertSame( '標準', __( 'Standard', $domain ) ); + $this->assertSame( '地理院地図', __( 'GSI', $domain ) ); + $this->assertSame( '白地図', __( 'Blank Map', $domain ) ); + $this->assertSame( '地図', __( 'Map', $domain ) ); + $this->assertSame( '株式会社 Geolonia', __( 'Geolonia Inc.', $domain ) ); } } diff --git a/tests/test-register_post_type_maps.php b/tests/test-register_post_type_maps.php deleted file mode 100644 index d24fde9..0000000 --- a/tests/test-register_post_type_maps.php +++ /dev/null @@ -1,94 +0,0 @@ -assertNull( get_post_type_object( 'maps' ) ); - - register_post_type_maps(); - - $maps_object = get_post_type_object( 'maps' ); - - $this->assertInstanceOf( 'WP_Post_Type', $maps_object ); - $this->assertSame( 'maps', $maps_object->name ); - } - - /** - * @covers ::register_post_type_maps - */ - public function test_maps_post_type_options() { - - $this->assertNull( get_post_type_object( 'maps' ) ); - - register_post_type_maps(); - - $maps_object = get_post_type_object( 'maps' ); - - // labels の設定値を確認 - $this->assertSame( 'Map', $maps_object->label ); - - // public の設定値を確認 - $this->assertTrue( $maps_object->public ); - - // hierarchical の設定値を確認 - $this->assertFalse( $maps_object->hierarchical ); - - // show_ui の設定値を確認 - $this->assertTrue( $maps_object->show_ui ); - - // show_in_menu の設定値を確認 - $this->assertTrue( $maps_object->show_in_nav_menus ); - - // カスタム投稿タイプの supports に title が含まれているか確認 - $this->assertTrue( post_type_supports( 'maps', 'title' ), 'Title support is enabled' ); - - // カスタム投稿タイプの supports に editor が含まれているか確認 - $this->assertTrue( post_type_supports( 'maps', 'editor' ), 'Editor support is enabled' ); - - // カスタム投稿タイプの supports に author が含まれているか確認 - $this->assertTrue( post_type_supports( 'maps', 'revisions' ), 'Revisions support is enabled' ); - - // カスタム投稿タイプの supports に excerpt が含まれているか確認 - $this->assertTrue( post_type_supports( 'maps', 'excerpt' ), 'Excerpt support is enabled' ); - - // archive の設定値を確認 - $this->assertFalse( $maps_object->has_archive ); - - // rewrite の設定値を確認 - $this->assertSame( array('slug' => 'maps'), $maps_object->rewrite ); - - // query_var の設定値を確認 - $this->assertSame( 'maps', $maps_object->query_var ); - - // menu_icon の設定値を確認 - $this->assertSame( 'dashicons-location', $maps_object->menu_icon ); - - // show_in_rest の設定値を確認 - $this->assertTrue( $maps_object->show_in_rest ); - - // rest_base の設定値を確認 - $this->assertSame( GEOLONIA_GIS_POST_TYPE, $maps_object->rest_base ); - - // rest_controller_class の設定値を確認 - $this->assertSame( 'WP_REST_Posts_Controller', $maps_object->rest_controller_class ); - - // taxonomies の設定値を確認 - $this->assertSame( array( 'map_tag' ), $maps_object->taxonomies ); - - // capability_type の設定値を確認 - $this->assertSame( 'map', $maps_object->capability_type ); - - // map_meta_cap の設定値を確認 - $this->assertTrue( $maps_object->map_meta_cap ); - } -}