@@ -15,6 +15,12 @@ the testbot's behavior.
15
15
You can find information on how to run ` run-tests.sh ` locally here:
16
16
https://www.drupal.org/node/645286
17
17
18
+ Examples is always targeted to the dev branch of Drupal core for the latest
19
+ release. As of this writing, the latest release of Drupal core is 8.2.5, which
20
+ means development for Examples should be against the Drupal 8.2.x development
21
+ branch. When Drupal 8.3.0 is released, we'll start targeting Examples to 8.3.x,
22
+ and so on.
23
+
18
24
You should at least run ` run-tests.sh ` locally against all the changes in your
19
25
patch before uploading it.
20
26
@@ -27,8 +33,68 @@ suggested workaround for this, since there is no best practice to demonstrate as
27
33
an example. There is, however, this issue in core:
28
34
https://www.drupal.org/node/2499239
29
35
36
+ How To Run The Tests In The Drupal UI
37
+ -------------------------------------
38
+
39
+ Generally, you should run tests from the command line. This is generally easier
40
+ than using Drupal's testing UI. However, here's how you can do it that way:
41
+
42
+ Enable the Testing module.
43
+
44
+ Visit the test list page at ` admin/config/development/testing ` .
45
+
46
+ Since the tests are organized by module, you can search for a module name and
47
+ get all the tests for that module. For instance, type in 'node_type_example' for
48
+ all the tests related to that module.
49
+
50
+ Click the check boxes next to the tests you want to run. If you find this
51
+ tedious, it's time to learn to use the command line. :-)
52
+
53
+ Click 'Run Tests.' You're now running the tests.
54
+
55
+ Step-by-step: How To Run The Tests.
56
+ -----------------------------------
57
+
58
+ Begin with an installed Drupal codebase. Make a codebase, set up the database,
59
+ etc. Note that you can use an existing Drupal instance but the best practice is
60
+ to start fresh. Something not working right? Try a new installation.
61
+
62
+ Use the dev branch of core for the latest release of Drupal. As of this writing,
63
+ it's 8.2.x. When Drupal 8.3.0 is released, we'll target 8.3.x.
64
+
65
+ Open the terminal window and move to the root directory of the Drupal
66
+ installation:
67
+
68
+ $ cd path/to/drupal
69
+
70
+ Put Examples into the ` modules/ ` folder of the Drupal installation. If you are
71
+ doing development on Examples, you should have already checked out the git
72
+ repository into ` modules/ ` , like this:
73
+
74
+ $ git clone --branch 8.x-1.x https://git.drupal.org/project/examples.git modules/examples
75
+
76
+ Now you can run ` run-tests.sh ` , which, despite having a ` .sh ` suffix is not a
77
+ shell script. It's a PHP script.
78
+
79
+ You'll use the ` --directory ` option to have the test runner scan the Examples
80
+ module directory for tests.
81
+
82
+ Also, importantly, if your test site has its own URL, you'll need to supply that
83
+ with the ` --url ` option. For instance, under MAMP, you must specify
84
+ ` --url http://localhost:8888/ ` .
85
+
86
+ You can also use ` --concurrency ` to speed up the test run, and ` --browser ` to
87
+ see detailed test results in a web browser instead of just text output in the
88
+ terminal.
89
+
90
+ $ php ./core/scripts/run-tests.sh --browser --concurrency 10 --url http://localhost:8888/ --directory modules/examples
91
+
92
+ This should run all the tests present in Examples. If you add a test and it
93
+ doesn't appear in the list of tests to run, then you'll need to double-check
94
+ that it's in the proper test namespace and that the class name (and thus the
95
+ file name) ends in Test.
30
96
31
- What Tests Should An Example Project Have?
97
+ What Tests Should An Example Module Have?
32
98
------------------------------------------
33
99
34
100
Examples has a checklist for each module:
0 commit comments