Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
migration system
Priority:
Major
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
20 Dec 2013 at 08:23 UTC
Updated:
29 Jul 2014 at 23:13 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
chx commentedComment #3
yesct commentedOnly went through MigrateExecutable class.
Read all the docs. (made some changes)
read all the changed lines of code in the patch. (looked good)
read only some of the rest of the lines of code in the class.
1. entity_get_controller is depreciated, do we want to fix that in this issue?
2. left the TODO:'s in here. @chx said in irc they will be fixed in this issue.
except for the Handle config id one, so I reformatted that and made an issue for it.
3. phpstorm suggested adding break; in the case. seemed to make sense to me.
and @throws in processRow()
4. added some types to @param and @return
and missing doc on getTimeLimit() (these maybe have been the only core gate blockers so far)
5. added type hint for \Exception in:
public function handleException(\Exception $exception, $save = TRUE) {
6. small things:
a. moved some properties that were in with the methods up with the other properties.
b. made method first sentence a one line summary, starting with third person verb.
c. added punctuation to some sentence ends.
d. changed boolean to bool
e. made indent under @param and @return 2 spaces (instead of one)
f. used (optional) in optional @params
https://drupal.org/node/1354 lists those things.
q: tiny nit (very not a core gate that should not block this) question,
this uses quotes like
Examples in https://drupal.org/node/1354 are just like:
core has quotes like that 377 times though.. grep -R " - \'" core | grep -v yml | grep -v vendor | wc -l
Comment #4
yesct commentedNoting for next change someone finds, we can do as @tim.plunkett said in irc:
And then in processRow(), $plugin will be able to recognize methods getPluginDefinition, transform, multiple.
nice.
and it's in https://drupal.org/node/1354#types too
Comment #5
chx commentedImplemented a destination-do-not-migrate signal and documented it on the process page (of course) and added the test for it, while at it added the suggestion in #4 (but I don't see the improvement).
Comment #7
chx commentedComment #8
yesct commentedoh. I see now. The g needs to fall into each case so that it is 1024*1024*1024. Thanks chx.
Comment #9
yesct commentedgoing to start reviewing the next bit.
Comment #10
yesct commentedI did anyway. Will wait for opinion. [edit: added link to issue:] We should help with #1994890: Allow {@inheritdoc} and additional documentation
I checked each was there and had docs.
Note that Database/Connection.php is missing @param and @returns and types on many things.
why was this param reordered in FakeSelect? Select, which it extends had the original order. [edit: no Select was different. This is reordering what FakeSelect was, as chx answered, to make it consistant with the other FakeThings. ok]
should this have extended Query/Truncate?
the first time times this many?
does the first test when the tables do not exist, and the second test when they do? I'm not sure what to use for the method descriptions.
I think this was actually run the test.
also, what is the type for $schema?
several of the classes have a property like this, what is it for? I'm not sure what the description should be.
I did not finish, but posting to get feedback, and also get answers to some questions, since am repeating some patterns.
I did not yet read all the lines of code in the classes I did go through, mostly just docs standards stuff.
Comment #11
chx commented1. So it doesn't work in phpstorm, not to worry. Marking such is good still.
2. Dunno either but you need to put the docs somewhere and I've seen several such docs core and vendors too.
3.,4. The doxygen missing from DBTNG is not ours to work with.
5. To make all fake classes consistent: databasecontent first.
7. Yeah the docs got outdated, there was some weird ratio stuff here before but now it's just
the fake amount of memory usage reported after memory reclaim.8. > does the first test when the tables do not exist, and the second test when they do? I'm not sure what to use for the method descriptions.
Aye, it does. There are different code paths in that function that fire when the tables don't exist and when they do.
9. > I think this was actually run the test.
I think so too.
10. > also, what is the type for $schema
array. It's the table schema being tested.
11. [#2152131] just leave it alone please.
Comment #13
yesct commenteda. is this creating the database to be used in the test? I think so, but we usually use get functions to get stuff that already exists, so this threw me off for a bit.
b. Are $database_contents of type \PDO or \Drupal\Core\Database\Connection ?
nope. @chx points out that the *point* is it is fake, not a database or connection. It is: an array , each key is a table name, each value is a list of table rows
Comment #14
chx commented> a. is this creating the database to be used in the test? I think so
No it's not, the database is already filled in, it's in $database_contents.
> we usually use get functions to get stuff that already exists
No, we usually call \Drupal::foo() which lazy instantiates an object through the Symfony service container subsystem. Just because the object creation is static cached and done somewhere else, it still happens. It's a test so we shortcut that.
Comment #15
yesct commentedFixed the fake database contents stuff. Didn't put @see to FakeSelect, but that seemed like a good idea.
talked with @tim.plunkett and worked out the type hinting to get the methods recognized. it was an array of an array of...
Did more docs and type stuff. I know it is in tests and seems a bit silly.
changed some names of somethingIDWhatever to somethingIdWhatever
and sql to SQL and id to ID in comments
migrate/Tests/process/DedupeEntityTest.php changes accidentally got into the patch. took those changes out. @chx said that will be handled in #2152355: Refactor the entity dedupe test to use dataProvider
Next, check if I messed up anything (see if there are no test fails) and would be good to actually read and understand.
Comment #16
yesct commentedto address #14, should:
core/modules/migrate/tests/Drupal/migrate/Tests/MigrateTestCase.php
@@ -56,7 +56,7 @@ protected function getMigration() {
}
/**
- * Creates a fake database for use in tests.
+ * Gets the fake database for use in tests.
*
* @param array $database_contents
---
I'm not sure why I can't rename the file core/modules/migrate/tests/Drupal/migrate/Tests/TestSqlIdmap.php to core/modules/migrate/tests/Drupal/migrate/Tests/TestSqlIdMap.php
when I apply the patch, I can ls both core/modules/migrate/tests/Drupal/migrate/Tests/TestSqlIdmap.php and core/modules/migrate/tests/Drupal/migrate/Tests/TestSqlIdMap.php
So weird.
---
off for a while though. so it's available for someone else.
Comment #17
chx commentedthe interdiff doesn't show the refactor to TestSqlIdMap , sorry.
Comment #18
chx commentedRemoved the entity cache now that entity destination is in.
Comment #20
dawehnerThis testcoverage is really impressive!!
Just wonder whether this really works.
We use "otherwise FALSE." most of the time.
I kinda hate to see that also drupal uses that . shortcut. Can't we just add "0" in front of it?
We could also maybe reset some of the container.
We could save the if by using return $pctime > $this...
+1
Wait, we print out messages?
All this code is damn impressive!
This is not needed
Comment #22
chx commented18: 2160345_18.patch queued for re-testing.
Comment #23
dawehner---
Comment #24
chx commentedComment #25
chx commentedComment #26
dawehnerThe interdiff looks great!
Comment #27
chx commentedMajoring this as it is blocking us now with the many fixes added and the skip-the-row exception.
Comment #28
andypostAs @chx said here is a changes from #2168277: Migrate mapping tables hash column should be varchar 64
Comment #29
chx commentedBack to RTBC, sorry for the noise, we will deal with the hash in a followup.
Comment #30
andypostJust a small nitpicks
Comment #31
catchOverall looks great, a couple of smallish things:
This is a decimal notation of a fraction. When I see fraction I usually thing 1/5 or whatever. Then using 85% is yet a third way to say the same thing. We should pick one and stick to it.
Same again.
When would the unit not be in seconds? Should that be an exception rather than null, or is it a valid case that we just don't care about here?
This is getting less and less true, i.e. our entity caching is now in class properties, but I know it's just moved around here and there's already a @todo for the container.
This is nifty. However should it be 'mock' connection?
Also presumably this could be used for non-migrate tests?
Comment #32
chx commentedhttp://xunitpatterns.com/Mocks,%20Fakes,%20Stubs%20and%20Dummies.html
Fake Object (page X) Run (unrunnable) tests (faster)
Mock Object (page X) Verify indirect outputs of SUT
It's definitely a Fake. Will address the rest if YesCT doesn't beat me to it.
Comment #33
chx commentedAs for seconds, I have no idea and need to ask mikeryan. Followup?
Comment #35
chx commentedThe failure is not in the patch, it's in the context. Fixed patch.
Comment #36
catchCommitted/pushed to 8.x, thanks!
Comment #37
yesct commentedMade this very minor issue to track the bit about what to do when units is not in seconds.
#2172351: for migrations when would time not be in units of seconds