Add test for Self-signed certificates

This commit is contained in:
Ian den Hartog 2015-10-02 16:17:26 +02:00
parent 5c722c6665
commit bb7e7850ae
2 changed files with 13 additions and 0 deletions

View file

@ -410,6 +410,7 @@ class CakeSocket {
* Accept Self-signed certificate on current stream socket * Accept Self-signed certificate on current stream socket
* *
* @return bool True on success * @return bool True on success
* @link http://php.net/manual/en/context.ssl.php About the 'allow_self_signed' option.
* @see stream_context_set_option * @see stream_context_set_option
*/ */
public function enableSelfSigned() { public function enableSelfSigned() {

View file

@ -349,6 +349,18 @@ class CakeSocketTest extends CakeTestCase {
$this->assertTrue($this->Socket->encrypted); $this->assertTrue($this->Socket->encrypted);
} }
/**
* testEnableCryptoSelfSigned
*
* @return void
*/
public function testEnableCryptoSelfSigned() {
$this->_connectSocketToSslTls();
$this->assertTrue($this->Socket->enableSelfSigned());
$this->assertTrue($this->Socket->enableCrypto('tls', 'client'));
$this->Socket->disconnect();
}
/** /**
* test getting the context for a socket. * test getting the context for a socket.
* *