-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathConfigurationTest.php
64 lines (58 loc) · 2.12 KB
/
ConfigurationTest.php
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
<?php
use Ballen\Linguist\Configuration;
use PHPUnit\Framework\TestCase;
/**
* Linguist
*
* Linguist is a PHP library for parsing strings, it can extract and manipulate
* prefixed words in content ideal for working with @mentions, #topics and
* even custom action tags!
*
* @author Bobby Allen <[email protected]>
* @license http://www.gnu.org/licenses/gpl-3.0.html
* @link https://github.com/allebb/linguist
* @link http://www.bobbyallen.me
*
*/
class ConfigurationTest extends TestCase
{
/**
* Tests creating a new instance of the configuration class and pushing the
* default 'Twitter' compatible configuration.
*/
public function testLoadDefaultConfiguaration()
{
$instance = new Configuration();
$instance->loadDefault();
$this->assertArrayHasKey('mentions', $instance->get()); // Check that default 'mentions' are added...
$this->assertArrayHasKey('topics', $instance->get()); // Check that default 'topics' are added...
}
/**
* Tests creating a new instance and adding a new 'assignment' configuration
* and then test removing the configuration item.
*/
public function testCustomTagConfiguaration()
{
$instance = new Configuration();
$instance->push('assignment', 'assign>', 'https://exampleapp.com/assign/%s');
$this->assertArrayHasKey(
'assignment',
$instance->get()
); // Check that custom assignment section has been added...
$instance->drop('assignment');
$this->assertArrayNotHasKey(
'assignment',
$instance->get()
); // Check that the custom config has been removed successfully.
}
/**
* Tests creating a new empty configuration and ensures that the optional
* default values are not set.
*/
public function testNoConfiguaration()
{
$instance = new Configuration();
$this->assertArrayNotHasKey('mentions', $instance->get()); // Check that default 'mentions' are added...
$this->assertArrayNotHasKey('topics', $instance->get()); // Check that default 'topics' are added...
}
}