From 258e6c366a853d0329cccff00dca7fc1438dcd14 Mon Sep 17 00:00:00 2001
From: Xiaodan Wang <bala@ciandt.com>
Date: Thu, 24 Mar 2016 13:43:41 +0800
Subject: [PATCH 01/13] Initial commit

---
 .move_user.info.yml.swp | Bin 0 -> 12288 bytes
 LICENSE.txt             | 339 ++++++++++++++++++++++++++++++++++++++++++++++++
 move-user.js            |  28 ++++
 move_user.info          |  13 ++
 move_user.info.yml      |  10 ++
 move_user.module        |  52 ++++++++
 6 files changed, 442 insertions(+)
 create mode 100644 .move_user.info.yml.swp
 create mode 100755 LICENSE.txt
 create mode 100644 move-user.js
 create mode 100644 move_user.info
 create mode 100644 move_user.info.yml
 create mode 100644 move_user.module

diff --git a/.move_user.info.yml.swp b/.move_user.info.yml.swp
new file mode 100644
index 0000000000000000000000000000000000000000..7e518ddb78129cb42cf136bc812bcd78e0992ee0
GIT binary patch
literal 12288
zcmeI&Jx|;)7zgm@IwG}2Mcv&O$aKjaP+fXc1rtcL3ojF@e2&Y7yR$9ZcY*;JSosFb
z{Z?K21-kGB`uGS!FwnW^Z|N_`j^iZ1Ey^?K>~HOeUcOG;7KwhH-RzfdS6XLZhz4>j
z)AYaE=GJb9Tlwkh#*<6W(}u-?^`qdV(nVFeq3acuE89b<MlueqDJHg>j&&%MHPP1t
z9?$gmY0&=uD6h>Ao1ad`Pu>kDApn7g0xxN8wcAN^AKt$cOK<ibp2i3Q5P$##AOHaf
zKmY;|c-8{ZwdjK1@I~{M3r*j8)Hg$P5P$##AOHafKmY;|fB*y_009X6hXS%9`u&P%
z`87X0|Np=H{{O?{pPXyX73Y%UIftBW&MGHe^O1uF0SG_<0uX=z1Rwwb2tWV=5O@{>
z@zm+QxUEd5N=6-`oVdQox@(`;yS=jP^fGeZ9%~iTx~5{CX4;3^nm*UppR~K2O3z4$
z_Iyb@6}9Kbfr9e2i=j_k6hD$je5Y@5s68p``MAtasM5D<=6hwE(kML^>2e{JvQra-
lkfst|%Mj`#BU0_WHc>>&^EPcZU!9SW6W%i0;U{cn{sIQKegOag

literal 0
HcmV?d00001

diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100755
index 0000000..d159169
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,339 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                            NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License along
+    with this program; if not, write to the Free Software Foundation, Inc.,
+    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/move-user.js b/move-user.js
new file mode 100644
index 0000000..d5f1168
--- /dev/null
+++ b/move-user.js
@@ -0,0 +1,28 @@
+(function ($) {
+
+  Drupal.behaviors.moveUserAdmin = {
+    attach: function (context, settings) {
+
+      var formItemReassignUser = $('.form-item-reassign-user', context);
+      var cancelMethodsWrapper = $("#edit-user-cancel-method", context);
+
+      if ($('[value=move_user_reassign]').is(':checked')){
+         formItemReassignUser.appendTo(cancelMethodsWrapper).show();
+      } else {
+        formItemReassignUser.hide();
+      }
+
+      $(cancelMethodsWrapper).find('input').once('move-user-admin', function () {
+        $(this).change(function (e) {
+          if ($(e.target).val() == 'move_user_reassign') {
+            formItemReassignUser.appendTo(cancelMethodsWrapper).fadeIn(200);
+          } else {
+            formItemReassignUser.hide();
+          }
+        });
+      }, context);
+
+    }
+  };
+
+})(jQuery);
\ No newline at end of file
diff --git a/move_user.info b/move_user.info
new file mode 100644
index 0000000..7a95af5
--- /dev/null
+++ b/move_user.info
@@ -0,0 +1,13 @@
+name = Move user
+description = Cancel user accounts and reassign content to another user
+core = 7.x
+package = Other
+files[] = move_user.module
+scripts[] = move-user.js
+
+; Information added by Drupal.org packaging script on 2014-03-07
+version = "7.x-1.x-dev"
+core = "7.x"
+project = "move_user"
+datestamp = "1394178807"
+
diff --git a/move_user.info.yml b/move_user.info.yml
new file mode 100644
index 0000000..ee55e52
--- /dev/null
+++ b/move_user.info.yml
@@ -0,0 +1,10 @@
+name: 'Move user'
+description: 'Cancel user accounts and reassign content to another user'
+core: 8.x
+package: Other
+scripts:
+  - move-user.js
+version: 7.x-1.x-dev
+project: move_user
+datestamp: '1394178807'
+type: module
diff --git a/move_user.module b/move_user.module
new file mode 100644
index 0000000..622f1e9
--- /dev/null
+++ b/move_user.module
@@ -0,0 +1,52 @@
+<?php 
+
+function move_user_user_cancel_methods_alter(&$methods) {
+  unset($methods['user_cancel_reassign']);
+  $methods['move_user_reassign'] = array(
+    'title' => t('Disable the account and make its content belong to another user.'),
+    'description' => t('All your content will be removed and assigned to a different user'),
+    'access' => \Drupal::currentUser()->hasPermission('administer users'),
+  );
+}
+
+function move_user_form_alter(&$form, \Drupal\Core\Form\FormStateInterface &$form_state, $form_id) {
+  if ($form_id == 'user_cancel_confirm_form' || $form_id == 'user_multiple_cancel_confirm_form') { 
+    // @FIXME
+// // @FIXME
+// // This looks like another module's variable. You'll need to rewrite this call
+// // to ensure that it uses the correct configuration object.
+// $form['reassign_user'] = array(
+//       '#type' => 'textfield',
+//       '#title' => t('Reassign content to:'),
+//       '#maxlength' => 60,
+//       '#autocomplete_path' => 'user/autocomplete',
+//       '#weight' => 10,
+//       '#description' => t('Leave blank for %anonymous.',
+//         array('%anonymous' => variable_get('anonymous', t('Anonymous')))),
+//     );
+
+  }
+}
+
+function move_user_user_cancel($edit, $account, $method) {
+  $new_account = user_load_by_name($edit['reassign_user']);
+  $new_uid = !empty($new_account->uid) ? $new_account->uid : 0;
+  switch ($method) {
+    case 'move_user_reassign':
+
+      module_load_include('inc', 'node', 'node.admin');
+      $nodes = db_select('node', 'n')
+        ->fields('n', array('nid'))
+        ->condition('uid', $account->uid)
+        ->execute()
+        ->fetchCol();
+      node_mass_update($nodes, array('uid' => $new_uid));
+
+      db_update('node_revision')
+        ->fields(array('uid' => $new_uid))
+        ->condition('uid', $account->uid)
+        ->execute();
+
+      break;
+  }
+}
\ No newline at end of file
-- 
1.8.4


From f6a2c82a3c775d9944736c44fd6eb75369764e60 Mon Sep 17 00:00:00 2001
From: Xiaodan Wang <bala@ciandt.com>
Date: Thu, 24 Mar 2016 13:55:31 +0800
Subject: [PATCH 02/13] Remove .swp file

---
 .move_user.info.yml.swp | Bin 12288 -> 0 bytes
 1 file changed, 0 insertions(+), 0 deletions(-)
 delete mode 100644 .move_user.info.yml.swp

diff --git a/.move_user.info.yml.swp b/.move_user.info.yml.swp
deleted file mode 100644
index 7e518ddb78129cb42cf136bc812bcd78e0992ee0..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 12288
zcmeI&Jx|;)7zgm@IwG}2Mcv&O$aKjaP+fXc1rtcL3ojF@e2&Y7yR$9ZcY*;JSosFb
z{Z?K21-kGB`uGS!FwnW^Z|N_`j^iZ1Ey^?K>~HOeUcOG;7KwhH-RzfdS6XLZhz4>j
z)AYaE=GJb9Tlwkh#*<6W(}u-?^`qdV(nVFeq3acuE89b<MlueqDJHg>j&&%MHPP1t
z9?$gmY0&=uD6h>Ao1ad`Pu>kDApn7g0xxN8wcAN^AKt$cOK<ibp2i3Q5P$##AOHaf
zKmY;|c-8{ZwdjK1@I~{M3r*j8)Hg$P5P$##AOHafKmY;|fB*y_009X6hXS%9`u&P%
z`87X0|Np=H{{O?{pPXyX73Y%UIftBW&MGHe^O1uF0SG_<0uX=z1Rwwb2tWV=5O@{>
z@zm+QxUEd5N=6-`oVdQox@(`;yS=jP^fGeZ9%~iTx~5{CX4;3^nm*UppR~K2O3z4$
z_Iyb@6}9Kbfr9e2i=j_k6hD$je5Y@5s68p``MAtasM5D<=6hwE(kML^>2e{JvQra-
lkfst|%Mj`#BU0_WHc>>&^EPcZU!9SW6W%i0;U{cn{sIQKegOag

-- 
1.8.4


From 0978e58047387bd12e5afddd251302ba4e40c0c6 Mon Sep 17 00:00:00 2001
From: Xiaodan Wang <bala@ciandt.com>
Date: Thu, 24 Mar 2016 13:56:32 +0800
Subject: [PATCH 03/13] Modified .info.yml file to remove scripts and change
 order of properties

---
 move_user.info.yml | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/move_user.info.yml b/move_user.info.yml
index ee55e52..e657d76 100644
--- a/move_user.info.yml
+++ b/move_user.info.yml
@@ -1,10 +1,6 @@
 name: 'Move user'
 description: 'Cancel user accounts and reassign content to another user'
-core: 8.x
 package: Other
-scripts:
-  - move-user.js
-version: 7.x-1.x-dev
-project: move_user
-datestamp: '1394178807'
+
 type: module
+core: 8.x
-- 
1.8.4


From 1bcccaf4542f0bd7e9560c2a6cfada1a3b8542be Mon Sep 17 00:00:00 2001
From: kevin <liuhaierok@126.com>
Date: Thu, 24 Mar 2016 14:20:50 +0800
Subject: [PATCH 04/13] init the move_user tests

---
 .../module/move_user_test/move_user_test.info.yml  | 12 ++++++
 tests/module/move_user_test/move_user_test.module  | 45 ++++++++++++++++++++++
 2 files changed, 57 insertions(+)
 create mode 100644 tests/module/move_user_test/move_user_test.info.yml
 create mode 100644 tests/module/move_user_test/move_user_test.module

diff --git a/tests/module/move_user_test/move_user_test.info.yml b/tests/module/move_user_test/move_user_test.info.yml
new file mode 100644
index 0000000..c80d286
--- /dev/null
+++ b/tests/module/move_user_test/move_user_test.info.yml
@@ -0,0 +1,12 @@
+name: 'Move user tests'
+type: module
+description: 'Support module for move user testing.'
+package: Testing
+# version: VERSION
+# core: 8.x
+
+# Information added by Drupal.org packaging script on 2016-03-24
+version: '8.0.5'
+core: '8.x'
+project: 'drupal'
+datestamp: 1458827552
diff --git a/tests/module/move_user_test/move_user_test.module b/tests/module/move_user_test/move_user_test.module
new file mode 100644
index 0000000..93b0546
--- /dev/null
+++ b/tests/module/move_user_test/move_user_test.module
@@ -0,0 +1,45 @@
+<?php
+/**
+ * @file
+ * Contains \Drupal\move_user\MoveUserTest.
+ */
+
+namespace Drupal\move_user\Tests;
+
+use Drupal\simpletest\WebTestBase;
+
+/**
+ * Tests the assign the new user when move user.
+ *
+ * @group move_user
+ */
+class MoveUserTest extends WebTestBase {
+
+    /**
+     * Modules to enable.
+     *
+     * @var array
+     */
+    public static $modules = array('block', 'move_user');
+
+    /**
+     * Tests the assign the new user when move user.
+     */
+    public function testMoveUser() {
+
+        $admin_user = $this->drupalCreateUser(array(
+            'administer block classes',
+            'administer blocks',
+        ));
+        $this->drupalLogin($admin_user);
+
+        // Add a content block with custom CSS class.
+        $this->drupalGet('admin/structure/block/add/system_main_block/classy', ['query' => ['region' => 'content']]);
+        $edit = array(
+            'region' => 'content',
+            'third_party_settings[move_user][classes]' => 'TestClass_content'
+        );
+        $this->drupalPostForm(NULL, $edit, t('Save block'));
+    }
+
+}
-- 
1.8.4


From 278abe48559e4f4338791fbadc4c9d141ea5e16a Mon Sep 17 00:00:00 2001
From: Xiaodan Wang <bala@ciandt.com>
Date: Thu, 24 Mar 2016 15:17:58 +0800
Subject: [PATCH 05/13] Add README.txt

---
 README.txt | 8 ++++++++
 1 file changed, 8 insertions(+)
 create mode 100644 README.txt

diff --git a/README.txt b/README.txt
new file mode 100644
index 0000000..78b6bc4
--- /dev/null
+++ b/README.txt
@@ -0,0 +1,8 @@
+This module adds a new method for cancelling user accounts. 
+It is based on the user_cancel_reassign cancel method from Drupal core, 
+but adds the option to select which user the content is reassigned to, 
+rather than just assigning content to the anonymous user.
+
+To use simply install and enable the module, then when an administrator (or 
+user with "administer users" permission) cancels a user account they will be 
+given the extra option to select which user the content is reassigned to.
-- 
1.8.4


From af743b4252368719c5a54602223405b71c4c09b1 Mon Sep 17 00:00:00 2001
From: Kevin <Kevin@ciandt.com>
Date: Thu, 24 Mar 2016 15:29:38 +0800
Subject: [PATCH 06/13] Upgrade hook_form_alter and
 hook_user_cancel_methods_alter

---
 move_user.module | 33 ++++++++++++++++-----------------
 1 file changed, 16 insertions(+), 17 deletions(-)

diff --git a/move_user.module b/move_user.module
index 622f1e9..03bd597 100644
--- a/move_user.module
+++ b/move_user.module
@@ -1,7 +1,11 @@
 <?php 
 
+/**
+ * Implement of hook_user_cancel_menthods_alter().
+ */
 function move_user_user_cancel_methods_alter(&$methods) {
   unset($methods['user_cancel_reassign']);
+  // Add a custom move user reassign method.
   $methods['move_user_reassign'] = array(
     'title' => t('Disable the account and make its content belong to another user.'),
     'description' => t('All your content will be removed and assigned to a different user'),
@@ -10,26 +14,21 @@ function move_user_user_cancel_methods_alter(&$methods) {
 }
 
 function move_user_form_alter(&$form, \Drupal\Core\Form\FormStateInterface &$form_state, $form_id) {
-  if ($form_id == 'user_cancel_confirm_form' || $form_id == 'user_multiple_cancel_confirm_form') { 
-    // @FIXME
-// // @FIXME
-// // This looks like another module's variable. You'll need to rewrite this call
-// // to ensure that it uses the correct configuration object.
-// $form['reassign_user'] = array(
-//       '#type' => 'textfield',
-//       '#title' => t('Reassign content to:'),
-//       '#maxlength' => 60,
-//       '#autocomplete_path' => 'user/autocomplete',
-//       '#weight' => 10,
-//       '#description' => t('Leave blank for %anonymous.',
-//         array('%anonymous' => variable_get('anonymous', t('Anonymous')))),
-//     );
-
+  if ($form_id == 'user_cancel_form' || $form_id == 'user_multiple_cancel_confirm') {
+    $form['move_user_reassign'] = array(
+      '#type' => 'entity_autocomplete',
+      '#target_type' => 'user',
+      '#title' => t('Reassign content to:'),
+      '#maxlength' => 60,
+      '#weight' => 10,
+      '#description' => t('Leave blank for %anonymous.',
+        array('%anonymous' => \Drupal::config('user.settings')->get('anonymous'))),
+    );
   }
 }
 
 function move_user_user_cancel($edit, $account, $method) {
-  $new_account = user_load_by_name($edit['reassign_user']);
+  $new_account = \Drupal\user\Entity\User::load();
   $new_uid = !empty($new_account->uid) ? $new_account->uid : 0;
   switch ($method) {
     case 'move_user_reassign':
@@ -49,4 +48,4 @@ function move_user_user_cancel($edit, $account, $method) {
 
       break;
   }
-}
\ No newline at end of file
+}
-- 
1.8.4


From 0213dad269f27adce4b2bef5ceffeaa235b8f6e2 Mon Sep 17 00:00:00 2001
From: Xiaodan Wang <bala@ciandt.com>
Date: Thu, 24 Mar 2016 15:54:27 +0800
Subject: [PATCH 07/13] Initial a WebTest for move_user module

---
 src/Tests/.MoveUserTest.php.swp | Bin 0 -> 12288 bytes
 src/Tests/MoveUserTest.php      |  27 +++++++++++++++++++++++++++
 2 files changed, 27 insertions(+)
 create mode 100644 src/Tests/.MoveUserTest.php.swp
 create mode 100644 src/Tests/MoveUserTest.php

diff --git a/src/Tests/.MoveUserTest.php.swp b/src/Tests/.MoveUserTest.php.swp
new file mode 100644
index 0000000000000000000000000000000000000000..8f75accffb90081761f49761b5fba7e7cf897c3c
GIT binary patch
literal 12288
zcmeI2y>1gh5XU!EGywz!NJ%k3L9h~E_);tZN|ex~2o3otu!PokYu_p7y<>MT0inQ)
zz&k*VM29GN1zrIf5Cs+gS=&iO5o*M&^!MJ5=VRyR>g4GyZm)09Qv0^TI;Yg7H{Z8c
zPtQ#~omHx*OU>rLt+n;dMXb)9hpQ*LzT||-PUUuety7a^ojR|VlC175<T~BeA+KyQ
ztg@ywK1nMZT+zdM&pc_oafx?nvT1zq$p&m&F!8C494A(lFNJ^*P)+DBbf(p<n>QAj
z#?>pA>B9Lf0V4#2fDjM@LO=)z0U;m+gus79Ak<Up75Y6j?s;asPyMlvkFp5?As_^V
zfDjM@LO=)z0U;m+gn$qb0{<WZohfyHTB(l^|NlRE|NnJXsh`kS=mYc~8bB%3gI1tr
zXcn4*E<#_<DD@h0Pz61PcAz%209}KApw2hwGxQ1Ky6>R3kSrk}1cZPP5CTF#2nYco
zAOwVf5I7=maG;24SM2FvsNdK$6qRLLv^Tx7NDs{vFdsdcm7cp!FW^S4Bz{tyq^6J?
z(%u&X8y~INC!V#Y{oGjM(d&3@BP40H@b*{2nI<VY1(|2T*v!+8>G640d&7meOp8_q
zu4?L-D9&)h#%5=Z*Q_$*DOB+S-eB%Kn-p!a&GKn<(QH`Q!Uv~A<wo~JSY}EC7Tk%A
zsZyj5CY$F<Yw?-Feii*a=}~s7?5H&^JPM#bnvWUgNyTot?gQ7<y6iqGhBcS*p?j>+
zyGmI-G;x}J;>plruiZ!(E@Kv(dEu#Fl!kb;T^ANj<IbFuQc#Nw(%huGRP>M76QXM4
v`jtcT1H?LK(ojCfZxUH@l^9QOiP_kVGaudrPdro45wyZLi0$25=E?crdWQ+7

literal 0
HcmV?d00001

diff --git a/src/Tests/MoveUserTest.php b/src/Tests/MoveUserTest.php
new file mode 100644
index 0000000..cc9eb8f
--- /dev/null
+++ b/src/Tests/MoveUserTest.php
@@ -0,0 +1,27 @@
+<?php
+/**
+ * @file
+ * Test case for testing the move_user module.
+ *
+ * This file contains the test cases to check if move user is performing correctly.
+ */
+
+namespace Drupal\move_user\Tests;
+
+use Drupal\Simpletest\WebTestBase;
+
+/**
+ * Create two users and use one user to create few nodes, 
+ * then use the administrator user to delete the nodes created,
+ * reassign the nodes to the second user.
+ *
+ * @group move_user
+ */
+class MoveUserTest extends WebTestBase {
+
+  /**
+   * Tests the assign the new user when move user.
+   */
+  public function testMoveUser() {
+  }
+}
-- 
1.8.4


From 262cc63fa8ddf8a2f9e4980130ddd329f319cb0a Mon Sep 17 00:00:00 2001
From: "qing@ciandt.com" <qing@ciandt.com>
Date: Thu, 24 Mar 2016 16:29:06 +0800
Subject: [PATCH 08/13] move_user ugrade

---
 move-user.js            |  9 +++------
 move_user.info.yml      |  2 +-
 move_user.libraries.yml |  4 ++++
 move_user.module        | 20 +++++++++++---------
 4 files changed, 19 insertions(+), 16 deletions(-)
 create mode 100644 move_user.libraries.yml

diff --git a/move-user.js b/move-user.js
index d5f1168..09d9bc4 100644
--- a/move-user.js
+++ b/move-user.js
@@ -1,26 +1,23 @@
 (function ($) {
 
   Drupal.behaviors.moveUserAdmin = {
-    attach: function (context, settings) {
 
+    attach: function (context, settings) {
       var formItemReassignUser = $('.form-item-reassign-user', context);
       var cancelMethodsWrapper = $("#edit-user-cancel-method", context);
-
       if ($('[value=move_user_reassign]').is(':checked')){
          formItemReassignUser.appendTo(cancelMethodsWrapper).show();
       } else {
         formItemReassignUser.hide();
       }
-
-      $(cancelMethodsWrapper).find('input').once('move-user-admin', function () {
-        $(this).change(function (e) {
+      $("#edit-user-cancel-method input").off().on("change", function (e) {
           if ($(e.target).val() == 'move_user_reassign') {
             formItemReassignUser.appendTo(cancelMethodsWrapper).fadeIn(200);
           } else {
             formItemReassignUser.hide();
           }
         });
-      }, context);
+
 
     }
   };
diff --git a/move_user.info.yml b/move_user.info.yml
index e657d76..6e04882 100644
--- a/move_user.info.yml
+++ b/move_user.info.yml
@@ -3,4 +3,4 @@ description: 'Cancel user accounts and reassign content to another user'
 package: Other
 
 type: module
-core: 8.x
+core: 8.x
\ No newline at end of file
diff --git a/move_user.libraries.yml b/move_user.libraries.yml
new file mode 100644
index 0000000..2e96473
--- /dev/null
+++ b/move_user.libraries.yml
@@ -0,0 +1,4 @@
+move_user:
+  version: VERSION
+  js: 
+    move-user.js: {}
\ No newline at end of file
diff --git a/move_user.module b/move_user.module
index 03bd597..3bd5e89 100644
--- a/move_user.module
+++ b/move_user.module
@@ -15,7 +15,8 @@ function move_user_user_cancel_methods_alter(&$methods) {
 
 function move_user_form_alter(&$form, \Drupal\Core\Form\FormStateInterface &$form_state, $form_id) {
   if ($form_id == 'user_cancel_form' || $form_id == 'user_multiple_cancel_confirm') {
-    $form['move_user_reassign'] = array(
+    $form['#attached']['library'][] = 'move_user/move_user';
+    $form['reassign_user'] = array(
       '#type' => 'entity_autocomplete',
       '#target_type' => 'user',
       '#title' => t('Reassign content to:'),
@@ -30,20 +31,21 @@ function move_user_form_alter(&$form, \Drupal\Core\Form\FormStateInterface &$for
 function move_user_user_cancel($edit, $account, $method) {
   $new_account = \Drupal\user\Entity\User::load();
   $new_uid = !empty($new_account->uid) ? $new_account->uid : 0;
+  $new_uid = $edit['reassign_user'];
   switch ($method) {
     case 'move_user_reassign':
 
       module_load_include('inc', 'node', 'node.admin');
-      $nodes = db_select('node', 'n')
-        ->fields('n', array('nid'))
-        ->condition('uid', $account->uid)
-        ->execute()
-        ->fetchCol();
-      node_mass_update($nodes, array('uid' => $new_uid));
 
-      db_update('node_revision')
+      $nodes = \Drupal::entityQuery('node')
+        ->condition('uid', $account->id())
+        ->execute();
+        
+      node_mass_update($nodes, array('uid' => $new_uid), NULL, TRUE);
+
+      db_update('node_field_revision')
         ->fields(array('uid' => $new_uid))
-        ->condition('uid', $account->uid)
+        ->condition('uid', $account->id())
         ->execute();
 
       break;
-- 
1.8.4


From 2c8e99e247940bef186195672c3bac220b89ed03 Mon Sep 17 00:00:00 2001
From: jieyyal <jieyyal@ciandt.com>
Date: Thu, 24 Mar 2016 16:34:13 +0800
Subject: [PATCH 09/13] Add comment for each hook

---
 move_user.module | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/move_user.module b/move_user.module
index 3bd5e89..f31ba2b 100644
--- a/move_user.module
+++ b/move_user.module
@@ -1,4 +1,8 @@
 <?php 
+/**
+ * @file
+ * Adds a new method for cancelling user accounts.
+ */
 
 /**
  * Implement of hook_user_cancel_menthods_alter().
@@ -13,6 +17,9 @@ function move_user_user_cancel_methods_alter(&$methods) {
   );
 }
 
+/**
+ * Implement of hook_form_alter().
+ */
 function move_user_form_alter(&$form, \Drupal\Core\Form\FormStateInterface &$form_state, $form_id) {
   if ($form_id == 'user_cancel_form' || $form_id == 'user_multiple_cancel_confirm') {
     $form['#attached']['library'][] = 'move_user/move_user';
@@ -28,6 +35,9 @@ function move_user_form_alter(&$form, \Drupal\Core\Form\FormStateInterface &$for
   }
 }
 
+/**
+ * Implement of hook_user_cancel().
+ */
 function move_user_user_cancel($edit, $account, $method) {
   $new_account = \Drupal\user\Entity\User::load();
   $new_uid = !empty($new_account->uid) ? $new_account->uid : 0;
@@ -40,7 +50,6 @@ function move_user_user_cancel($edit, $account, $method) {
       $nodes = \Drupal::entityQuery('node')
         ->condition('uid', $account->id())
         ->execute();
-        
       node_mass_update($nodes, array('uid' => $new_uid), NULL, TRUE);
 
       db_update('node_field_revision')
-- 
1.8.4


From 8121ead2952f44d08e7d3a635de00f9cd778053d Mon Sep 17 00:00:00 2001
From: Xiaodan Wang <bala@ciandt.com>
Date: Thu, 24 Mar 2016 20:51:47 +0800
Subject: [PATCH 10/13] Remove buggy code from hook_user_cancel

---
 move_user.module | 2 --
 1 file changed, 2 deletions(-)

diff --git a/move_user.module b/move_user.module
index f31ba2b..bc6d679 100644
--- a/move_user.module
+++ b/move_user.module
@@ -39,8 +39,6 @@ function move_user_form_alter(&$form, \Drupal\Core\Form\FormStateInterface &$for
  * Implement of hook_user_cancel().
  */
 function move_user_user_cancel($edit, $account, $method) {
-  $new_account = \Drupal\user\Entity\User::load();
-  $new_uid = !empty($new_account->uid) ? $new_account->uid : 0;
   $new_uid = $edit['reassign_user'];
   switch ($method) {
     case 'move_user_reassign':
-- 
1.8.4


From 5e11f25e2ee2e9b2f984b6530b725dc05ad10a87 Mon Sep 17 00:00:00 2001
From: Xiaodan Wang <bala@ciandt.com>
Date: Thu, 24 Mar 2016 20:52:00 +0800
Subject: [PATCH 11/13] Add webtest for move_user module

---
 src/Tests/MoveUserTest.php | 48 ++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 44 insertions(+), 4 deletions(-)

diff --git a/src/Tests/MoveUserTest.php b/src/Tests/MoveUserTest.php
index cc9eb8f..d2d8496 100644
--- a/src/Tests/MoveUserTest.php
+++ b/src/Tests/MoveUserTest.php
@@ -8,7 +8,7 @@
 
 namespace Drupal\move_user\Tests;
 
-use Drupal\Simpletest\WebTestBase;
+use \Drupal\simpletest\WebTestBase;
 
 /**
  * Create two users and use one user to create few nodes, 
@@ -17,11 +17,51 @@ use Drupal\Simpletest\WebTestBase;
  *
  * @group move_user
  */
-class MoveUserTest extends WebTestBase {
+class MoveUserTest extends \Drupal\node\Tests\NodeTestBase {
+
+  protected $originalAuthor;
+
+  protected $newAuthor;
+
+  protected $createdNode;
+
+  public static $modules = array('move_user', 'user');
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function setUp() {
+    parent::setUp();
+
+    $this->originalAuthor = $this->drupalCreateUser(array('create page content', 'edit own page content'));
+    // Create another admin user for delete the web_user
+    $this->newAuthor = $this->drupalCreateUser(array('create page content', 'edit own page content'));
+
+    // create a page node with current user
+    $this->createdNode = $this->drupalCreateNode(array('type' => 'page', 'uid' => $this->originalAuthor->id()));
+
+  }
 
   /**
-   * Tests the assign the new user when move user.
+   * Tests to reassign node to another user.
    */
-  public function testMoveUser() {
+  public function testCancelUserMoveUser() {
+    // Create administrator user and login
+    $admin_user = $this->drupalCreateUser(array('administer nodes', 'administer users'));
+    $this->drupalLogin($admin_user);
+
+    // Cancel the author page
+    $cancel_user_url = 'user/' . $this->originalAuthor->id() . '/cancel';
+    $this->drupalGet($cancel_user_url);
+
+    $edit = array();
+    $edit['user_cancel_method'] = 'move_user_reassign';
+    $edit['reassign_user'] = $this->newAuthor->getUserName() . ' (' . $this->newAuthor->id() . ')';
+    $edit['confirm'] = 1; 
+    $this->drupalPostForm($cancel_user_url, $edit, t('Cancel account'));
+
+    // check if the node's author is changed to newAuthor
+    $node = node_load($this->createdNode->id());
+    $this->assertEqual($node->getOwnerId(), $this->newAuthor->id(), 'Ensure that the node is reassigned to the new user correctly.');
   }
 }
-- 
1.8.4


From 1fbe45e0d77b09811d2d94efc462f74daaebf250 Mon Sep 17 00:00:00 2001
From: Xiaodan Wang <bala@ciandt.com>
Date: Thu, 24 Mar 2016 20:53:35 +0800
Subject: [PATCH 12/13] Delete unless file from drupal 7

---
 move_user.info                  |  13 -------------
 src/Tests/.MoveUserTest.php.swp | Bin 12288 -> 0 bytes
 2 files changed, 13 deletions(-)
 delete mode 100644 move_user.info
 delete mode 100644 src/Tests/.MoveUserTest.php.swp

diff --git a/move_user.info b/move_user.info
deleted file mode 100644
index 7a95af5..0000000
--- a/move_user.info
+++ /dev/null
@@ -1,13 +0,0 @@
-name = Move user
-description = Cancel user accounts and reassign content to another user
-core = 7.x
-package = Other
-files[] = move_user.module
-scripts[] = move-user.js
-
-; Information added by Drupal.org packaging script on 2014-03-07
-version = "7.x-1.x-dev"
-core = "7.x"
-project = "move_user"
-datestamp = "1394178807"
-
diff --git a/src/Tests/.MoveUserTest.php.swp b/src/Tests/.MoveUserTest.php.swp
deleted file mode 100644
index 8f75accffb90081761f49761b5fba7e7cf897c3c..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 12288
zcmeI2y>1gh5XU!EGywz!NJ%k3L9h~E_);tZN|ex~2o3otu!PokYu_p7y<>MT0inQ)
zz&k*VM29GN1zrIf5Cs+gS=&iO5o*M&^!MJ5=VRyR>g4GyZm)09Qv0^TI;Yg7H{Z8c
zPtQ#~omHx*OU>rLt+n;dMXb)9hpQ*LzT||-PUUuety7a^ojR|VlC175<T~BeA+KyQ
ztg@ywK1nMZT+zdM&pc_oafx?nvT1zq$p&m&F!8C494A(lFNJ^*P)+DBbf(p<n>QAj
z#?>pA>B9Lf0V4#2fDjM@LO=)z0U;m+gus79Ak<Up75Y6j?s;asPyMlvkFp5?As_^V
zfDjM@LO=)z0U;m+gn$qb0{<WZohfyHTB(l^|NlRE|NnJXsh`kS=mYc~8bB%3gI1tr
zXcn4*E<#_<DD@h0Pz61PcAz%209}KApw2hwGxQ1Ky6>R3kSrk}1cZPP5CTF#2nYco
zAOwVf5I7=maG;24SM2FvsNdK$6qRLLv^Tx7NDs{vFdsdcm7cp!FW^S4Bz{tyq^6J?
z(%u&X8y~INC!V#Y{oGjM(d&3@BP40H@b*{2nI<VY1(|2T*v!+8>G640d&7meOp8_q
zu4?L-D9&)h#%5=Z*Q_$*DOB+S-eB%Kn-p!a&GKn<(QH`Q!Uv~A<wo~JSY}EC7Tk%A
zsZyj5CY$F<Yw?-Feii*a=}~s7?5H&^JPM#bnvWUgNyTot?gQ7<y6iqGhBcS*p?j>+
zyGmI-G;x}J;>plruiZ!(E@Kv(dEu#Fl!kb;T^ANj<IbFuQc#Nw(%huGRP>M76QXM4
v`jtcT1H?LK(ojCfZxUH@l^9QOiP_kVGaudrPdro45wyZLi0$25=E?crdWQ+7

-- 
1.8.4


From 97889f5608d877815d2508d156d66e0a26fe13b7 Mon Sep 17 00:00:00 2001
From: Xiaodan Wang <bala@ciandt.com>
Date: Fri, 25 Mar 2016 13:47:06 +0800
Subject: [PATCH 13/13] Fix code standarings

---
 move-user.js                                       | 25 +++++++-----
 move_user.module                                   |  8 ++--
 src/Tests/MoveUserTest.php                         | 21 +++++-----
 .../module/move_user_test/move_user_test.info.yml  | 12 ------
 tests/module/move_user_test/move_user_test.module  | 45 ----------------------
 5 files changed, 30 insertions(+), 81 deletions(-)
 delete mode 100644 tests/module/move_user_test/move_user_test.info.yml
 delete mode 100644 tests/module/move_user_test/move_user_test.module

diff --git a/move-user.js b/move-user.js
index 09d9bc4..908543c 100644
--- a/move-user.js
+++ b/move-user.js
@@ -1,3 +1,7 @@
+/**
+ * @file
+ */
+
 (function ($) {
 
   Drupal.behaviors.moveUserAdmin = {
@@ -5,21 +9,22 @@
     attach: function (context, settings) {
       var formItemReassignUser = $('.form-item-reassign-user', context);
       var cancelMethodsWrapper = $("#edit-user-cancel-method", context);
-      if ($('[value=move_user_reassign]').is(':checked')){
+      if ($('[value=move_user_reassign]').is(':checked')) {
          formItemReassignUser.appendTo(cancelMethodsWrapper).show();
-      } else {
+      }
+      else {
         formItemReassignUser.hide();
       }
       $("#edit-user-cancel-method input").off().on("change", function (e) {
-          if ($(e.target).val() == 'move_user_reassign') {
-            formItemReassignUser.appendTo(cancelMethodsWrapper).fadeIn(200);
-          } else {
-            formItemReassignUser.hide();
-          }
-        });
-
+        if ($(e.target).val() == 'move_user_reassign') {
+          formItemReassignUser.appendTo(cancelMethodsWrapper).fadeIn(200);
+        }
+        else {
+          formItemReassignUser.hide();
+        }
+      });
 
     }
   };
 
-})(jQuery);
\ No newline at end of file
+})(jQuery);
diff --git a/move_user.module b/move_user.module
index bc6d679..ccacdb4 100644
--- a/move_user.module
+++ b/move_user.module
@@ -1,11 +1,11 @@
-<?php 
+<?php
 /**
  * @file
  * Adds a new method for cancelling user accounts.
  */
 
 /**
- * Implement of hook_user_cancel_menthods_alter().
+ * Implements hook_user_cancel_menthods_alter().
  */
 function move_user_user_cancel_methods_alter(&$methods) {
   unset($methods['user_cancel_reassign']);
@@ -18,7 +18,7 @@ function move_user_user_cancel_methods_alter(&$methods) {
 }
 
 /**
- * Implement of hook_form_alter().
+ * Implements hook_form_alter().
  */
 function move_user_form_alter(&$form, \Drupal\Core\Form\FormStateInterface &$form_state, $form_id) {
   if ($form_id == 'user_cancel_form' || $form_id == 'user_multiple_cancel_confirm') {
@@ -36,7 +36,7 @@ function move_user_form_alter(&$form, \Drupal\Core\Form\FormStateInterface &$for
 }
 
 /**
- * Implement of hook_user_cancel().
+ * Implements hook_user_cancel().
  */
 function move_user_user_cancel($edit, $account, $method) {
   $new_uid = $edit['reassign_user'];
diff --git a/src/Tests/MoveUserTest.php b/src/Tests/MoveUserTest.php
index d2d8496..9462f46 100644
--- a/src/Tests/MoveUserTest.php
+++ b/src/Tests/MoveUserTest.php
@@ -3,15 +3,15 @@
  * @file
  * Test case for testing the move_user module.
  *
- * This file contains the test cases to check if move user is performing correctly.
+ * This file contains the test cases to check if move user is done correctly.
  */
 
 namespace Drupal\move_user\Tests;
 
-use \Drupal\simpletest\WebTestBase;
-
 /**
- * Create two users and use one user to create few nodes, 
+ * Move user test case.
+ *
+ * Create two users and use one user to create few nodes,
  * then use the administrator user to delete the nodes created,
  * reassign the nodes to the second user.
  *
@@ -34,10 +34,10 @@ class MoveUserTest extends \Drupal\node\Tests\NodeTestBase {
     parent::setUp();
 
     $this->originalAuthor = $this->drupalCreateUser(array('create page content', 'edit own page content'));
-    // Create another admin user for delete the web_user
+    // Create another admin user for delete the web_user.
     $this->newAuthor = $this->drupalCreateUser(array('create page content', 'edit own page content'));
 
-    // create a page node with current user
+    // Create a page node with current user.
     $this->createdNode = $this->drupalCreateNode(array('type' => 'page', 'uid' => $this->originalAuthor->id()));
 
   }
@@ -46,22 +46,23 @@ class MoveUserTest extends \Drupal\node\Tests\NodeTestBase {
    * Tests to reassign node to another user.
    */
   public function testCancelUserMoveUser() {
-    // Create administrator user and login
+    // Create administrator user and login.
     $admin_user = $this->drupalCreateUser(array('administer nodes', 'administer users'));
     $this->drupalLogin($admin_user);
 
-    // Cancel the author page
+    // Cancel the author page.
     $cancel_user_url = 'user/' . $this->originalAuthor->id() . '/cancel';
     $this->drupalGet($cancel_user_url);
 
     $edit = array();
     $edit['user_cancel_method'] = 'move_user_reassign';
     $edit['reassign_user'] = $this->newAuthor->getUserName() . ' (' . $this->newAuthor->id() . ')';
-    $edit['confirm'] = 1; 
+    $edit['confirm'] = 1;
     $this->drupalPostForm($cancel_user_url, $edit, t('Cancel account'));
 
-    // check if the node's author is changed to newAuthor
+    // Check if the node's author is changed to newAuthor.
     $node = node_load($this->createdNode->id());
     $this->assertEqual($node->getOwnerId(), $this->newAuthor->id(), 'Ensure that the node is reassigned to the new user correctly.');
   }
+
 }
diff --git a/tests/module/move_user_test/move_user_test.info.yml b/tests/module/move_user_test/move_user_test.info.yml
deleted file mode 100644
index c80d286..0000000
--- a/tests/module/move_user_test/move_user_test.info.yml
+++ /dev/null
@@ -1,12 +0,0 @@
-name: 'Move user tests'
-type: module
-description: 'Support module for move user testing.'
-package: Testing
-# version: VERSION
-# core: 8.x
-
-# Information added by Drupal.org packaging script on 2016-03-24
-version: '8.0.5'
-core: '8.x'
-project: 'drupal'
-datestamp: 1458827552
diff --git a/tests/module/move_user_test/move_user_test.module b/tests/module/move_user_test/move_user_test.module
deleted file mode 100644
index 93b0546..0000000
--- a/tests/module/move_user_test/move_user_test.module
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-/**
- * @file
- * Contains \Drupal\move_user\MoveUserTest.
- */
-
-namespace Drupal\move_user\Tests;
-
-use Drupal\simpletest\WebTestBase;
-
-/**
- * Tests the assign the new user when move user.
- *
- * @group move_user
- */
-class MoveUserTest extends WebTestBase {
-
-    /**
-     * Modules to enable.
-     *
-     * @var array
-     */
-    public static $modules = array('block', 'move_user');
-
-    /**
-     * Tests the assign the new user when move user.
-     */
-    public function testMoveUser() {
-
-        $admin_user = $this->drupalCreateUser(array(
-            'administer block classes',
-            'administer blocks',
-        ));
-        $this->drupalLogin($admin_user);
-
-        // Add a content block with custom CSS class.
-        $this->drupalGet('admin/structure/block/add/system_main_block/classy', ['query' => ['region' => 'content']]);
-        $edit = array(
-            'region' => 'content',
-            'third_party_settings[move_user][classes]' => 'TestClass_content'
-        );
-        $this->drupalPostForm(NULL, $edit, t('Save block'));
-    }
-
-}
-- 
1.8.4

