xref: /plugin/struct/_test/QueryBuilderTest.php (revision 150f5bc933a51e9c38dc84fe05d936cf95f358e1)
1*8fed17f3SAndreas Gohr<?php
2*8fed17f3SAndreas Gohr
3*8fed17f3SAndreas Gohrnamespace dokuwiki\plugin\struct\test;
4*8fed17f3SAndreas Gohr
5*8fed17f3SAndreas Gohruse dokuwiki\plugin\struct\meta\StructException;
6*8fed17f3SAndreas Gohruse dokuwiki\plugin\struct\test\mock\QueryBuilder;
7*8fed17f3SAndreas Gohr
8*8fed17f3SAndreas Gohr/**
9*8fed17f3SAndreas Gohr * @group plugin_struct
10*8fed17f3SAndreas Gohr * @group plugins
11*8fed17f3SAndreas Gohr */
12*8fed17f3SAndreas Gohrclass QueryBuilderTest extends StructTest
13*8fed17f3SAndreas Gohr{
14*8fed17f3SAndreas Gohr
15*8fed17f3SAndreas Gohr    public function test_join()
16*8fed17f3SAndreas Gohr    {
17*8fed17f3SAndreas Gohr        $qb = new QueryBuilder();
18*8fed17f3SAndreas Gohr
19*8fed17f3SAndreas Gohr        $qb->addTable('first');
20*8fed17f3SAndreas Gohr        $qb->addTable('second');
21*8fed17f3SAndreas Gohr        $qb->addTable('third');
22*8fed17f3SAndreas Gohr
23*8fed17f3SAndreas Gohr        $qb->addLeftJoin('second', 'fourth', 'fourth', 'second.foo=fourth.foo');
24*8fed17f3SAndreas Gohr        $this->assertEquals(['first', 'second', 'fourth', 'third'], array_keys($qb->from));
25*8fed17f3SAndreas Gohr    }
26*8fed17f3SAndreas Gohr}
27