Browse Source

Fix PHPCS errors.

Mark Story 10 years ago
parent
commit
128d9d72af
2 changed files with 28 additions and 25 deletions
  1. 3 1
      src/Network/Socket.php
  2. 25 24
      tests/TestCase/Network/SocketTest.php

+ 3 - 1
src/Network/Socket.php

@@ -177,8 +177,10 @@ class Socket
      * Configure the SSL context options.
      *
      * @param string $host The host name being connected to.
+     * @return void
      */
-    protected function _setSslContext($host) {
+    protected function _setSslContext($host)
+    {
         foreach ($this->_config as $key => $value) {
             if (substr($key, 0, 4) !== 'ssl_') {
                 continue;

+ 25 - 24
tests/TestCase/Network/SocketTest.php

@@ -419,29 +419,30 @@ class SocketTest extends TestCase
      *
      * @return void
      */
-    public function testConfigContext() {
-       $this->skipIf(!extension_loaded('openssl'), 'OpenSSL is not enabled cannot test SSL.');
-       $config = array(
-           'host' => 'smtp.gmail.com',
-           'port' => 465,
-           'timeout' => 5,
-           'ssl_verify_peer' => true,
-           'ssl_allow_self_signed' => false,
-           'ssl_verify_depth' => 5,
-           'ssl_verify_host' => true,
-       );
-       $socket = new Socket($config);
-
-       $socket->connect();
-       $result = $socket->context();
-
-       $this->assertTrue($result['ssl']['verify_peer']);
-       $this->assertFalse($result['ssl']['allow_self_signed']);
-       $this->assertEquals(5, $result['ssl']['verify_depth']);
-       $this->assertEquals('smtp.gmail.com', $result['ssl']['CN_match']);
-       $this->assertArrayNotHasKey('ssl_verify_peer', $socket->config());
-       $this->assertArrayNotHasKey('ssl_allow_self_signed', $socket->config());
-       $this->assertArrayNotHasKey('ssl_verify_host', $socket->config());
-       $this->assertArrayNotHasKey('ssl_verify_depth', $socket->config());
+    public function testConfigContext()
+    {
+        $this->skipIf(!extension_loaded('openssl'), 'OpenSSL is not enabled cannot test SSL.');
+        $config = [
+            'host' => 'smtp.gmail.com',
+            'port' => 465,
+            'timeout' => 5,
+            'ssl_verify_peer' => true,
+            'ssl_allow_self_signed' => false,
+            'ssl_verify_depth' => 5,
+            'ssl_verify_host' => true,
+        ];
+        $socket = new Socket($config);
+
+        $socket->connect();
+        $result = $socket->context();
+
+        $this->assertTrue($result['ssl']['verify_peer']);
+        $this->assertFalse($result['ssl']['allow_self_signed']);
+        $this->assertEquals(5, $result['ssl']['verify_depth']);
+        $this->assertEquals('smtp.gmail.com', $result['ssl']['CN_match']);
+        $this->assertArrayNotHasKey('ssl_verify_peer', $socket->config());
+        $this->assertArrayNotHasKey('ssl_allow_self_signed', $socket->config());
+        $this->assertArrayNotHasKey('ssl_verify_host', $socket->config());
+        $this->assertArrayNotHasKey('ssl_verify_depth', $socket->config());
     }
 }