From b5d32b6e9cd8b4752fd8d2c58bc6062ab87542f0 Mon Sep 17 00:00:00 2001 From: gggeek Date: Fri, 21 Oct 2022 09:42:13 +0000 Subject: [PATCH] more tests; docs --- Resources/doc/DSL/Faker.md | 6 ++++++ Tests/dsl/good/LipsumTestOK001.yml | 4 ++-- WHATSNEW.md | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Resources/doc/DSL/Faker.md b/Resources/doc/DSL/Faker.md index 98bfb06..1b52020 100644 --- a/Resources/doc/DSL/Faker.md +++ b/Resources/doc/DSL/Faker.md @@ -52,6 +52,12 @@ you can use this instead: It works as the original `randomHtml` property, except that it generates rich text compatible with the XmlText field type. + * the `randomXmlText($maxDepth=4, $maxWidth=4)` property. + Same as the above, for the RichText field type. + + * the `adjective`, `animal` and `noun` properties, which generate each a single word of the specific type. + Words are only in english, and they come from lists deployed as .txt file within the bundle + * the `pdfFile($dir = '/tmp', $pages=5, $title = '', $author = '', $subject = '', $keywords = '')` property. It can be used to generate PDF files with random contents, and will return the name of the generated file diff --git a/Tests/dsl/good/LipsumTestOK001.yml b/Tests/dsl/good/LipsumTestOK001.yml index fdcf4ab..1f7345a 100644 --- a/Tests/dsl/good/LipsumTestOK001.yml +++ b/Tests/dsl/good/LipsumTestOK001.yml @@ -78,7 +78,7 @@ content_type: klib_test_001 parent_location: 2 attributes: - name: " Test item [loop:iteration] - [faker:sentence(3)]" + name: 'Test item [loop:iteration] - [faker:sentence(3)] - [faker: randomelement({0:"hello", 1:"world"})]' references: - attribute: location_id @@ -94,7 +94,7 @@ content_type: klib_test_001 parent_location: reference:parent_folder_loc attributes: - name: "Test item [faker:uuid] : [faker:adjective] [faker:noun] [faker:animal]" + name: "Test item [faker:uuid] - [faker:adjective] [faker:noun] [faker:animal]" # @todo it seems that some country codes from Faker are not known to eZ and/or we have an array-vs-string issue... #country: "faker:countryCode" email: "faker:email" diff --git a/WHATSNEW.md b/WHATSNEW.md index f981cf3..3084f2c 100644 --- a/WHATSNEW.md +++ b/WHATSNEW.md @@ -31,7 +31,7 @@ Version 1.4 * New: the bundle now includes a custom Faker generator that registers the modifier `maxDistinct($maxElements = 100, $reset = false)` This can be used when you want to limit a generated element to be limited to have a limited set of distinct values. - If can be f.e. useful when you generate images or files by querying remote services which impose limits on the + It can be f.e. useful when you generate images or files by querying remote services which impose limits on the number of calls that can be placed. Eg: by using `maxDistinct().picture`, your code would only be retrieving 100 different pictures. Please note that this modifier does not insure uniqueness of the results, but it can be combined with `unique()`. @@ -43,7 +43,7 @@ Version 1.3 * New: the bundle now includes a custom Faker provider that registers the properties `noun`, `adjective` and `animal`. Those are not yet multilingual and will return only english words. -* New: the bundle now includes a custom Faker provider that registers the `pdfText` property. It can be used to generate +* New: the bundle now includes a custom Faker provider that registers the `pdfFile` property. It can be used to generate pdf files which contain random rich text. * Minor tweaks to the xmlText generator