/** * @covers ::whereNotExists */ public function testWhereNotExists() { $subQuery = new Query(new SelectBuilder()); $subQuery->setInvolvedTable('_', Blog::table()); $subQuery->setRootAlias('__')->root('Article')->where('title', 'Article 1')->whereAttr('blogId', '_/id'); $b = new WhereBuilder(); $b->root('Blog')->whereNotExists($subQuery); $components = $b->build(); $where[] = ['type' => 'Exists', 'query' => $subQuery, 'logic' => 'AND', 'not' => true]; // There is a sub array because Builders do not flatten value array. $val['where'] = [['Article 1']]; $this->assertEquals($where, $components['where']); $this->assertEquals($val, $b->getValues()); }