Comments

Anybody created an issue. See original summary.

anybody’s picture

anybody’s picture

Status: Active » Needs review
anybody’s picture

Doesn't have configuration options, so I removed the interface.

The last submitted patch, 2: feeds-add-telephone-target-support-2962725-2.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

anybody’s picture

anybody’s picture

Works well, we're using it already. Please test and review to commit this as soon as possible :)

megachriz’s picture

Status: Needs review » Needs work

Thanks for providing a patch for this!

I'm not so sure about cutting off the string if it is too long. You would be throwing away user input without notification. Even worse: it may result into an incomplete telephone number (I also noticed that you reference the Unicode class, but you didn't "import" that class at the top of the file).

Would you like to add an unit test for this target as well?

anybody’s picture

Thank you very much, I'll check that. I thought Telephone behaves like a regular String field with 255 maxlength varchar, but I'm not sure and have a look. If that's not the case I'll remove the limit and create a new patch.

anybody’s picture

PS: Yes of course I'm willing to add a test, can you tell me where I can find some example implementation which fits best? That would help a lot and speed things up.

megachriz’s picture

@Anybody
Other tests for targets can be found in feeds/tests/src/Unit/Feeds/Target. Which of these would be the most similar? EmailTest perhaps?

anybody’s picture

Here we go. You're right, I've removed the cutoff and I added some tests as required. Please review.

Thank you very much. The module is so great!!

anybody’s picture

Status: Needs work » Needs review
anybody’s picture

StatusFileSize
new3.84 KB

Sorry I forgot to add the Tests to the patch. Attached now!

megachriz’s picture

  1. +++ b/tests/src/Unit/Feeds/Target/TelephoneTest.php
    @@ -0,0 +1,77 @@
    + * @coversDefaultClass \Drupal\feeds\Feeds\Target\StringTarget
    ...
    +class StringTargetTest extends FeedsUnitTestCase {
    

    The name of the class is wrong, apparently resulting into the test being ignored by the testbot.

  2. +++ b/tests/src/Unit/Feeds/Target/TelephoneTest.php
    @@ -0,0 +1,77 @@
    +    $method(0, values);
    ...
    +    $method(0, values);
    

    No dollar sign for variable 'values'.

In the attached patch I've rewritten the test with a data provider. As I think randomness should be avoided in tests (as they can cause random test failures), I left these parts of the tests out.

Status: Needs review » Needs work

The last submitted patch, 15: feeds-add-telephone-target-support-2962725-15.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

megachriz’s picture

Status: Needs work » Needs review
StatusFileSize
new2.96 KB
new970 bytes

Referenced the right class in the test and a few coding standard fixes.

anybody’s picture

Thank you MegaChriz, still a lot to learn. I hope I'll do better next time!

  • MegaChriz committed 8ae1223 on 8.x-3.x authored by Anybody
    Issue #2962725 by Anybody, MegaChriz: Added Feeds target for Telephone...
megachriz’s picture

Status: Needs review » Fixed

@Anybody
You bet! ;)

Committed #17.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.