[0:00] hello everyone welcome to D for Drupal [0:03] Channel today we are going to understand [0:04] how the PHP unit test reports are [0:07] generated and how the PHP unit test is [0:10] running all those we are going to uh see [0:12] now and that's why I'm going to explain [0:14] how the test report they have written in [0:16] the code so I will be explaining all so [0:19] in previous video you have seen how to [0:21] set up and run the test report [0:24] and in that video I have explained how [0:27] the test reporter is working with the [0:28] contrary model called quick node clone [0:31] so I'm going to use the same module now [0:33] so that you can understand it better [0:36] so uh [0:38] before that you have to understand how [0:40] the module works so this module [0:42] basically provides a cloning option of a [0:45] node so by using this module you can [0:47] clone your complete node so you no need [0:50] to provide value again for new node if [0:53] you are going to duplicate the same node [0:55] and if you are going to alter something [0:57] very few so in that case you can go with [0:59] this module [1:01] so here you can see I have created some [1:04] notes here so when you click on the [1:06] operation you will be able to see a [1:08] option called clone [1:10] so then you click on it [1:14] so it will take you to the Clone page [1:16] where you can see the complete node is [1:19] cloned so let me explain it [1:24] so this is the node so let me give some [1:26] body value [1:27] so that I can explain it well [1:38] so now I created a node [1:45] and I have a body value as body value [1:47] and when I click on clone [1:51] so you can see here the title is [1:54] prepared with the text of clone of and [1:57] the body value is empty so all these are [1:59] happening because of the configuration [2:00] what we are having from the crypto clone [2:02] module so this is the configuration what [2:05] we have so I am going to explain only [2:07] the node part not the paragraph part so [2:10] here uh text to prepare to the title so [2:14] that is clone of you can see the text is [2:16] prepended and then next uh what they are [2:19] doing they are excluding some fields [2:21] from cloning so in the basic con basic [2:25] page content that they are excluding the [2:27] body field value so the body filled [2:30] value is not cloned here and you can [2:32] save the [2:35] node [2:39] now the node is saved you can see now [2:41] the complete node is saved and you don't [2:44] have body field in the new as as we [2:47] configured here so uh this is what we [2:49] are going to understand now [2:51] in test report so this is the file which [2:54] I ran in the previous video [2:57] so first how uh here they have written [2:59] test in the functional so uh there are [3:02] four types of testing I will create a [3:05] separate video on proper example in [3:07] future so now in this functional testing [3:12] so here uh what they are doing they are [3:14] using the standard profile and this test [3:17] is depend on a module called quick node [3:19] clone so all those should be enabled so [3:21] that this will work properly and they [3:24] are creating one admin user so whenever [3:27] you are creating any test that will be [3:29] under the module test SRC functional [3:32] folder [3:34] and then here the first function called [3:38] setup will get called for the first time [3:40] so in this function you can have all the [3:44] required statements so which means so [3:48] here I am going to use the testing with [3:51] the admin user so I am creating a user [3:54] with all this [3:55] access conditions so the user will be [3:59] created with this permission once the [4:02] user is created next you can see here [4:04] they are editing the configuration so [4:06] config Supply will be helping us to edit [4:10] the configuration whatever we are having [4:12] in the Drupal so this is the [4:14] configuration quick clone settings this [4:16] is a configuration for the [4:23] so you can go to your development [4:26] configuration export [4:35] so simple quick note one so you can see [4:38] quick note rule settings this is the yml [4:41] file which hold the complete [4:43] configuration whatever you are saving [4:45] here so we are editing that oml file and [4:49] we are keeping excluding node page so [4:53] which means we are excluding the basic [4:55] page [4:56] content type body fill so the same [4:59] configuration whatever I'm having here [5:00] so for the node for the basic page they [5:04] are excluding the body field and they [5:06] are just saving the configuration so [5:09] here all these values are [5:12] as like in the yml effect so when you [5:15] see the yml file so exclude [5:18] node [5:21] and then page so exclude dot note Dot [5:24] Page and the value is body [5:26] okay so they are just saving the [5:28] configuration once that is done so the [5:31] next function what we'll get call is [5:32] that whatever function you are starting [5:35] with the test [5:37] the word so the function will be started [5:39] executing so in the next function what [5:42] they are doing they are just logging in [5:44] by using the function called Drupal [5:45] login and they are logging in with the [5:48] user admin user which we created on the [5:50] setup function okay this user will be [5:53] logged in [5:54] once the user is logged in they are just [5:57] giving the value for all the [5:59] configurations form so here [6:02] text to print title so when I default [6:05] the value was [6:07] flown off they are just changing the two [6:09] cloned from and then uh in the bundle [6:12] they are enabling basic page so Pages [6:15] page they are enabling which means here [6:19] so in the bundle they are enabling the [6:21] basic page and then in the page they are [6:24] enabling only for this particular body [6:26] field [6:27] so in the field list they are enabling [6:30] only the body field so once this is [6:32] created they are once they just uh [6:36] assign the value in Array they are just [6:39] going to the path of this bracket so [6:42] admin configure flow and they are using [6:46] all this value edit value and they are [6:49] just submitting the form [6:50] so once this is done the configuration [6:52] form will be submitted here [6:55] and then next here we excluding the [6:58] basic page right so now we have to [7:00] create a node so that we can test [7:02] whether the field excluding [7:04] functionality is working or not [7:07] so they are generating randomly uh 10 [7:10] words for uh title and sentence 10 [7:14] length [7:15] for body value and then they are just [7:18] recreating one new array so as like here [7:21] for the body field [7:23] and then title field and they are just [7:26] getting the node at page of node add [7:28] page and they are passing the tradit [7:30] value and they are just saving so which [7:33] means here they completely saved the [7:36] node the new node which they created so [7:39] once they say [7:40] in the asset session in the response [7:43] when you see the node slash node ID page [7:46] it can be node slash one or two or three [7:48] whatever [7:49] the response should contain title value [7:52] and the body value [7:54] which you passed and which you've saved [7:56] by sure that will be there [7:58] once that is done [8:00] they are just clicking on the Clone tab [8:03] what we have in the node view page [8:06] so they are just loading the node so [8:08] whatever by using this node title [8:11] by using the value of the node title [8:14] they are loading the same node and they [8:16] are just going to flown slash node ID [8:20] slash quick clone [8:23] so this is the page [8:26] and you click on clone [8:33] clone slash node ID slash Quick Loan so [8:37] clone slash node ID slash quick clone [8:39] and they are just submitting the form [8:41] without passing any value so the value [8:44] is getting submitted without passing any [8:47] new value so by default when you clone [8:50] it what will happen the title value will [8:53] be pre-populated with the text of flown [8:55] from and then body value will not be [8:58] there because we excluded that body body [9:01] field value here [9:03] right so that's what they are doing here [9:06] here [9:07] when they click on clone slash no ready [9:09] slash node they are just saying they are [9:11] not altering anything so when you see [9:14] the response of the node which we create [9:17] a newly the response should contain [9:19] cloned from [9:21] because we saved the configuration [9:25] text has cloned from so that will be [9:28] cloned from the title value of the or [9:32] default node and then the response the [9:35] body value should not be there in the [9:37] node slash no ready page of the Clone [9:39] download because we excluded that body [9:42] field in the configuration [9:45] okay so this is how this should work [9:48] that so they have written all the uh [9:51] test report here and we have run it so [9:55] uh here we have all the test report as a [9:57] HTML file okay so now when you go here [10:01] so I already opened all the HTML file [10:05] line by line here so that I can explain [10:07] you explain you to you efficiently so [10:10] when you see here here first they are [10:12] clicking on login page because they are [10:15] doing admin login first right [10:18] scroll up [10:20] and here you can see admin user is [10:22] logged in first so they are going to [10:24] login page you can see the file is [10:27] coming from site simple test browse row [10:29] so the login page is getting hit and [10:33] they are just posting the value for the [10:35] login page once that is done so they are [10:38] getting the request once that is done [10:41] the user slash one is logged in [10:43] successfully now the login process is [10:46] Success so which means this single line [10:48] is completed next what they are doing [10:51] they are going here and giving these [10:53] values and they are just sharing it that [10:56] will be the next [10:58] so when you scroll up they are hitting [11:00] get request they are hitting admin slash [11:03] config slash quick note clone [11:06] so here you can see this is these are [11:08] default value clone from all those so [11:11] they will be giving all this value here [11:13] and they will be posting the form again [11:16] so here again the form is posted once it [11:19] is posted when you scroll down [11:22] now it is guess get again so when you [11:24] have scroll down you can see the text is [11:27] cloned from the value what we have given [11:29] and then basically it's selected and the [11:32] body field is selected [11:34] and then click now clone setting has [11:37] been saved successfully [11:38] so once until this done now we are going [11:41] to create a Content node that's what [11:44] here right so this is the node add page [11:48] get request [11:50] so this is the fields [11:52] in the next they will be posting it the [11:55] value [11:56] will be posted is the random text to [11:58] whatever generated here okay so that [12:01] will be posted now it will be node slash [12:03] node one or something [12:05] it will be node one you have node one so [12:07] now the node is created we are in node [12:09] one page [12:10] here you can see the randomness [12:13] generated text title and the body fields [12:16] are there [12:17] so this response also contain title and [12:20] the body [12:21] and the next one they are going to click [12:24] on clone slash node ID slash Quick Loan [12:28] so [12:29] next they are going to click on clone [12:32] slash node ID slash quick clone so in [12:35] this page [12:36] here you can see the prep and text is [12:40] added as per our configuration and also [12:42] the body value is empty because we [12:45] disabled it from cloning [12:48] and this is done now and next now the [12:52] value is posted because we are not going [12:53] to alter anything so they are just [12:55] saving it so here they are just saving [12:59] it [13:00] and and the final one [13:02] so now the node 2 is created in the node [13:05] to [13:07] type in title we will have cloned from [13:11] so clone to from with the title value [13:13] responsible content is it is has and [13:17] then response not containing body values [13:19] so here you can see the body value is [13:21] not there only the title we have as per [13:24] our [13:25] test what we have written and this is [13:28] how the PHP unit test will work with the [13:32] explanation and the example whatever we [13:35] are having here and if you have any [13:37] queries please post it in the chat [13:39] and that's it about today's video if you [13:41] like the video please share like And [13:43] subscribe to my channel thank you bye