Loading src/Plugin/migrate/process/BeanCompare.php +0 −3 Original line number Diff line number Diff line Loading @@ -28,9 +28,6 @@ class BeanCompare extends ProcessPluginBase { /** * {@inheritdoc} * * @return bool * @throws \Drupal\migrate\MigrateException */ public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { [$variable_1, $variable_2] = (array) $value; Loading tests/fixtures/README.md +40 −9 Original line number Diff line number Diff line Loading @@ -23,8 +23,17 @@ cases and re-export the database and the new files back to code. - Change directory to the Bean Migrate module's root. - `drush make ./tests/fixtures/drupal7-bean.make.yml ./tests/fixtures/bean` - `cp ./tests/fixtures/settings.php ./tests/fixtures/bean/sites/default/settings.php` - Copy files: `cp -r ./tests/fixtures/files/sites/default/files ./tests/fixtures/bean/sites/default/` - ``` cp ./tests/fixtures/settings.php \ ./tests/fixtures/bean/sites/default/settings.php ``` - Copy files: ``` cp -r ./tests/fixtures/files/sites/default/files \ ./tests/fixtures/bean/sites/default/ ``` ### Database Loading @@ -36,10 +45,15 @@ uses your test database_ section since it is replaced by the make files we provide. - If it does not exist, create a new database with name `drupal7_bean` for the Drupal 7 source instance. Drupal 7 source instance. (`mysql -u <user> -p -e`) - `mysql -u <user> -p -e "CREATE DATABASE drupal7_bean DEFAULT CHARACTER SET = 'utf8' DEFAULT COLLATE 'utf8_general_ci';"` - `mysql -u <user> -p -e "grant ALL privileges on drupal7_bean.* to 'devuser'@'localhost';"` - ``` CREATE DATABASE drupal7_bean \ DEFAULT CHARACTER SET = 'utf8' \ DEFAULT COLLATE 'utf8_general_ci'; ``` - `GRANT ALL PRIVILEGES ON drupal7_bean.* TO 'devuser'@'localhost';` - Make sure that the `drupal7_bean` DB is empty. Loading @@ -64,10 +78,20 @@ we provide. - Import the Drupal 7 Bean Migrate fixture into this database. From your Drupal 8|9 project root, run: `php core/scripts/db-tools.php import --database migrate [path-to-bean_migrate]/tests/fixtures/drupal7_bean.php` ``` php core/scripts/db-tools.php import \ --database migrate \ [path-to-bean_migrate]/tests/fixtures/drupal7_bean.php ``` - [Add a row for uid 0 to {users} table manually][3]. - `drush -u 1 sql-query "INSERT INTO users (name, pass, mail, theme, signature, language, init, timezone) VALUES ('', '', '', '', '', '', '', '')"` - ``` drush -u 1 sql-query \ "INSERT INTO users \ (name, pass, mail, theme, signature, language, init, timezone) \ VALUES ('', '', '', '', '', '', '', '')" ``` - `drush -u 1 sql-query "UPDATE users SET uid = 0 WHERE name = ''"` Loading Loading @@ -101,10 +125,17 @@ forget to update the drush make file as well! ## Export the modifications you made - Export the source DB to the fixture file (From your Drupal 8|9 project root): `php core/scripts/db-tools.php dump --database migrate > [path-to-bean_migrate]/tests/fixtures/drupal7_bean.php` ``` php core/scripts/db-tools.php dump \ --database migrate \ > [path-to-bean_migrate]/tests/fixtures/drupal7_bean.php ``` - Copy the files directory back into the git repository: `cp -r tests/fixtures/bean/sites/default/files tests/fixtures/files/sites/default/` ``` cp -r tests/fixtures/bean/sites/default/files \ tests/fixtures/files/sites/default/ ``` - You can remove the untracked and ignored files if you think so: `git clean -fdx ./tests/fixtures/` Loading Loading
src/Plugin/migrate/process/BeanCompare.php +0 −3 Original line number Diff line number Diff line Loading @@ -28,9 +28,6 @@ class BeanCompare extends ProcessPluginBase { /** * {@inheritdoc} * * @return bool * @throws \Drupal\migrate\MigrateException */ public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { [$variable_1, $variable_2] = (array) $value; Loading
tests/fixtures/README.md +40 −9 Original line number Diff line number Diff line Loading @@ -23,8 +23,17 @@ cases and re-export the database and the new files back to code. - Change directory to the Bean Migrate module's root. - `drush make ./tests/fixtures/drupal7-bean.make.yml ./tests/fixtures/bean` - `cp ./tests/fixtures/settings.php ./tests/fixtures/bean/sites/default/settings.php` - Copy files: `cp -r ./tests/fixtures/files/sites/default/files ./tests/fixtures/bean/sites/default/` - ``` cp ./tests/fixtures/settings.php \ ./tests/fixtures/bean/sites/default/settings.php ``` - Copy files: ``` cp -r ./tests/fixtures/files/sites/default/files \ ./tests/fixtures/bean/sites/default/ ``` ### Database Loading @@ -36,10 +45,15 @@ uses your test database_ section since it is replaced by the make files we provide. - If it does not exist, create a new database with name `drupal7_bean` for the Drupal 7 source instance. Drupal 7 source instance. (`mysql -u <user> -p -e`) - `mysql -u <user> -p -e "CREATE DATABASE drupal7_bean DEFAULT CHARACTER SET = 'utf8' DEFAULT COLLATE 'utf8_general_ci';"` - `mysql -u <user> -p -e "grant ALL privileges on drupal7_bean.* to 'devuser'@'localhost';"` - ``` CREATE DATABASE drupal7_bean \ DEFAULT CHARACTER SET = 'utf8' \ DEFAULT COLLATE 'utf8_general_ci'; ``` - `GRANT ALL PRIVILEGES ON drupal7_bean.* TO 'devuser'@'localhost';` - Make sure that the `drupal7_bean` DB is empty. Loading @@ -64,10 +78,20 @@ we provide. - Import the Drupal 7 Bean Migrate fixture into this database. From your Drupal 8|9 project root, run: `php core/scripts/db-tools.php import --database migrate [path-to-bean_migrate]/tests/fixtures/drupal7_bean.php` ``` php core/scripts/db-tools.php import \ --database migrate \ [path-to-bean_migrate]/tests/fixtures/drupal7_bean.php ``` - [Add a row for uid 0 to {users} table manually][3]. - `drush -u 1 sql-query "INSERT INTO users (name, pass, mail, theme, signature, language, init, timezone) VALUES ('', '', '', '', '', '', '', '')"` - ``` drush -u 1 sql-query \ "INSERT INTO users \ (name, pass, mail, theme, signature, language, init, timezone) \ VALUES ('', '', '', '', '', '', '', '')" ``` - `drush -u 1 sql-query "UPDATE users SET uid = 0 WHERE name = ''"` Loading Loading @@ -101,10 +125,17 @@ forget to update the drush make file as well! ## Export the modifications you made - Export the source DB to the fixture file (From your Drupal 8|9 project root): `php core/scripts/db-tools.php dump --database migrate > [path-to-bean_migrate]/tests/fixtures/drupal7_bean.php` ``` php core/scripts/db-tools.php dump \ --database migrate \ > [path-to-bean_migrate]/tests/fixtures/drupal7_bean.php ``` - Copy the files directory back into the git repository: `cp -r tests/fixtures/bean/sites/default/files tests/fixtures/files/sites/default/` ``` cp -r tests/fixtures/bean/sites/default/files \ tests/fixtures/files/sites/default/ ``` - You can remove the untracked and ignored files if you think so: `git clean -fdx ./tests/fixtures/` Loading