Skip to content

Commit

Permalink
Merge branch 'release-1.8.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
thingsym committed Jan 19, 2022
2 parents a2dace1 + 4f08b08 commit 1fcade0
Show file tree
Hide file tree
Showing 10 changed files with 97 additions and 20 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,12 @@ Small patches and bug reports can be submitted a issue tracker in Github. Forkin

## Changelog

* Version 1.8.2
* change requires at least to wordpress 4.9
* change requires to PHP 5.6
* add test case
* set the initial value an empty array
* add hook_suffix argument
* Version 1.8.1
* update japanese translation
* update pot
Expand Down Expand Up @@ -557,6 +563,9 @@ Small patches and bug reports can be submitted a issue tracker in Github. Forkin

## Upgrade Notice

* Version 1.8.2
* Requires at least version 4.9 of the WordPress
* Requires PHP version 5.6
* Version 1.6.0
* Requires at least version 3.7 of the WordPress
* Version 1.1.2
Expand Down
4 changes: 2 additions & 2 deletions languages/multi-device-switcher-ja.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is distributed under the same license as the Multi Device Switcher package.
msgid ""
msgstr ""
"Project-Id-Version: Multi Device Switcher 1.8.1\n"
"Project-Id-Version: Multi Device Switcher 1.8.2n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/multi-device-"
"switcher\n"
"POT-Creation-Date: 2021-12-26 08:37:47+00:00\n"
Expand All @@ -21,7 +21,7 @@ msgstr "モバイル"
msgid "PC"
msgstr "PC"

#. #-#-#-#-# multi-device-switcher.pot (Multi Device Switcher 1.8.1) #-#-#-#-#
#. #-#-#-#-# multi-device-switcher.pot (Multi Device Switcher 1.8.2) #-#-#-#-#
#. Plugin Name of the plugin/theme
#: multi-device-switcher.php:755 multi-device-switcher.php:756
#: multi-device-switcher.php:939 multi-device-switcher.php:1394
Expand Down
4 changes: 2 additions & 2 deletions languages/multi-device-switcher.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is distributed under the same license as the Multi Device Switcher package.
msgid ""
msgstr ""
"Project-Id-Version: Multi Device Switcher 1.8.1\n"
"Project-Id-Version: Multi Device Switcher 1.8.2\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/multi-device-"
"switcher\n"
"POT-Creation-Date: 2021-12-26 08:37:47+00:00\n"
Expand All @@ -21,7 +21,7 @@ msgstr ""
msgid "PC"
msgstr ""

