Passed
Pull Request — master (#17)
by Alexander
03:51
created

OptionsRequestBehaviorTest::testNotExit()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 7
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
namespace Horat1us\Yii\Tests\Behaviors;
4
5
use Horat1us\Yii\Behaviors\OptionsRequestBehavior;
6
use Horat1us\Yii\Tests\AbstractTestCase;
7
use yii\web;
8
9
/**
10
 * Class OptionsRequestBehaviorTest
11
 * @package Horat1us\Yii\Tests\Behaviors
12
 */
13
class OptionsRequestBehaviorTest extends AbstractTestCase
14
{
15
    /**
16
     * @expectedException \yii\base\ExitException
17
     */
18
    public function testExit(): void
19
    {
20
        $_SERVER['REQUEST_METHOD'] = 'OPTIONS';
21
        $behavior = new OptionsRequestBehavior([
22
            'response' => new class extends web\Response
23
            {
24
                public function send(): void
25
                {
26
                }
27
            }
28
        ]);
29
        $behavior->check();
30
    }
31
32
    public function testNotExit(): void
33
    {
34
        $_SERVER['REQUEST_METHOD'] = 'GET';
35
        $behavior = new OptionsRequestBehavior();
36
        $behavior->check();
37
        $this->assertTrue(true);
38
    }
39
}
40