Skip to content

Commit

Permalink
running php-cs-fixer to fix assertCount change (#3)
Browse files Browse the repository at this point in the history
* running php-cs-fixer to fix assertCount change

* fixing additional cs fix that was missed somehow
  • Loading branch information
jaydiablo authored Jun 28, 2018
1 parent 320edeb commit 566629c
Show file tree
Hide file tree
Showing 26 changed files with 256 additions and 257 deletions.
4 changes: 2 additions & 2 deletions tests/Zend/Db/Adapter/MysqliTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function testAdapterAutoQuoteIdentifiersTrue()
$select->from('zfproducts');
$stmt = $this->_db->query($select);
$result1 = $stmt->fetchAll();
$this->assertEquals(3, count($result1), 'Expected 3 rows in first query result');
$this->assertCount(3, $result1, 'Expected 3 rows in first query result');

$this->assertEquals(1, $result1[0]['product_id']);

Expand All @@ -81,7 +81,7 @@ public function testAdapterAutoQuoteIdentifiersTrue()
try {
$stmt = $this->_db->query($select);
$result2 = $stmt->fetchAll();
$this->assertEquals(3, count($result2), 'Expected 3 rows in second query result');
$this->assertCount(3, $result2, 'Expected 3 rows in second query result');
$this->assertEquals($result1, $result2);
} catch (Zend_Exception $e) {
$this->fail('exception caught where none was expected.');
Expand Down
20 changes: 10 additions & 10 deletions tests/Zend/Db/Adapter/OracleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function testAdapterFetchAll()
$product_id = $this->_db->quoteIdentifier('product_id');

$result = $this->_db->fetchAll("SELECT * FROM $products WHERE $product_id > :id ORDER BY $product_id ASC", array(':id' => 1));
$this->assertEquals(2, count($result));
$this->assertCount(2, $result);
$this->assertThat($result[0], $this->arrayHasKey('product_id'));
$this->assertEquals('2', $result[0]['product_id']);
}
Expand All @@ -92,17 +92,17 @@ public function testAdapterFetchAllOverrideFetchMode()

// Test associative array
$result = $this->_db->fetchAll("SELECT * FROM $products WHERE $product_id > :id ORDER BY $product_id ASC", array(':id' => 1), Zend_Db::FETCH_ASSOC);
$this->assertEquals(2, count($result));
$this->assertCount(2, $result);
$this->assertInternalType('array', $result[0]);
$this->assertEquals(2, count($result[0])); // count columns
$this->assertCount(2, $result[0]); // count columns
$this->assertEquals(2, $result[0][$col_name]);

// Test numeric and associative array
// OCI8 driver does not support fetchAll(FETCH_BOTH), use fetch() in a loop instead

// Ensure original fetch mode has been retained
$result = $this->_db->fetchAll("SELECT * FROM $products WHERE $product_id > :id ORDER BY $product_id", array(':id' => 1));
$this->assertEquals(2, count($result));
$this->assertCount(2, $result);
$this->assertInternalType('object', $result[0]);
$this->assertEquals(2, $result[0]->$col_name);
}
Expand Down Expand Up @@ -147,7 +147,7 @@ public function testAdapterFetchCol()
$product_id = $this->_db->quoteIdentifier('product_id');

$result = $this->_db->fetchCol("SELECT * FROM $products WHERE $product_id > :id ORDER BY $product_id ASC", array(':id' => 1));
$this->assertEquals(2, count($result)); // count rows
$this->assertCount(2, $result); // count rows
$this->assertEquals(2, $result[0]);
$this->assertEquals(3, $result[1]);
}
Expand All @@ -165,7 +165,7 @@ public function testAdapterFetchColAfterSetFetchMode()
$this->_db->setFetchMode(Zend_Db::FETCH_OBJ);
$result = $this->_db->fetchCol("SELECT * FROM $products WHERE $product_id > :id ORDER BY $product_id ASC", array(':id' => 1));
$this->assertInternalType('array', $result);
$this->assertEquals(2, count($result)); // count rows
$this->assertCount(2, $result); // count rows
$this->assertEquals(2, $result[0]);
$this->assertEquals(3, $result[1]);
}
Expand Down Expand Up @@ -214,7 +214,7 @@ public function testAdapterFetchPairs()

$prod = 'Linux';
$result = $this->_db->fetchPairs("SELECT $product_id, $product_name FROM $products WHERE $product_id > :id ORDER BY $product_id ASC", array(':id' => 1));
$this->assertEquals(2, count($result)); // count rows
$this->assertCount(2, $result); // count rows
$this->assertEquals($prod, $result[2]);
}

