This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * This file is part of the Cubiche package. |
||
4 | * |
||
5 | * Copyright (c) Cubiche |
||
6 | * |
||
7 | * For the full copyright and license information, please view the LICENSE |
||
8 | * file that was distributed with this source code. |
||
9 | */ |
||
10 | namespace Cubiche\Core\Collections\Tests\Units; |
||
11 | |||
12 | use Cubiche\Core\Collections\LazyCollection\LazyCollection; |
||
13 | use Cubiche\Core\Comparable\Comparator; |
||
14 | |||
15 | /** |
||
16 | * DataSourceCollectionTestCase trait. |
||
17 | * |
||
18 | * @author Ivannis Suárez Jerez <[email protected]> |
||
19 | * @author Karel Osorio RamÃrez <[email protected]> |
||
20 | */ |
||
21 | trait DataSourceCollectionTestCase |
||
22 | { |
||
23 | /** |
||
24 | * {@inheritdoc} |
||
25 | */ |
||
26 | protected function randomValue() |
||
27 | { |
||
28 | return \rand(0, 100); |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * {@inheritdoc} |
||
33 | */ |
||
34 | protected function uniqueValue() |
||
35 | { |
||
36 | return 1000; |
||
37 | } |
||
38 | |||
39 | /* |
||
40 | * Test create. |
||
41 | */ |
||
42 | public function testCreate() |
||
43 | { |
||
44 | $this |
||
0 ignored issues
–
show
|
|||
45 | ->given($collection = $this->randomCollection()) |
||
0 ignored issues
–
show
It seems like
randomCollection() must be provided by classes using this trait. How about adding it as abstract method to this trait?
This check looks for methods that are used by a trait but not required by it. To illustrate, let’s look at the following code example trait Idable {
public function equalIds(Idable $other) {
return $this->getId() === $other->getId();
}
}
The trait Adding the ![]() |
|||
46 | ->then() |
||
47 | ->collection($collection) |
||
48 | ->isInstanceOf(LazyCollection::class) |
||
49 | ; |
||
50 | } |
||
51 | |||
52 | /* |
||
53 | * Test count. |
||
54 | */ |
||
55 | public function testCount() |
||
56 | { |
||
57 | parent::testCount(); |
||
58 | |||
59 | $this |
||
0 ignored issues
–
show
It seems like
given() must be provided by classes using this trait. How about adding it as abstract method to this trait?
This check looks for methods that are used by a trait but not required by it. To illustrate, let’s look at the following code example trait Idable {
public function equalIds(Idable $other) {
return $this->getId() === $other->getId();
}
}
The trait Adding the ![]() |
|||
60 | ->given($collection = $this->randomCollection()) |
||
0 ignored issues
–
show
It seems like
randomCollection() must be provided by classes using this trait. How about adding it as abstract method to this trait?
This check looks for methods that are used by a trait but not required by it. To illustrate, let’s look at the following code example trait Idable {
public function equalIds(Idable $other) {
return $this->getId() === $other->getId();
}
}
The trait Adding the ![]() |
|||
61 | ->when($collection->clear()) |
||
62 | ->then() |
||
63 | ->integer($collection->count()) |
||
64 | ->isEqualTo(0) |
||
65 | ; |
||
66 | } |
||
67 | |||
68 | /* |
||
69 | * Test getIterator. |
||
70 | */ |
||
71 | public function testGetIterator() |
||
72 | { |
||
73 | parent::testGetIterator(); |
||
74 | |||
75 | $this |
||
0 ignored issues
–
show
It seems like
given() must be provided by classes using this trait. How about adding it as abstract method to this trait?
This check looks for methods that are used by a trait but not required by it. To illustrate, let’s look at the following code example trait Idable {
public function equalIds(Idable $other) {
return $this->getId() === $other->getId();
}
}
The trait Adding the ![]() |
|||
76 | ->given($collection = $this->randomCollection()) |
||
0 ignored issues
–
show
It seems like
randomCollection() must be provided by classes using this trait. How about adding it as abstract method to this trait?
This check looks for methods that are used by a trait but not required by it. To illustrate, let’s look at the following code example trait Idable {
public function equalIds(Idable $other) {
return $this->getId() === $other->getId();
}
}
The trait Adding the ![]() |
|||
77 | ->when($collection->clear()) |
||
78 | ->then() |
||
79 | ->object($collection->getIterator()) |
||
80 | ->isInstanceOf(\Traversable::class) |
||
81 | ; |
||
82 | } |
||
83 | |||
84 | /* |
||
85 | * Test slice. |
||
86 | */ |
||
87 | public function testSlice() |
||
88 | { |
||
89 | parent::testSlice(); |
||
90 | |||
91 | $this |
||
0 ignored issues
–
show
It seems like
given() must be provided by classes using this trait. How about adding it as abstract method to this trait?
This check looks for methods that are used by a trait but not required by it. To illustrate, let’s look at the following code example trait Idable {
public function equalIds(Idable $other) {
return $this->getId() === $other->getId();
}
}
The trait Adding the ![]() |
|||
92 | ->given($collection = $this->randomCollection()) |
||
0 ignored issues
–
show
It seems like
randomCollection() must be provided by classes using this trait. How about adding it as abstract method to this trait?
This check looks for methods that are used by a trait but not required by it. To illustrate, let’s look at the following code example trait Idable {
public function equalIds(Idable $other) {
return $this->getId() === $other->getId();
}
}
The trait Adding the ![]() |
|||
93 | ->when($collection->clear()) |
||
94 | ->and($slicedCollection = $collection->slice(0, 10)) |
||
95 | ->then() |
||
96 | ->collection($slicedCollection) |
||
97 | ->isEmpty() |
||
98 | ; |
||
99 | } |
||
100 | |||
101 | /* |
||
102 | * Test sorted. |
||
103 | */ |
||
104 | public function testSorted() |
||
105 | { |
||
106 | parent::testSorted(); |
||
107 | |||
108 | $this |
||
0 ignored issues
–
show
It seems like
given() must be provided by classes using this trait. How about adding it as abstract method to this trait?
This check looks for methods that are used by a trait but not required by it. To illustrate, let’s look at the following code example trait Idable {
public function equalIds(Idable $other) {
return $this->getId() === $other->getId();
}
}
The trait Adding the ![]() |
|||
109 | ->given( |
||
110 | $comparator = new Comparator(), |
||
111 | $collection = $this->randomCollection() |
||
0 ignored issues
–
show
It seems like
randomCollection() must be provided by classes using this trait. How about adding it as abstract method to this trait?
This check looks for methods that are used by a trait but not required by it. To illustrate, let’s look at the following code example trait Idable {
public function equalIds(Idable $other) {
return $this->getId() === $other->getId();
}
}
The trait Adding the ![]() |
|||
112 | ) |
||
113 | ->when($collection->clear()) |
||
114 | ->and($sortedCollection = $collection->sorted($comparator)) |
||
115 | ->then |
||
116 | ->collection($sortedCollection) |
||
117 | ->isSorted() |
||
118 | ; |
||
119 | } |
||
120 | } |
||
121 |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idable
provides a methodequalsId
that in turn relies on the methodgetId()
. If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()
as an abstract method to the trait will make sure it is available.