DirectoryTest::testRequestToClassWithParameter()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 5
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace Jaxon\Tests\TestRequestFactory;
4
5
use Jaxon\Jaxon;
6
use Jaxon\Exception\SetupException;
7
use PHPUnit\Framework\TestCase;
8
9
class DirectoryTest extends TestCase
10
{
11
    /**
12
     * @throws SetupException
13
     */
14
    public function setUp(): void
15
    {
16
        jaxon()->setOption('core.prefix.class', '');
17
        jaxon()->register(Jaxon::CALLABLE_DIR, dirname(__DIR__) . '/src/dir');
18
    }
19
20
    /**
21
     * @throws SetupException
22
     */
23
    public function tearDown(): void
24
    {
25
        jaxon()->reset();
26
        parent::tearDown();
27
    }
28
29
    /**
30
     * @throws SetupException
31
     */
32
    public function testRequestToClass()
33
    {
34
        $this->assertEquals(
35
            'jaxon.exec({"_type":"expr","calls":[{"_type":"func","_name":"ClassA.methodAa","args":[]}]})',
36
            rq('ClassA')->methodAa()->__toString()
0 ignored issues
show
Bug introduced by
The method methodAa() does not exist on Jaxon\Script\Call\JxnCall. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

36
            rq('ClassA')->/** @scrutinizer ignore-call */ methodAa()->__toString()
Loading history...
37
        );
38
    }
39
40
    /**
41
     * @throws SetupException
42
     */
43
    public function testRequestToClassWithParameter()
44
    {
45
        $this->assertEquals(
46
            'jaxon.exec({"_type":"expr","calls":[{"_type":"func","_name":"ClassB.methodBb","args":["string",2,true]}]})',
47
            rq('ClassB')->methodBb('string', 2, true)->__toString()
0 ignored issues
show
Bug introduced by
The method methodBb() does not exist on Jaxon\Script\Call\JxnCall. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

47
            rq('ClassB')->/** @scrutinizer ignore-call */ methodBb('string', 2, true)->__toString()
Loading history...
48
        );
49
    }
50
}
51