Expand All @@ -232,7 +232,7 @@ public function testAdapterFetchPairsAfterSetFetchMode()
$prod = 'Linux';
$result = $this->_db->fetchPairs("SELECT $product_id, $product_name FROM $products WHERE $product_id > :id ORDER BY $product_id ASC", array(':id' => 1));
$this->assertInternalType('array', $result);
$this->assertEquals(2, count($result)); // count rows
$this->assertCount(2, $result); // count rows
$this->assertEquals($prod, $result[2]);
}

Expand All @@ -245,7 +245,7 @@ public function testAdapterFetchRow()
$product_id = $this->_db->quoteIdentifier('product_id');

$result = $this->_db->fetchRow("SELECT * FROM $products WHERE $product_id > :id ORDER BY $product_id", array(':id' => 1));
$this->assertEquals(2, count($result)); // count columns
$this->assertCount(2, $result); // count columns
$this->assertEquals(2, $result['product_id']);
}

Expand All @@ -265,7 +265,7 @@ public function testAdapterFetchRowOverrideFetchMode()
// Test associative array
$result = $this->_db->fetchRow("SELECT * FROM $products WHERE $product_id > :id ORDER BY $product_id", array(':id' => 1), Zend_Db::FETCH_ASSOC);
$this->assertInternalType('array', $result);
$this->assertEquals(2, count($result)); // count columns
$this->assertCount(2, $result); // count columns
$this->assertEquals(2, $result['product_id']);

// Test numeric and associative array
Expand Down
2 changes: 1 addition & 1 deletion tests/Zend/Db/Adapter/Pdo/IbmTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function testAdapterLimitInvalidArgumentException()
$stmt = $this->_db->query($sql);
$result = $stmt->fetchAll();

$this->assertEquals(0, count($result), 'Expecting to see 0 rows returned');
$this->assertCount(0, $result, 'Expecting to see 0 rows returned');

try {
$sql = $this->_db->limit("SELECT * FROM $products", 1, -1);
Expand Down
2 changes: 1 addition & 1 deletion tests/Zend/Db/Adapter/Pdo/MssqlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function testAdapterAutoQuoteIdentifiersTrue()
$select->from('zfproducts');
$stmt = $this->_db->query($select);
$result = $stmt->fetchAll();
$this->assertEquals(3, count($result), 'Expected 3 rows in first query result');
$this->assertCount(3, $result, 'Expected 3 rows in first query result');

$this->assertEquals(1, $result[0]['product_id']);
}
Expand Down
28 changes: 14 additions & 14 deletions tests/Zend/Db/Adapter/SqlsrvTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function testAdapterAutoQuoteIdentifiersTrue()
$select->from('zfproducts');
$stmt = $this->_db->query($select);
$result = $stmt->fetchAll();
$this->assertEquals(3, count($result), 'Expected 3 rows in first query result');
$this->assertCount(3, $result, 'Expected 3 rows in first query result');

$this->assertEquals(1, $result[0]['product_id']);
}
Expand Down Expand Up @@ -167,7 +167,7 @@ public function testAdapterDescribeTableNotExistingTable()
{
$desc = $this->_db->describeTable('not_existing_table');

$this->assertEquals(0, count($desc), 'Expected to have empty result');
$this->assertCount(0, $desc, 'Expected to have empty result');
}

public function testAdapterDescribeTablePrimaryKeyColumn()
Expand Down Expand Up @@ -455,9 +455,9 @@ public function testAdapterLimit()

