Completed
Push — master ( e098c0...4103fb )
by Pavel
09:14
created

tests/AlMpTest.php (16 issues)

Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * @link https://github.com/paulzi/yii2-auto-tree
4
 * @copyright Copyright (c) 2015 PaulZi <[email protected]>
5
 * @license MIT (https://github.com/paulzi/yii2-auto-tree/blob/master/LICENSE)
6
 */
7
8
namespace paulzi\autotree\tests;
9
10
use paulzi\autotree\tests\models\NodeAlMp;
11
use Yii;
12
13
/**
14
 * @author PaulZi <[email protected]>
15
 * @group AlMp
16
 */
17
class AlMpTest extends AutoTreeTraitTestCase
18
{
19
    public function getModelClass()
20
    {
21
        return NodeAlMp::className();
22
    }
23
24
    public function testMakeRootInsert()
25
    {
26
        $node = new NodeAlMp(['slug' => 'r']);
27
        $this->assertTrue($node->makeRoot()->save());
28
29
        $node->refresh();
30
        $this->assertEquals(null, $node->parent_id);
31
        $this->assertEquals(0,    $node->sort);
32
        $this->assertEquals(0,    $node->depth);
33
    }
34
35
    public function testMakeRootUpdate()
36
    {
37
        $node = NodeAlMp::findOne(9);
0 ignored issues
show
The call to NodeAlMp::findOne() has too many arguments starting with 9.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
38
        $this->assertTrue($node->makeRoot()->save());
39
40
        $node->refresh();
41
        $this->assertEquals(null, $node->parent_id);
42
        $this->assertEquals(0,    $node->sort);
43
        $this->assertEquals(0,    $node->depth);
44
    }
45
46
    public function testPrependTo()
47
    {
48
        $node = new NodeAlMp(['slug' => 'new']);
49
        $this->assertTrue($node->prependTo(NodeAlMp::findOne(1))->save());
0 ignored issues
show
The call to NodeAlMp::findOne() has too many arguments starting with 1.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
50
51
        $node->refresh();
52
        $this->assertEquals(1,    $node->parent_id);
53
        $this->assertEquals(-101, $node->sort);
54
        $this->assertEquals(1,    $node->depth);
55
    }
56
57
    public function testPrependToAnotherTree()
58
    {
59
        $node = NodeAlMp::findOne(30);
0 ignored issues
show
The call to NodeAlMp::findOne() has too many arguments starting with 30.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
60
        $this->assertTrue($node->prependTo(NodeAlMp::findOne(4))->save());
0 ignored issues
show
The call to NodeAlMp::findOne() has too many arguments starting with 4.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
61
62
        $node->refresh();
63
        $this->assertEquals(4,    $node->parent_id);
64
        $this->assertEquals(-100, $node->sort);
65
        $this->assertEquals(2,    $node->depth);
66
    }
67
68
    public function testAppendTo()
69
    {
70
        $node = NodeAlMp::findOne(10);
0 ignored issues
show
The call to NodeAlMp::findOne() has too many arguments starting with 10.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
71
        $this->assertTrue($node->appendTo(NodeAlMp::findOne(18))->save());
0 ignored issues
show
The call to NodeAlMp::findOne() has too many arguments starting with 18.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
72
73
        $node->refresh();
74
        $this->assertEquals(18, $node->parent_id);
75
        $this->assertEquals(0, $node->sort);
76
        $this->assertEquals(4, $node->depth);
77
    }
78
79
    public function testInsertBefore()
80
    {
81
        $node = new NodeAlMp(['slug' => 'new']);
82
        $this->assertTrue($node->insertBefore(NodeAlMp::findOne(22))->save());
0 ignored issues
show
The call to NodeAlMp::findOne() has too many arguments starting with 22.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
83
84
        $node->refresh();
85
        $this->assertEquals(9, $node->parent_id);
86
        $this->assertEquals(3, $node->sort);
87
        $this->assertEquals(3, $node->depth);
88
    }
89
90
    public function testInsertAfter()
91
    {
92
        $node = NodeAlMp::findOne(32);
0 ignored issues
show
The call to NodeAlMp::findOne() has too many arguments starting with 32.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
93
        $this->assertTrue($node->insertAfter(NodeAlMp::findOne(30))->save());
0 ignored issues
show
The call to NodeAlMp::findOne() has too many arguments starting with 30.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
94
95
        $node->refresh();
96
        $this->assertEquals(26, $node->parent_id);
97
        $this->assertEquals(3, $node->sort);
98
        $this->assertEquals(1, $node->depth);
99
    }
100
101
    public function testInsertAfterAnotherTree()
102
    {
103
        $node = NodeAlMp::findOne(26);
0 ignored issues
show
The call to NodeAlMp::findOne() has too many arguments starting with 26.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
104
        $this->assertTrue($node->insertAfter(NodeAlMp::findOne(21))->save());
0 ignored issues
show
The call to NodeAlMp::findOne() has too many arguments starting with 21.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
105
106
        $node->refresh();
107
        $this->assertEquals(9, $node->parent_id);
108
        $this->assertEquals(3, $node->sort);
109
        $this->assertEquals(3, $node->depth);
110
    }
111
112
    public function testDelete()
113
    {
114
        $this->assertEquals(1, NodeAlMp::findOne(30)->delete());
0 ignored issues
show
The call to NodeAlMp::findOne() has too many arguments starting with 30.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
115
        $this->assertEquals(null, NodeAlMp::findOne(30));
0 ignored issues
show
The call to NodeAlMp::findOne() has too many arguments starting with 30.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
116
    }
117
118
    public function testDeleteWithChildren()
119
    {
120
        $this->assertEquals(10, NodeAlMp::findOne(4)->deleteWithChildren());
0 ignored issues
show
The call to NodeAlMp::findOne() has too many arguments starting with 4.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
121
        $this->assertEquals(null, NodeAlMp::findOne(24));
0 ignored issues
show
The call to NodeAlMp::findOne() has too many arguments starting with 24.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
122
        $this->assertEquals(15, NodeAlMp::findOne(1)->deleteWithChildren());
0 ignored issues
show
The call to NodeAlMp::findOne() has too many arguments starting with 1.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
123
    }
124
}