@@ 90-114 (lines=25) @@ | ||
87 | /** |
|
88 | * @dataProvider joinTypeDataProvider |
|
89 | */ |
|
90 | public function testAddJoinWithCondition($joinType, $addMethodName) |
|
91 | { |
|
92 | $this->criteria->{$addMethodName}( |
|
93 | 'products', |
|
94 | $this->getEntityClass('Product'), |
|
95 | Join::WITH, |
|
96 | '{entity}.name IS NOT NULL', |
|
97 | 'idx_name' |
|
98 | ); |
|
99 | ||
100 | $expectedJoin = new Join( |
|
101 | $joinType, |
|
102 | $this->getEntityClass('Product'), |
|
103 | Join::WITH, |
|
104 | '{entity}.name IS NOT NULL', |
|
105 | 'idx_name' |
|
106 | ); |
|
107 | $this->assertTrue($this->criteria->hasJoin('products')); |
|
108 | $this->assertEquals($expectedJoin, $this->criteria->getJoin('products')); |
|
109 | $this->assertEquals(['products' => $expectedJoin], $this->criteria->getJoins()); |
|
110 | $this->assertQuery( |
|
111 | 'SELECT e FROM Test:User e ' |
|
112 | . $joinType . ' JOIN Test:Product a1 INDEX BY idx_name WITH a1.name IS NOT NULL' |
|
113 | ); |
|
114 | } |
|
115 | ||
116 | /** |
|
117 | * @dataProvider joinTypeDataProvider |
|
@@ 119-136 (lines=18) @@ | ||
116 | /** |
|
117 | * @dataProvider joinTypeDataProvider |
|
118 | */ |
|
119 | public function testAddJoinWithConditionAndEntityName($joinType, $addMethodName) |
|
120 | { |
|
121 | $this->criteria->{$addMethodName}('products', 'Test:Product', Join::WITH, '{entity}.name IS NOT NULL'); |
|
122 | ||
123 | $expectedJoin = new Join( |
|
124 | $joinType, |
|
125 | $this->getEntityClass('Product'), |
|
126 | Join::WITH, |
|
127 | '{entity}.name IS NOT NULL' |
|
128 | ); |
|
129 | $this->assertTrue($this->criteria->hasJoin('products')); |
|
130 | $this->assertEquals($expectedJoin, $this->criteria->getJoin('products')); |
|
131 | $this->assertEquals(['products' => $expectedJoin], $this->criteria->getJoins()); |
|
132 | $this->assertQuery( |
|
133 | 'SELECT e FROM Test:User e ' |
|
134 | . $joinType . ' JOIN Test:Product a1 WITH a1.name IS NOT NULL' |
|
135 | ); |
|
136 | } |
|
137 | ||
138 | public function testAddSeveralJoins() |
|
139 | { |