| Conditions | 1 |
| Paths | 1 |
| Total Lines | 66 |
| Code Lines | 46 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 118 | public function testListTableColumns() |
||
| 119 | { |
||
| 120 | $table = $this->createListTableColumns(); |
||
| 121 | |||
| 122 | $this->_sm->dropAndCreateTable($table); |
||
| 123 | |||
| 124 | $columns = $this->_sm->listTableColumns('list_table_columns'); |
||
| 125 | $columnsKeys = array_keys($columns); |
||
| 126 | |||
| 127 | self::assertArrayHasKey('id', $columns); |
||
| 128 | self::assertEquals(0, array_search('id', $columnsKeys)); |
||
| 129 | self::assertEquals('id', strtolower($columns['id']->getname())); |
||
| 130 | self::assertInstanceOf(IntegerType::class, $columns['id']->gettype()); |
||
| 131 | self::assertFalse($columns['id']->getunsigned()); |
||
| 132 | self::assertTrue($columns['id']->getnotnull()); |
||
| 133 | self::assertNull($columns['id']->getdefault()); |
||
| 134 | self::assertIsArray($columns['id']->getPlatformOptions()); |
||
| 135 | |||
| 136 | $this->assertArrayHasKey('text', $columns); |
||
| 137 | $this->assertEquals('text', strtolower($columns['text']->getname())); |
||
| 138 | $this->assertInstanceOf('Doctrine\DBAL\Types\StringType', $columns['text']->gettype()); |
||
| 139 | |||
| 140 | $this->assertEquals('ts', strtolower($columns['ts']->getname())); |
||
| 141 | $this->assertInstanceOf('Crate\DBAL\Types\TimestampType', $columns['ts']->gettype()); |
||
| 142 | |||
| 143 | $this->assertEquals('num_float_double', strtolower($columns['num_float_double']->getname())); |
||
| 144 | $this->assertInstanceOf('Doctrine\DBAL\Types\FloatType', $columns['num_float_double']->gettype()); |
||
| 145 | |||
| 146 | $this->assertArrayHasKey('num_short', $columns); |
||
| 147 | $this->assertEquals('num_short', strtolower($columns['num_short']->getname())); |
||
| 148 | $this->assertInstanceOf('Doctrine\DBAL\Types\SmallIntType', $columns['num_short']->gettype()); |
||
| 149 | |||
| 150 | $this->assertArrayHasKey('num_int', $columns); |
||
| 151 | $this->assertEquals('num_int', strtolower($columns['num_int']->getname())); |
||
| 152 | $this->assertInstanceOf('Doctrine\DBAL\Types\IntegerType', $columns['num_int']->gettype()); |
||
| 153 | |||
| 154 | $this->assertArrayHasKey('num_long', $columns); |
||
| 155 | $this->assertEquals('num_long', strtolower($columns['num_long']->getname())); |
||
| 156 | $this->assertInstanceOf('Doctrine\DBAL\Types\BigIntType', $columns['num_long']->gettype()); |
||
| 157 | |||
| 158 | $this->assertEquals('obj', strtolower($columns['obj']->getname())); |
||
| 159 | $this->assertInstanceOf('Crate\DBAL\Types\MapType', $columns['obj']->gettype()); |
||
| 160 | |||
| 161 | $this->assertEquals("obj['id']", strtolower($columns["obj['id']"]->getname())); |
||
| 162 | $this->assertInstanceOf('Doctrine\DBAL\Types\IntegerType', $columns["obj['id']"]->gettype()); |
||
| 163 | |||
| 164 | $this->assertEquals("obj['name']", strtolower($columns["obj['name']"]->getname())); |
||
| 165 | $this->assertInstanceOf('Doctrine\DBAL\Types\StringType', $columns["obj['name']"]->gettype()); |
||
| 166 | |||
| 167 | $this->assertEquals('obj2', strtolower($columns['obj2']->getname())); |
||
| 168 | $this->assertInstanceOf('Crate\DBAL\Types\MapType', $columns['obj2']->gettype()); |
||
| 169 | |||
| 170 | $this->assertEquals("obj2['id']", strtolower($columns["obj2['id']"]->getname())); |
||
| 171 | $this->assertInstanceOf('Doctrine\DBAL\Types\IntegerType', $columns["obj2['id']"]->gettype()); |
||
| 172 | |||
| 173 | $this->assertEquals("obj2['name']", strtolower($columns["obj2['name']"]->getname())); |
||
| 174 | $this->assertInstanceOf('Doctrine\DBAL\Types\StringType', $columns["obj2['name']"]->gettype()); |
||
| 175 | |||
| 176 | $this->assertEquals('arr_float', strtolower($columns['arr_float']->getname())); |
||
| 177 | $this->assertInstanceOf('Crate\DBAL\Types\ArrayType', $columns['arr_float']->gettype()); |
||
| 178 | |||
| 179 | $this->assertEquals('arr_str', strtolower($columns['arr_str']->getname())); |
||
| 180 | $this->assertInstanceOf('Crate\DBAL\Types\ArrayType', $columns['arr_str']->gettype()); |
||
| 181 | |||
| 182 | $this->assertEquals('arr_obj', strtolower($columns['arr_obj']->getname())); |
||
| 183 | $this->assertInstanceOf('Crate\DBAL\Types\ArrayType', $columns['arr_obj']->gettype()); |
||
| 184 | } |
||
| 261 |