#. #-#-#-#-# multi-device-switcher.pot (Multi Device Switcher 1.8.1) #-#-#-#-#
#. #-#-#-#-# multi-device-switcher.pot (Multi Device Switcher 1.8.2) #-#-#-#-#
#. Plugin Name of the plugin/theme
#: multi-device-switcher.php:755 multi-device-switcher.php:756
#: multi-device-switcher.php:939 multi-device-switcher.php:1394
Expand Down
8 changes: 4 additions & 4 deletions multi-device-switcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Multi Device Switcher
* Plugin URI: https://github.com/thingsym/multi-device-switcher
* Description: This WordPress plugin allows you to set a separate theme for device (Smart Phone, Tablet PC, Mobile Phone, Game and custom).
* Version: 1.8.1
* Version: 1.8.2
* Author: thingsym
* Author URI: https://www.thingslabo.com/
* License: GPL2 or later
Expand Down Expand Up @@ -134,7 +134,7 @@ class Multi_Device_Switcher {
*
* @var array|null $plugin_data
*/
public $plugin_data;
public $plugin_data = array();

/**
* Constructor
Expand Down Expand Up @@ -676,7 +676,7 @@ public function add_header_vary( $headers ) {
*
* @since 1.0.0
*/
public function admin_enqueue_scripts( $hook_suffix ) {
public function admin_enqueue_scripts( $hook_suffix = '' ) {
wp_enqueue_script(
'multi-device-switcher-options',
plugins_url() . '/multi-device-switcher/multi-device-switcher.js',
Expand All @@ -694,7 +694,7 @@ public function admin_enqueue_scripts( $hook_suffix ) {
*
* @since 1.0.0
*/
public function admin_enqueue_styles( $hook_suffix ) {
public function admin_enqueue_styles( $hook_suffix = '' ) {
wp_enqueue_style(
'multi-device-switcher-options',
plugins_url() . '/multi-device-switcher/multi-device-switcher.css',
Expand Down
2 changes: 1 addition & 1 deletion pc-switcher-widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Widget Name: PC Switcher Widget
* Plugin URI: https://github.com/thingsym/multi-device-switcher
* Description: PC Switcher Widget add-on for the Multi Device Switcher. Use this widget to add the PC Switcher to a widget.
* Version: 1.8.1
* Version: 1.8.2
* Author: thingsym
* Author URI: https://www.thingslabo.com/
* License: GPL2 or later
Expand Down
17 changes: 14 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ Contributors: thingsym
Link: https://github.com/thingsym/multi-device-switcher
Donate link: https://github.com/sponsors/thingsym
Tags: switcher, theme, ipad, iphone, android, tablet, mobile, game
Stable tag: 1.8.1
Stable tag: 1.8.2
Tested up to: 5.8.0
Requires at least: 3.7
Requires PHP: 5.4
Requires at least: 4.9
Requires PHP: 5.6
License: GPL2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -365,6 +365,13 @@ For more information about the Multi Device Switcher Command, see `wp help multi

== Changelog ==

= 1.8.2 =
* change requires at least to wordpress 4.9
* change requires to PHP 5.6
* add test case
* set the initial value an empty array
* add hook_suffix argument

= 1.8.1 =
* update japanese translation
* update pot
Expand Down Expand Up @@ -540,6 +547,10 @@ For more information about the Multi Device Switcher Command, see `wp help multi

== Upgrade Notice ==

= 1.8.2 =
* Requires at least version 4.9 of the WordPress
* Requires PHP version 5.6

= 1.6.0 =
* Requires at least version 3.7 of the WordPress

Expand Down
5 changes: 4 additions & 1 deletion tests/test-constructor.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,17 @@ function public_variable() {
$this->assertEquals( $expected, $this->multi_device_switcher->default_options );

$this->assertEquals( '', $this->multi_device_switcher->device );
$this->assertNull( $this->multi_device_switcher->plugin_data );

$this->assertIsArray( $this->multi_device_switcher->plugin_data );
$this->assertEmpty( $this->multi_device_switcher->plugin_data );
}

/**
* @test
* @group constructor
*/
function constructor() {
$this->assertEquals( 10, has_action( 'init', array( $this->multi_device_switcher, 'load_plugin_data' ) ) );
$this->assertEquals( 10, has_filter( 'init', array( $this->multi_device_switcher, 'load_textdomain' ) ) );
$this->assertEquals( 10, has_filter( 'init', array( $this->multi_device_switcher, 'init' ) ) );

Expand Down
14 changes: 8 additions & 6 deletions tests/test-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,10 @@ function add_header_vary() {
function admin_enqueue() {
$this->multi_device_switcher->load_plugin_data();

$this->multi_device_switcher->admin_enqueue_scripts( '' );
$this->multi_device_switcher->admin_enqueue_scripts();
$this->assertTrue( wp_script_is( 'multi-device-switcher-options' ) );

$this->multi_device_switcher->admin_enqueue_styles( '' );
$this->multi_device_switcher->admin_enqueue_styles();
$this->assertTrue( wp_style_is( 'multi-device-switcher-options' ) );
}

Expand All @@ -296,8 +296,7 @@ function option_page_capability() {
function add_option_page() {
$this->markTestIncomplete( 'This test has not been implemented yet.' );

$this->multi_device_switcher->add_option_page();

// $this->multi_device_switcher->add_option_page();
// $this->assertEquals( 10, has_action( 'load-appearance_page_multi-device-switcher', array( $this->multi_device_switcher, 'page_hook_suffix' ) ) );
}

Expand Down Expand Up @@ -362,8 +361,11 @@ function load_textdomain() {
* @test
* @group functions
*/
function load_plugin_data() {
$this->assertTrue( $this->multi_device_switcher->load_plugin_data() );
public function load_plugin_data() {
$this->multi_device_switcher->load_plugin_data();
$result = $this->multi_device_switcher->plugin_data;

$this->assertTrue( is_array( $result ) );
}

}
42 changes: 42 additions & 0 deletions tests/test-shortcode.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

class Test_Multi_Device_Switcher_Shortcode extends WP_UnitTestCase {

public function setUp() {
parent::setUp();

$this->multi_device_switcher = new Multi_Device_Switcher();

$options = array(
'pc_switcher' => 1,
'default_css' => 1,
'theme_smartphone' => 'Twenty Sixteen',
'theme_tablet' => 'Twenty Sixteen',
'theme_mobile' => 'None',
'theme_game' => 'None',
'userAgent_smart' => 'iPhone, iPod, Android.*Mobile, dream, CUPCAKE, Windows Phone, IEMobile.*Touch, webOS, BB10.*Mobile, BlackBerry.*Mobile, Mobile.*Gecko',
'userAgent_tablet' => 'iPad, Kindle, Silk, Android(?!.*Mobile), Windows.*Touch, PlayBook, Tablet.*Gecko',
'userAgent_mobile' => 'DoCoMo, SoftBank, J-PHONE, Vodafone, KDDI, UP.Browser, WILLCOM, emobile, DDIPOCKET, Windows CE, BlackBerry, Symbian, PalmOS, Huawei, IAC, Nokia',
'userAgent_game' => 'PlayStation Portable, PlayStation Vita, PSP, PS2, PLAYSTATION 3, PlayStation 4, Nitro, Nintendo 3DS, Nintendo Wii, Nintendo WiiU, Xbox',
'disable_path' => '',
'enable_regex' => 0,
'custom_switcher_theme_test' => 'Twenty Sixteen',
'custom_switcher_userAgent_test' => 'test1,test2',
);

update_option( 'multi_device_switcher_options', $options );
}

function tearDown() {
parent::tearDown();
}

/**
* @test
* @group shortcode
*/
function is_shortcode() {
$this->assertTrue( shortcode_exists( 'multi' ) );
}

}
12 changes: 11 additions & 1 deletion tests/test-wp-cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,17 @@ class Test_Multi_Device_Switcher_WP_Cli extends WP_UnitTestCase {

public function setUp() {
parent::setUp();
$this->multi_device_switcher = new Multi_Device_Switcher();
// $this->multi_device_switcher_command = new Multi_Device_Switcher_Command();
}

/**
* @test
* @group basic
*/
function public_variable() {
$this->markTestIncomplete( 'This test has not been implemented yet.' );

// $this->assertEquals( 'multi_device_switcher_options', $this->multi_device_switcher_command->options );
}

/**
Expand Down

0 comments on commit 1fcade0

Please sign in to comment.