How do I mock a service when using BroswerTestBase? I am trying to use BrowserTestBase to write a functional test for a Form. The form populates some form elements with data retrieved from an external site. The client for this external site is injected into the form as a Drupal 8 service. The client uses Guzzle, and I'm building the mock client using code similar to the following one.  $myClient = new MyClient(Drupal::configFactory(), [   'handler' =&gt; HandlerStack::create(     new MockHandler([       new Response(200, ['X-Foo' =&gt; 'Bar'], 'Hello, World')     ])   ),   'base_uri' =&gt; 'http://example.com/api/', ]);   I've tried doing this in the test class to assign my mock client to the service.  $this-&gt;container-&gt;set('my.service', $mockClient);   I've tried placing this assignment in setUp() as well as the testMyForm() method itself, but the container passed to the form's create() method doesn't contain $mockClient.  Update:  After digging into the code I discovered that parameters and services may be initialized in the test-site context by adding them inside testing.services.yml and placing that in the default site folder. In my test I used:  services:   browser_test.handler_stack:     class: GuzzleHttp\HandlerStack     factory: GuzzleHttp\HandlerStack::create     arguments:       - '@browser_test.mock_handler'   browser_test.mock_handler:     class: GuzzleHttp\Handler\MockHandler   my.service:     class: Drupal\mymodule\Client\MyClient     arguments:       - '@config.factory'       -         base_uri: 'http://localhost/test/'         handler: '@browser_test.handler_stack'   This overrode the client (which solves part of the problem), however I'm still unable to inject mock responses into MockHandler from the test class. I tried:  /** @var MockHandler $handlerStack */ $handler = $this-&gt;container-&gt;get('browser_test.mock_handler'); $handler-&gt;append(new Response(200, ['X-Foo' =&gt; 'Bar'], 'Hello, World'));  $this-&gt;drupalLogin($this-&gt;adminUser); $this-&gt;drupalGet('path/to/my_form'); $this-&gt;assertSession()-&gt;statusCodeEquals(200);   But MockHandler is throwing an exception because Mock queue is empty.
Mock a service while running a BrowserTest? I am trying to test the output of a controller that returns some information in a given page. This controller has a custom http client injected into it.  I want to create a BrowserTest that can navigate to a fake node, and then test for certain text or values. I also want to change the mock to return different values, so I can further test the output to account for those cases.  I tried:      $client = $this-&gt;getMockBuilder('\Drupal\mymodule\Client\AuthorizeClient')       -&gt;disableOriginalConstructor()       -&gt;getMock();     $client-&gt;expects($this-&gt;any())       -&gt;method('request')       -&gt;with('w12345', FALSE)       -&gt;willReturn([]);      $this-&gt;container-&gt;set('mymodule.auth_client', $client);   But I get errors in the test that refer to the original class, and not the one I am trying to replace. I looked around in the core but wasn't really able to find what I was looking for. Does it make sense to do this? Is there a way to do a Kernel test to test responses from the route in question?
Is it a problem if a UK visa was issued but not used? Last year, my wife and I were issused 6-month visieor visas for the UK. She did not travel with me and, therefore, didn't use her visa. I am currently applying for a visitor visa for my daughter and myself.  Will the fact that my didn't use her visa have any negative affect on our new application? How to add programs to the Unity Launcher or Ubuntu Dock? How can I add new programs to the launcher (or the dock in Ubuntu 17.10 and later) in Ubuntu? I am new to the telecom simulations system specially multisim, which I am having a project that I want to simulate.  My project in (Analog Communications) is consisting to have FM Transmitter (Modulator) that accepts a generated signal (Sin, Cos) and get me the modulated output as a Graph.  I've found this FM transmitter circuit (3 km range):   ![two muppets][1]  and I am building that circuit on Multisim, and I failed. Because I faced many problems, first of, the variable capacitor symbol is weird here in the multisim, and the regular capacitor doesn't have variable options. Secondly, when I Use signal generator as (Sin, Cos), the output gets weird after 5 second of the simulation.  I want to show the input signal (before modulation) and the output signal (transmitted or modulated).  I guess my output result where not the as expected, as the signal (Sin with phase 90&deg;) is giving weird result of few seconds of simulating.  Below are screenshots of the simulation results within time.          Any ideas how to edit or fix the above circuit to have this output is similar to what it should be? GroupBy a list of associations with their keys How to update Ubuntu terminal? How to update Ubuntu terminal? Before proposing reviewers, should I notify them? Some journals require the author to propose potential reviewers. Should I just propose reviewers and let the editor contact them? Or should I first contact the potential reviewers myself and ask if they agree? Determining members of local groups via C# I wondered whether anybody knows how to obtain membership of local groups on a remote server programmatically via C#. Would this require administrator permissions? And if so is there any way to confirm the currently logged in user's membership (or not) of these groups? Proof of uniform limit of Continuous Functions The uniform limit of Continuous Functions is continuous.   Proof Let $\varepsilon &gt; 0$. There exists $N$ in natural numbers such that $n&gt;N$ implies  $|f_n(x)-f(x)| &lt; \frac{\varepsilon}{3}$ for all $x$ in $S$. In particular $|f_{N+1}(x)-f(x)| &lt; \frac{\varepsilon}{3}$ for all $x$ in $S$. Since $f_{N+1}$ is continuous at $x_0$ there is a $\delta&gt;0$ such that, $x$ in $S$ and $|x-x_0| &lt; \delta$ imply $|f_{N+1}(x)-f_{N+1}(x_0)|&lt; \frac{\varepsilon}{3}$ Now we conclude $x$ in $S$ and $|x-x_0| &lt; \delta$ imply $|f(x)-f(x_0)|&lt; 3 \cdot \frac{\varepsilon}{3} = \varepsilon$.  Can someone explain what is happening here? I don't follow it all. Importing coordinate data from Excel into QGIS I have an Excel file containing data collected over many years as latitude and longitude coordinates for archaeological sites. How can I import it into QGIS as a new layer? Does the Great Old One warlock's telepathy from the Awakened Mind feature take an action? Does the Great Old One warlock's telepathy from the Awakened Mind feature take an action?  It doesn't seem too clear to our group and we have basically ruled it as equivalent to talking. How to show that $L^p$ spaces are nested? Suppose $1&lt;p_1&lt;p_2&lt;\infty$, then show $L^{p_1}[a,b] \supset L^{p_2}[a,b]$.  I was able to show $\|f\|_{p_1} \le \|f\|_{p_2} (b-a)^{1/p_1 - 1/p_2}$ but I'm not sure how to proceed from here. Why didn't Thor lose his power? In Thor: Ragnarok, Valkyrie told Thor this about Hela:  Her power comes from Asgard the same as yours  Thor's plan was to unleash Surtur who destroys Asgard, which weakens Hela allowing Surtur to kill her. But why didn't that weakened Thor as well? We saw him later in Avengers: Infinity War very powerful. Java string to date conversion How to choose which FaceTime number to call I have a friend with two iPhones, two different numbers.  When I call her with FaceTime audio, only phone A rings.  How can I call phone B?  The phones have two separate Apple ID addresses, but they are both set to receive Facetime calls on their 10 digit phone numbers.  I have both numbers listed in my contacts as 'Home' and 'Work' for the same person. Where did dedicated.abac.net. come from in my rDNS and PTR records? So I followed this guide to the letter:   I did so for 3 domains.  When I "test" the records and enter: host 64.150.176.81 on my linux machine, it shows me 81.172.150.64.in-addr.arpa domain name pointer 64-150-172-81.dedicated.abac.net.  when it should be showing me 81.176.150.64.in-addr.arpa domain name pointer 64-150-172-81.example.com.  Has anybody encountered a similar problem?  I am hosting with codero, not abac.net btw. I let my younger cousins play on my S4 from time to time, but now I have found that all the words they have used are the first to come up when I use my phone to text. It has gotten quite irritating. Samsung seems to have very hard to find settings compared to my old Sony Ericsson so I cannot find where to get rid of the word history typed onto my phone's keyboard. What is the need for Autobiographer badge? What is the reason that Autobiographer badge is kept in Stack Exchange?  This does not show any participation and people can just fill garbage to achieve this badge.   Is there a reason behind it? Parameterize an SQL IN clause How do I parameterize a query containing an IN clause with a variable number of arguments, like this one?  SELECT * FROM Tags  WHERE Name IN ('ruby','rails','scruffy','rubyonrails') ORDER BY Count DESC   In this query, the number of arguments could be anywhere from 1 to 5.  I would prefer not to use a dedicated stored procedure for this (or XML), but if there is some elegant way specific to , I am open to that. I have read that positional parameters start at $1 (for example: $1, $2, $3 and so on are positional parameters). But $0 is not a positional parameter.  But why $0 is not a positional parameter?  I think this could be a reason, but not sure:  Positional parameters only take their values when a script is executed. For example: if we do ./myScript Hello, then $1 will have the value Hello. But $0 can take its value on two occasions: when a script is executed (it would have the value of the script name), and when bash itself is executed without a script (it would have the value bash or -bash). How can I cancel an edit I made on another user's question or answer? Edits made by users who do not have edit privileges are placed in a queue until it is peer reviewed.  E.g., I edited someone else's answer. but changed my mind. If I'd edited my own question/answer, there would be a "Rollback" button, but there's no such button in the scenario I'm describing (at least none that I can see).  This is more relevant today because users can only have at most five edits waiting in the queue, and allowing one to cancel an edit would permit them to free up one of their five pending edits for something else.  Is there a way to remove one's edit from the peer review queue?