StateTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 17
wmc 1
lcom 0
cbo 4
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A testCallGetNextStateWithAnInvalidTokenWillThrowAnException() 0 14 1
1
<?php
2
/**
3
 * This file is part of graze/csv-token
4
 *
5
 * Copyright (c) 2016 Nature Delivered Ltd. <https://www.graze.com>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @license https://github.com/graze/csv-token/blob/master/LICENSE.md
11
 * @link    https://github.com/graze/csv-token
12
 */
13
14
namespace Graze\CsvToken\Test\Unit\Tokeniser;
15
16
use Graze\CsvToken\Test\TestCase;
17
use Graze\CsvToken\Tokeniser\State;
18
use Graze\CsvToken\Tokeniser\Token\Token;
19
use Graze\CsvToken\Tokeniser\Token\TokenStoreInterface;
20
use Mockery as m;
21
use RuntimeException;
22
23
class StateTest extends TestCase
24
{
25
    public function testCallGetNextStateWithAnInvalidTokenWillThrowAnException()
26
    {
27
        $tokenStore = m::mock(TokenStoreInterface::class);
28
        $tokenStore->shouldReceive('getTokens')
29
                   ->andReturn([]);
30
        $state = new State($tokenStore);
31
32
        $state->addStateTarget(Token::T_CONTENT, $state);
33
34
        static::assertSame($state, $state->getNextState(Token::T_CONTENT));
35
36
        static::expectException(RuntimeException::class);
37
        $state->getNextState(Token::T_ESCAPE);
38
    }
39
}
40