Skip to content

Commit

Permalink
Add test for Self-signed certificates
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian den Hartog committed Oct 2, 2015
1 parent 5c722c6 commit bb7e785
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/Cake/Network/CakeSocket.php
Expand Up @@ -410,6 +410,7 @@ public function enableCrypto($type, $clientOrServer = 'client', $enable = true)
* Accept Self-signed certificate on current stream socket
*
* @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
*/
public function enableSelfSigned() {
Expand Down
12 changes: 12 additions & 0 deletions lib/Cake/Test/Case/Network/CakeSocketTest.php
Expand Up @@ -349,6 +349,18 @@ public function testEnableCryptoEnableStatus() {
$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.
*
Expand Down

0 comments on commit bb7e785

Please sign in to comment.