Mercurial > hg > isophonics-drupal-site
comparison core/lib/Drupal/Component/Assertion/Inspector.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | 4c8ae668cc8c |
children | 129ea1e6d783 |
comparison
equal
deleted
inserted
replaced
13:5fb285c0d0e3 | 14:1fec387a4317 |
---|---|
11 * functions in this collection check a variable against an assertion about its | 11 * functions in this collection check a variable against an assertion about its |
12 * structure. | 12 * structure. |
13 * | 13 * |
14 * Example call: | 14 * Example call: |
15 * @code | 15 * @code |
16 * assert('Drupal\\Component\\Assertion\\Inspector::assertAllStrings($array)'); | 16 * assert(Inspector::assertAllStrings($array)); |
17 * @endcode | 17 * @endcode |
18 * | 18 * |
19 * @ingroup php_assert | 19 * @ingroup php_assert |
20 */ | 20 */ |
21 class Inspector { | 21 class Inspector { |
185 * of the keys must be set for this method to return TRUE. | 185 * of the keys must be set for this method to return TRUE. |
186 * | 186 * |
187 * As an example, this assertion tests for the keys of a theme registry. | 187 * As an example, this assertion tests for the keys of a theme registry. |
188 * | 188 * |
189 * @code | 189 * @code |
190 * assert('Drupal\\Component\\Assertion\\Inspector::assertAllHaveKey( | 190 * assert(Inspector::assertAllHaveKey( |
191 * $arrayToTest, "type", "theme path", "function", "template", "variables", "render element", "preprocess functions")'); | 191 * $arrayToTest, "type", "theme path", "function", "template", "variables", "render element", "preprocess functions")); |
192 * @endcode | 192 * @endcode |
193 * | 193 * |
194 * Note: If a method requires certain keys to be present it will usually be | 194 * Note: If a method requires certain keys to be present it will usually be |
195 * specific about the data types for the values of those keys. Therefore it | 195 * specific about the data types for the values of those keys. Therefore it |
196 * will be best to write a specific test for it. Such tests are either bound | 196 * will be best to write a specific test for it. Such tests are either bound |
373 * this method in that manner when testing code from third party vendors. | 373 * this method in that manner when testing code from third party vendors. |
374 * | 374 * |
375 * Here are some examples: | 375 * Here are some examples: |
376 * @code | 376 * @code |
377 * // Just test all are objects, like a cache. | 377 * // Just test all are objects, like a cache. |
378 * assert('Drupal\\Component\\Assertion\\Inspector::assertAllObjects( | 378 * assert(Inspector::assertAllObjects($collection)); |
379 * $collection'); | |
380 * | 379 * |
381 * // Test if traversable objects (arrays won't pass this) | 380 * // Test if traversable objects (arrays won't pass this) |
382 * assert('Drupal\\Component\\Assertion\\Inspector::assertAllObjects( | 381 * assert(Inspector::assertAllObjects($collection, '\\Traversable')); |
383 * $collection', \'\\Traversable\'); | |
384 * | 382 * |
385 * // Test for the Foo class or Bar\None interface | 383 * // Test for the Foo class or Bar\None interface |
386 * assert('Drupal\\Component\\Assertion\\Inspector::assertAllObjects( | 384 * assert(Inspector::assertAllObjects($collection, '\\Foo', '\\Bar\\None')); |
387 * $collection', \'\\Foo\', \'\\Bar\\None\''); | |
388 * @endcode | 385 * @endcode |
389 * | 386 * |
390 * @param mixed $traversable | 387 * @param mixed $traversable |
391 * Variable to be examined. | 388 * Variable to be examined. |
392 * @param string ... | 389 * @param string ... |