1<?php
2
3require_once __DIR__.'/AbstractStreamBufferAcceptanceTest.php';
4
5class Swift_Transport_StreamBuffer_TlsSocketAcceptanceTest extends Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest
6{
7    protected function setUp()
8    {
9        $streams = stream_get_transports();
10        if (!in_array('tls', $streams)) {
11            $this->markTestSkipped(
12                'TLS is not configured for your system.  It is not possible to run this test'
13             );
14        }
15        if (!defined('SWIFT_TLS_HOST')) {
16            $this->markTestSkipped(
17                'Cannot run test without a TLS enabled SMTP host to connect to (define '.
18                'SWIFT_TLS_HOST in tests/acceptance.conf.php if you wish to run this test)'
19             );
20        }
21        parent::setUp();
22    }
23
24    protected function _initializeBuffer()
25    {
26        $parts = explode(':', SWIFT_TLS_HOST);
27        $host = $parts[0];
28        $port = isset($parts[1]) ? $parts[1] : 25;
29
30        $this->_buffer->initialize(array(
31            'type' => Swift_Transport_IoBuffer::TYPE_SOCKET,
32            'host' => $host,
33            'port' => $port,
34            'protocol' => 'tls',
35            'blocking' => 1,
36            'timeout' => 15,
37            ));
38    }
39}
40