/** * @test * it should exec bootstrap with proper parameters when requesting nonces */ public function it_should_exec_bootstrap_with_proper_parameters_when_requesting_nonces() { $sut = $this->make_instance(); $sut->setBootstrapScriptFilePath('foo'); $credentials = ['username' => 'foo', 'password' => 'bar', 'authCookie' => new Cookie('auth', 'foo'), 'loginCookie' => new Cookie('login', 'bar')]; $request = ['action' => 'some_action', 'credentials' => ['user_login' => $credentials['username'], 'user_password' => $credentials['password'], 'remember' => true], 'cookies' => ['auth' => 'foo', 'login' => 'bar']]; $this->system->system(PHP_BINARY . ' ' . escapeshellarg('foo') . ' ' . escapeshellarg($this->wpLoadPath) . ' ' . escapeshellarg(serialize($request)))->willReturn(serialize(['some' => 'output'])); $sut->createNonce('some_action', $credentials); }
/** * @param array $actions * * @return array */ public function bootstrapWpAndExec(array $actions) { $command = PHP_BINARY . ' ' . escapeshellarg($this->bootstrapScriptFilePath) . ' ' . escapeshellarg($this->wpLoadPath) . ' ' . escapeshellarg(serialize($actions)); $output = $this->system->system($command); return $output; }