1<?php
2/**
3 * Copyright 2014-2017 Horde LLC (http://www.horde.org/)
4 *
5 * See the enclosed file COPYING for license information (LGPL). If you
6 * did not receive this file, see http://www.horde.org/licenses/lgpl21.
7 *
8 * @category   Horde
9 * @copyright  2014-2016 Horde LLC
10 * @license    http://www.horde.org/licenses/lgpl21 LGPL 2.1
11 * @package    Imap_Client
12 * @subpackage UnitTests
13 */
14
15/**
16 * Tests for the Interaction Command object
17 *
18 * @author     Michael Slusarz <slusarz@horde.org>
19 * @category   Horde
20 * @copyright  2014-2016 Horde LLC
21 * @ignore
22 * @license    http://www.horde.org/licenses/lgpl21 LGPL 2.1
23 * @package    Imap_Client
24 * @subpackage UnitTests
25 */
26class Horde_Imap_Client_Interaction_CommandTest
27    extends PHPUnit_Framework_TestCase
28{
29    /**
30     * @dataProvider continuationCheckProvider
31     */
32    public function testContinuationCheck($command, $result)
33    {
34        $this->assertEquals(
35            $result,
36            $command->continuation
37        );
38    }
39
40    public function continuationCheckProvider()
41    {
42        $out = array();
43
44        $cmd = new Horde_Imap_Client_Interaction_Command('FOO', '1');
45        $cmd->add(array(
46            'FOO',
47            'BAR'
48        ));
49
50        $out[] = array($cmd, false);
51
52        $cmd = clone $cmd;
53        $cmd->add(
54            new Horde_Imap_Client_Interaction_Command_Continuation(function() {})
55        );
56
57        $out[] = array($cmd, true);
58
59        $cmd = new Horde_Imap_Client_Interaction_Command('FOO', '1');
60        $cmd->add(array(
61            'FOO',
62            array(
63                'BAR'
64            ),
65            new Horde_Imap_Client_Data_Format_List(array(
66                'BAR'
67            ))
68        ));
69
70        $out[] = array($cmd, false);
71
72        $cmd = new Horde_Imap_Client_Interaction_Command('FOO', '1');
73        $cmd->add(array(
74            'FOO',
75            array(
76                'BAR',
77                array(
78                    'BAZ',
79                    array(
80                        new Horde_Imap_Client_Data_Format_String_Nonascii('Envoyé')
81                    )
82                )
83            )
84        ));
85
86        $out[] = array($cmd, true);
87
88        return $out;
89    }
90
91}
92