$stmt = $this->_db->query($sql);
$result = $stmt->fetchAll();
$this->assertEquals(
$this->assertCount(
1,
count($result),
$result,
'Expecting row count to be 1'
);
$this->assertEquals(
Expand All @@ -482,9 +482,9 @@ public function testAdapterLimitOffset()

$stmt = $this->_db->query($sql);
$result = $stmt->fetchAll();
$this->assertEquals(
$this->assertCount(
1,
count($result),
$result,
'Expecting row count to be 1'
);
$this->assertEquals(
Expand All @@ -506,9 +506,9 @@ public function testAdapterLimitOffsetWithOffsetExceedingRowCount()

$stmt = $this->_db->query($sql);
$result = $stmt->fetchAll();
$this->assertEquals(
$this->assertCount(
1,
count($result),
$result,
'Expecting row count to be 1'
);
}
Expand All @@ -525,9 +525,9 @@ public function testAdapterLimitWithoutOrder()

$stmt = $this->_db->query($sql);
$result = $stmt->fetchAll();
$this->assertEquals(
$this->assertCount(
1,
count($result),
$result,
'Expecting row count to be 1'
);
$this->assertEquals(
Expand All @@ -549,9 +549,9 @@ public function testAdapterLimitOffsetWithoutOrder()

$stmt = $this->_db->query($sql);
$result = $stmt->fetchAll();
$this->assertEquals(
$this->assertCount(
1,
count($result),
$result,
'Expecting row count to be 1'
);
$this->assertEquals(
Expand All @@ -574,9 +574,9 @@ public function testAdapterLimitOffsetWithMultipleOrderColumns()

$stmt = $this->_db->query($sql);
$result = $stmt->fetchAll();
$this->assertEquals(
$this->assertCount(
1,
count($result),
$result,
'Expecting row count to be 1'
);
$this->assertEquals(
Expand Down
52 changes: 26 additions & 26 deletions tests/Zend/Db/Adapter/TestCommon.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function testAdapterAutoQuoteIdentifiersTrue()
$select->from('zfproducts');
$stmt = $this->_db->query($select);
$result = $stmt->fetchAll();
$this->assertEquals(3, count($result), 'Expected 3 rows in first query result');
$this->assertCount(3, $result, 'Expected 3 rows in first query result');

$this->assertEquals(1, $result[0]['product_id']);

Expand Down Expand Up @@ -244,7 +244,7 @@ public function testAdapterDelete()
$select = $this->_db->select()->from('zfproducts')->order('product_id ASC');
$result = $this->_db->fetchAll($select);

$this->assertEquals(3, count($result), 'Expected count of result to be 2');
$this->assertCount(3, $result, 'Expected count of result to be 2');
$this->assertEquals(1, $result[0]['product_id'], 'Expecting product_id of 0th row to be 1');

$rowsAffected = $this->_db->delete('zfproducts', "$product_id = 2");
Expand All @@ -253,7 +253,7 @@ public function testAdapterDelete()
$select = $this->_db->select()->from('zfproducts')->order('product_id ASC');
$result = $this->_db->fetchAll($select);

$this->assertEquals(2, count($result), 'Expected count of result to be 2');
$this->assertCount(2, $result, 'Expected count of result to be 2');
$this->assertEquals(1, $result[0]['product_id'], 'Expecting product_id of 0th row to be 1');

$rowsAffected = $this->_db->delete('zfproducts', "$product_id = 327");
Expand Down Expand Up @@ -429,7 +429,7 @@ public function testAdapterDescribeTablePrimaryKeyColumn()
public function testAdapterDescribeView()
{
$describe = $this->_db->describeTable('temp_view');
$this->assertEquals(8, count($describe));
$this->assertCount(8, $describe);
}

/**
Expand All @@ -441,7 +441,7 @@ public function testAdapterFetchAll()
$product_id = $this->_db->quoteIdentifier('product_id');

$result = $this->_db->fetchAll("SELECT * FROM $products WHERE $product_id > ? ORDER BY $product_id ASC", 1);
$this->assertEquals(2, count($result));
$this->assertCount(2, $result);
$this->assertEquals('2', $result[0]['product_id']);
}

Expand All @@ -459,22 +459,22 @@ public function testAdapterFetchAllOverrideFetchMode()

// Test associative array
$result = $this->_db->fetchAll("SELECT * FROM $products WHERE $product_id > ? ORDER BY $product_id ASC", 1, Zend_Db::FETCH_ASSOC);
$this->assertEquals(2, count($result));
$this->assertCount(2, $result);
$this->assertInternalType('array', $result[0]);
$this->assertEquals(2, count($result[0])); // count columns
$this->assertCount(2, $result[0]); // count columns
$this->assertEquals(2, $result[0][$col_name]);

// Test numeric and associative array
$result = $this->_db->fetchAll("SELECT * FROM $products WHERE $product_id > ? ORDER BY $product_id ASC", 1, Zend_Db::FETCH_BOTH);
$this->assertEquals(2, count($result));
$this->assertCount(2, $result);
$this->assertInternalType('array', $result[0]);
$this->assertEquals(4, count($result[0])); // count columns
$this->assertCount(4, $result[0]); // count columns
$this->assertEquals(2, $result[0][$col_name]);
$this->assertEquals(2, $result[0][0]);

// Ensure original fetch mode has been retained
$result = $this->_db->fetchAll("SELECT * FROM $products WHERE $product_id > ? ORDER BY $product_id", 1);
$this->assertEquals(2, count($result));
$this->assertCount(2, $result);
$this->assertInternalType('object', $result[0]);
$this->assertEquals(2, $result[0]->$col_name);
}
Expand Down Expand Up @@ -518,7 +518,7 @@ public function testAdapterFetchCol()

$result = $this->_db->fetchCol("SELECT * FROM $products WHERE $product_id > ? ORDER BY $product_id ASC", 1);
$this->assertInternalType('array', $result);
$this->assertEquals(2, count($result)); // count rows
$this->assertCount(2, $result); // count rows
$this->assertEquals(2, $result[0]);
$this->assertEquals(3, $result[1]);
}
Expand All @@ -535,7 +535,7 @@ public function testAdapterFetchColAfterSetFetchMode()
$this->_db->setFetchMode(Zend_Db::FETCH_OBJ);
$result = $this->_db->fetchCol("SELECT * FROM $products WHERE $product_id > ? ORDER BY $product_id ASC", 1);
$this->assertInternalType('array', $result);
$this->assertEquals(2, count($result)); // count rows
$this->assertCount(2, $result); // count rows
$this->assertEquals(2, $result[0]);
$this->assertEquals(3, $result[1]);
}
Expand Down Expand Up @@ -582,7 +582,7 @@ public function testAdapterFetchPairs()

$prod = 'Linux';
$result = $this->_db->fetchPairs("SELECT $product_id, $product_name FROM $products WHERE $product_id > ? ORDER BY $product_id ASC", 1);
$this->assertEquals(2, count($result)); // count rows
$this->assertCount(2, $result); // count rows
$this->assertEquals($prod, $result[2]);
}

Expand All @@ -599,7 +599,7 @@ public function testAdapterFetchPairsAfterSetFetchMode()
$prod = 'Linux';
$result = $this->_db->fetchPairs("SELECT $product_id, $product_name FROM $products WHERE $product_id > ? ORDER BY $product_id ASC", 1);
$this->assertInternalType('array', $result);
$this->assertEquals(2, count($result)); // count rows
$this->assertCount(2, $result); // count rows
$this->assertEquals($prod, $result[2]);
}

Expand All @@ -612,7 +612,7 @@ public function testAdapterFetchRow()
$product_id = $this->_db->quoteIdentifier('product_id');

$result = $this->_db->fetchRow("SELECT * FROM $products WHERE $product_id > ? ORDER BY $product_id", 1);
$this->assertEquals(2, count($result)); // count columns
$this->assertCount(2, $result); // count columns
$this->assertEquals(2, $result['product_id']);
}

Expand All @@ -631,13 +631,13 @@ public function testAdapterFetchRowOverrideFetchMode()
// Test associative array
$result = $this->_db->fetchRow("SELECT * FROM $products WHERE $product_id > ? ORDER BY $product_id", 1, Zend_Db::FETCH_ASSOC);
$this->assertInternalType('array', $result);
$this->assertEquals(2, count($result)); // count columns
$this->assertCount(2, $result); // count columns
$this->assertEquals(2, $result['product_id']);

// Test numeric and associative array
$result = $this->_db->fetchRow("SELECT * FROM $products WHERE $product_id > ? ORDER BY $product_id", 1, Zend_Db::FETCH_BOTH);
$this->assertInternalType('array', $result);
$this->assertEquals(4, count($result)); // count columns
$this->assertCount(4, $result); // count columns
$this->assertEquals(2, $result['product_id']);
$this->assertEquals(2, $result[0]);

Expand Down Expand Up @@ -726,14 +726,14 @@ public function testAdapterLimit()

$stmt = $this->_db->query($sql);
$result = $stmt->fetchAll();
$this->assertEquals(
$this->assertCount(
1,
count($result),
$result,
'Expecting row count to be 1'
);
$this->assertEquals(
$this->assertCount(
2,
count($result[0]),
$result[0],
'Expecting column count to be 2'
);
$this->assertEquals(
Expand All @@ -760,14 +760,14 @@ public function testAdapterLimitOffset()

$stmt = $this->_db->query($sql);
$result = $stmt->fetchAll();
$this->assertEquals(
$this->assertCount(
1,
count($result),
$result,
'Expecting row count to be 1'
);
$this->assertEquals(
$this->assertCount(
2,
count($result[0]),
$result[0],
'Expecting column count to be 2'
);
$this->assertEquals(
Expand Down Expand Up @@ -1659,7 +1659,7 @@ public function testZF2059()
$bug_status = $this->_db->quoteIdentifier('bug_status');
$sql = "SELECT $bug_id FROM $bugs WHERE $bug_status != " . $valueQuoted;
$results = $this->_db->fetchAll($sql);
$this->assertEquals(4, count($results));
$this->assertCount(4, $results);
}

public function testAdapterSetFetchMode()
Expand Down
Loading

0 comments on commit 566629c

Please sign in to comment.