1 | <?php |
||
22 | abstract class QueryTestAbstract extends TestAbstract implements QueryTestInterface{ |
||
23 | |||
24 | const TEST_DBNAME = 'querytest'; |
||
25 | const TEST_TABLENAME = 'querytest'; |
||
26 | /** |
||
27 | * @var \chillerlan\Database\DBQuery |
||
28 | */ |
||
29 | protected $statement; |
||
30 | |||
31 | public function setUp(){ |
||
36 | |||
37 | public function testInstance(){ |
||
60 | |||
61 | protected function createDatabase(){ |
||
64 | |||
65 | /** |
||
66 | * @expectedException \Exception |
||
67 | * @expectedExceptionMessage no name specified |
||
68 | */ |
||
69 | public function testCreateDatabaseNoName(){ |
||
72 | |||
73 | protected function createTable(){ |
||
85 | /* |
||
|
|||
86 | public function testSelect(){ |
||
87 | $select = $this->statement->select; |
||
88 | |||
89 | $select |
||
90 | ->distinct() |
||
91 | ->cols(['t2.what', 't1.foo' => 'foo']) |
||
92 | ->cols(['t1.bar' => ['bar', 'lower'], 'nope', ['what', 'upper']]) |
||
93 | ->from(['foo' => 't1', 'bar' => 't2']) |
||
94 | ->from(['whatever']) |
||
95 | ->where('t2.what', 3) |
||
96 | ->openBracket('and') |
||
97 | ->where('t1.what', 't2.what', '>', false) |
||
98 | ->where('t2.what', [1,2,3], 'in') |
||
99 | ->closeBracket() |
||
100 | ->where('t3.what', $this->statement->select->cols(['foo'])->from(['nope'])->where('bar', 42), 'in', true, 'or') |
||
101 | ->groupby(['foo', 'bar']) |
||
102 | ->orderby(['foo', 'bar' => 'desc']) |
||
103 | ->offset(3) |
||
104 | ->limit(5); |
||
105 | |||
106 | # print_r($select->sql()); |
||
107 | |||
108 | } |
||
109 | */ |
||
110 | #public function testDelete(){} |
||
111 | |||
112 | #public function testUpdate(){} |
||
113 | /* |
||
114 | public function testCreate(){ |
||
115 | |||
116 | $create = $this->statement->create; |
||
117 | |||
118 | # print_r($database->name('bar')->charset('utf8mb4_bin')->ifNotExists()->sql()); |
||
119 | |||
120 | $table = $create->table(); |
||
121 | $this->assertInstanceOf(CreateTableInterface::class, $table); |
||
122 | $this->assertInstanceOf(StatementInterface::class, $table); |
||
123 | |||
124 | $table |
||
125 | ->name('foo') |
||
126 | ->ifNotExists() |
||
127 | ->primaryKey('id') |
||
128 | ->field('id', 'int', 10, 'unsigned', null, false, null, null, 'AUTO_INCREMENT') |
||
129 | ->field('bar', 'varchar', 32, null, 'utf8mb4_bin', true, 'NULL', 'foo') |
||
130 | ->field('nope', 'decimal', '9,6'); |
||
131 | |||
132 | # print_r($table->sql()); |
||
133 | } |
||
134 | */ |
||
135 | } |
||
136 | |||
184 | */ |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.