summaryrefslogtreecommitdiffstats
path: root/tests/Recipient/GroupTest.php
blob: 3dc5a93c3069e5aef69eb8bb79e837a3d64b6ca9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
/**
* PHP version 7.1.1
* @author Hannes Kindströmmer <hannes@kindstrommer.se>
* @copyright 2017 iP.1 Networks AB
* @license https://www.gnu.org/licenses/lgpl-3.0.txt LGPL-3.0
* @version 0.2.0-beta
* @since File available since Release 0.2.0-beta
* @link http://api.ip1sms.com/Help
* @link https://github.com/iP1SMS/ip1-php-sdk
*/
namespace IP1\RESTClient\Test\Recipient;

use PHPUnit\Framework\TestCase;
use IP1\RESTClient\Recipient\Group;

class GroupTest extends TestCase
{
  /**
  * @dataProvider getValidGroupInputs
  */
    public function testValidInputs($name, $color)
    {
        $group = new Group($name, $color);
        $this->addToAssertionCount(1);
    }
  /**
  * @dataProvider getInValidGroupInputs
  */
    public function testInvalidInputs($name, $color)
    {
        $this->expectException(\InvalidArgumentException::class);
        $group = new Group($name, $color);
    }
    /**
    * @dataProvider getValidGroupInputs
    */
    public function testGettersAndSetters($name, $color)
    {
        $group = new Group("Jack", "#ffddff");
        $group->setName($name);
        $group->setColor($color);

        $this->assertEquals($name, $group->getName());

        $this->assertEquals($color, $group->getColor());
    }
    /**
    * @dataProvider getValidGroupInputs
    */
    public function testMethodChaining($name, $color)
    {
        $group = new Group("Jack", "#ffddff");
        $group->setName($name)
              ->setColor($color)
              ->setName($name);

        $this->assertEquals($name, $group->getName());

        $this->assertEquals($color, $group->getColor());
    }
    public function getValidGroupInputs(): array
    {
        return [
            ['Jack', '#930ba8'],
            ['Sparrow', '#b0bf65'],
            ['Elizabeth', '#d42049'],
            ['Swann', '#a584b9'],
            ['Davy', '#29d75b'],
            ['Jones','#a7a385'],
        ];
    }

    public function getInValidGroupInputs(): array
    {
        return [
            ['', '#930ba8'],
            ['Sparrow', 'b0bf65'],
            ['Elizabeth', '#d4209'],
            ['Swann', '#'],
            ['Davy', '#2'],
            ['Jones','#a7'],
        ];
    }
}