diff --git a/tests/Zend/Db/Adapter/MysqliTest.php b/tests/Zend/Db/Adapter/MysqliTest.php index 6c00f05..6c33ab9 100644 --- a/tests/Zend/Db/Adapter/MysqliTest.php +++ b/tests/Zend/Db/Adapter/MysqliTest.php @@ -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']); @@ -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.'); diff --git a/tests/Zend/Db/Adapter/OracleTest.php b/tests/Zend/Db/Adapter/OracleTest.php index 0989f03..7e84bdc 100644 --- a/tests/Zend/Db/Adapter/OracleTest.php +++ b/tests/Zend/Db/Adapter/OracleTest.php @@ -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']); } @@ -92,9 +92,9 @@ 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 @@ -102,7 +102,7 @@ public function testAdapterFetchAllOverrideFetchMode() // 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); } @@ -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]); } @@ -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]); } @@ -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]); } @@ -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]); } @@ -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']); } @@ -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 diff --git a/tests/Zend/Db/Adapter/Pdo/IbmTest.php b/tests/Zend/Db/Adapter/Pdo/IbmTest.php index 0aadf3f..2ca5b9f 100644 --- a/tests/Zend/Db/Adapter/Pdo/IbmTest.php +++ b/tests/Zend/Db/Adapter/Pdo/IbmTest.php @@ -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); diff --git a/tests/Zend/Db/Adapter/Pdo/MssqlTest.php b/tests/Zend/Db/Adapter/Pdo/MssqlTest.php index 28304db..6dba3e5 100644 --- a/tests/Zend/Db/Adapter/Pdo/MssqlTest.php +++ b/tests/Zend/Db/Adapter/Pdo/MssqlTest.php @@ -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']); } diff --git a/tests/Zend/Db/Adapter/SqlsrvTest.php b/tests/Zend/Db/Adapter/SqlsrvTest.php index 9e3cfb5..f6d0821 100644 --- a/tests/Zend/Db/Adapter/SqlsrvTest.php +++ b/tests/Zend/Db/Adapter/SqlsrvTest.php @@ -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']); } @@ -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() @@ -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( @@ -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( @@ -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' ); } @@ -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( @@ -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( @@ -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( diff --git a/tests/Zend/Db/Adapter/TestCommon.php b/tests/Zend/Db/Adapter/TestCommon.php index c55e1f6..6c1a053 100644 --- a/tests/Zend/Db/Adapter/TestCommon.php +++ b/tests/Zend/Db/Adapter/TestCommon.php @@ -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']); @@ -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"); @@ -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"); @@ -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); } /** @@ -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']); } @@ -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); } @@ -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]); } @@ -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]); } @@ -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]); } @@ -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]); } @@ -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']); } @@ -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]); @@ -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( @@ -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( @@ -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() diff --git a/tests/Zend/Db/Profiler/OracleTest.php b/tests/Zend/Db/Profiler/OracleTest.php index 3fe4060..0c40ba2 100644 --- a/tests/Zend/Db/Profiler/OracleTest.php +++ b/tests/Zend/Db/Profiler/OracleTest.php @@ -51,7 +51,7 @@ public function testProfilerPreparedStatementWithParams() // analyze query profiles $profiles = $this->_db->getProfiler()->getQueryProfiles(null, true); $this->assertInternalType('array', $profiles, 'Expected array, got ' . gettype($profiles)); - $this->assertEquals(1, count($profiles), 'Expected to find 1 profile'); + $this->assertCount(1, $profiles, 'Expected to find 1 profile'); $qp = $profiles[0]; $this->assertTrue($qp instanceof Zend_Db_Profiler_Query); @@ -71,7 +71,7 @@ public function testProfilerPreparedStatementWithParams() // analyze query profiles $profiles = $this->_db->getProfiler()->getQueryProfiles(null, true); $this->assertInternalType('array', $profiles, 'Expected array, got ' . gettype($profiles)); - $this->assertEquals(2, count($profiles), 'Expected to find 2 profiles'); + $this->assertCount(2, $profiles, 'Expected to find 2 profiles'); $qp = $profiles[1]; $this->assertTrue($qp instanceof Zend_Db_Profiler_Query); @@ -105,7 +105,7 @@ public function testProfilerPreparedStatementWithBoundParams() // analyze query profiles $profiles = $this->_db->getProfiler()->getQueryProfiles(null, true); $this->assertInternalType('array', $profiles); - $this->assertEquals(1, count($profiles), 'Expected to find 1 profile'); + $this->assertCount(1, $profiles, 'Expected to find 1 profile'); $qp = $profiles[0]; $this->assertTrue($qp instanceof Zend_Db_Profiler_Query); @@ -126,7 +126,7 @@ public function testProfilerPreparedStatementWithBoundParams() // analyze query profiles $profiles = $this->_db->getProfiler()->getQueryProfiles(null, true); $this->assertInternalType('array', $profiles); - $this->assertEquals(2, count($profiles), 'Expected to find 2 profiles'); + $this->assertCount(2, $profiles, 'Expected to find 2 profiles'); $qp = $profiles[1]; $this->assertTrue($qp instanceof Zend_Db_Profiler_Query); diff --git a/tests/Zend/Db/Profiler/StaticTest.php b/tests/Zend/Db/Profiler/StaticTest.php index 3259bb0..9984ccd 100644 --- a/tests/Zend/Db/Profiler/StaticTest.php +++ b/tests/Zend/Db/Profiler/StaticTest.php @@ -613,7 +613,7 @@ public function testProfilerQueryEndFilterElapsedSecs() $this->_db->query('sqlTimeShort3'); - $this->assertEquals(1, count($queryProfiles = $prof->getQueryProfiles())); + $this->assertCount(1, $queryProfiles = $prof->getQueryProfiles()); $this->assertTrue(isset($queryProfiles[2])); @@ -639,7 +639,7 @@ public function testProfilerQueryEndFilterQueryType() $this->_db->query('UPDATE'); $this->_db->query('DELETE'); - $this->assertEquals(2, count($prof->getQueryProfiles())); + $this->assertCount(2, $prof->getQueryProfiles()); } /** @@ -697,7 +697,7 @@ public function testProfilerGetQueryProfilesFilterQueryType() foreach ($queries as $queryId => $query) { $queryProfiles = $prof->getQueryProfiles(constant("Zend_Db_Profiler::$query")); - $this->assertEquals(1, count($queryProfiles)); + $this->assertCount(1, $queryProfiles); $this->assertTrue(isset($queryProfiles[$queryId])); $this->assertEquals($query, $queryProfiles[$queryId]->getQuery()); } diff --git a/tests/Zend/Db/Profiler/TestCommon.php b/tests/Zend/Db/Profiler/TestCommon.php index 9c897ec..10b0ce1 100644 --- a/tests/Zend/Db/Profiler/TestCommon.php +++ b/tests/Zend/Db/Profiler/TestCommon.php @@ -65,7 +65,7 @@ public function testProfilerPreparedStatement() // analyze query profiles $profiles = $this->_db->getProfiler()->getQueryProfiles(); $this->assertInternalType('array', $profiles); - $this->assertEquals(1, count($profiles), 'Expected to find 1 profile'); + $this->assertCount(1, $profiles, 'Expected to find 1 profile'); $qp = $profiles[0]; $this->assertTrue($qp instanceof Zend_Db_Profiler_Query); @@ -78,7 +78,7 @@ public function testProfilerPreparedStatement() // analyze query profiles $profiles = $this->_db->getProfiler()->getQueryProfiles(); $this->assertInternalType('array', $profiles); - $this->assertEquals(2, count($profiles), 'Expected to find 2 profiles'); + $this->assertCount(2, $profiles, 'Expected to find 2 profiles'); $qp = $profiles[1]; $this->assertTrue($qp instanceof Zend_Db_Profiler_Query); @@ -106,7 +106,7 @@ public function testProfilerPreparedStatementWithParams() // analyze query profiles $profiles = $this->_db->getProfiler()->getQueryProfiles(); $this->assertInternalType('array', $profiles); - $this->assertEquals(1, count($profiles), 'Expected to find 1 profile'); + $this->assertCount(1, $profiles, 'Expected to find 1 profile'); $qp = $profiles[0]; $this->assertTrue($qp instanceof Zend_Db_Profiler_Query); @@ -126,7 +126,7 @@ public function testProfilerPreparedStatementWithParams() // analyze query profiles $profiles = $this->_db->getProfiler()->getQueryProfiles(); $this->assertInternalType('array', $profiles); - $this->assertEquals(2, count($profiles), 'Expected to find 2 profiles'); + $this->assertCount(2, $profiles, 'Expected to find 2 profiles'); $qp = $profiles[1]; $this->assertTrue($qp instanceof Zend_Db_Profiler_Query); $this->assertNotSame($profiles[0], $profiles[1]); @@ -169,7 +169,7 @@ public function testProfilerPreparedStatementWithBoundParams() // analyze query profiles $profiles = $this->_db->getProfiler()->getQueryProfiles(); $this->assertInternalType('array', $profiles, 'Expected array, got ' . gettype($profiles)); - $this->assertEquals(1, count($profiles), 'Expected to find 1 profile'); + $this->assertCount(1, $profiles, 'Expected to find 1 profile'); $qp = $profiles[0]; $this->assertTrue($qp instanceof Zend_Db_Profiler_Query); @@ -191,7 +191,7 @@ public function testProfilerPreparedStatementWithBoundParams() // analyze query profiles $profiles = $this->_db->getProfiler()->getQueryProfiles(); $this->assertInternalType('array', $profiles, 'Expected array, got ' . gettype($profiles)); - $this->assertEquals(2, count($profiles), 'Expected to find 2 profiles'); + $this->assertCount(2, $profiles, 'Expected to find 2 profiles'); $qp = $profiles[1]; $this->assertTrue($qp instanceof Zend_Db_Profiler_Query); diff --git a/tests/Zend/Db/Select/OracleTest.php b/tests/Zend/Db/Select/OracleTest.php index 7b74ff7..29a175f 100644 --- a/tests/Zend/Db/Select/OracleTest.php +++ b/tests/Zend/Db/Select/OracleTest.php @@ -69,7 +69,7 @@ public function testSelectWhereOr() $select->order('product_id'); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals(2, count($result)); + $this->assertCount(2, $result); $this->assertEquals(1, $result[0]['product_id']); $this->assertEquals(2, $result[1]['product_id']); } @@ -83,7 +83,7 @@ public function testSelectWhereOrWithParameter() $select->order('product_id'); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals(2, count($result)); + $this->assertCount(2, $result); $this->assertEquals(1, $result[0]['product_id']); $this->assertEquals(2, $result[1]['product_id']); } diff --git a/tests/Zend/Db/Select/Pdo/OciTest.php b/tests/Zend/Db/Select/Pdo/OciTest.php index a212600..3589695 100644 --- a/tests/Zend/Db/Select/Pdo/OciTest.php +++ b/tests/Zend/Db/Select/Pdo/OciTest.php @@ -69,7 +69,7 @@ public function testSelectWhereOr() $select->order('product_id'); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals(2, count($result)); + $this->assertCount(2, $result); $this->assertEquals(1, $result[0]['product_id']); $this->assertEquals(2, $result[1]['product_id']); } @@ -83,7 +83,7 @@ public function testSelectWhereOrWithParameter() $select->order('product_id'); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals(2, count($result)); + $this->assertCount(2, $result); $this->assertEquals(1, $result[0]['product_id']); $this->assertEquals(2, $result[1]['product_id']); } diff --git a/tests/Zend/Db/Select/Pdo/PgsqlTest.php b/tests/Zend/Db/Select/Pdo/PgsqlTest.php index 1b08489..71f8f9a 100644 --- a/tests/Zend/Db/Select/Pdo/PgsqlTest.php +++ b/tests/Zend/Db/Select/Pdo/PgsqlTest.php @@ -76,7 +76,7 @@ public function testSelectFromSchemaSpecified() $rowset = $this->_db->fetchAll($sql); - $this->assertEquals(4, count($rowset)); + $this->assertCount(4, $rowset); } /** @@ -97,7 +97,7 @@ public function testSelectFromSchemaInName() $rowset = $this->_db->fetchAll($sql); - $this->assertEquals(4, count($rowset)); + $this->assertCount(4, $rowset); } /** @@ -118,7 +118,7 @@ public function testSelectFromSchemaInNameOverridesSchemaArgument() $rowset = $this->_db->fetchAll($sql); - $this->assertEquals(4, count($rowset)); + $this->assertCount(4, $rowset); } public function testSqlInjectionWithOrder() diff --git a/tests/Zend/Db/Select/Pdo/SqliteTest.php b/tests/Zend/Db/Select/Pdo/SqliteTest.php index a8080ae..f57ab0f 100644 --- a/tests/Zend/Db/Select/Pdo/SqliteTest.php +++ b/tests/Zend/Db/Select/Pdo/SqliteTest.php @@ -64,9 +64,9 @@ public function testSelectGroupBy() $bugs_products = $this->_db->quoteIdentifier('zfbugs_products'); $bug_id = $this->_db->quoteIdentifier('bug_id'); $key = "$bugs_products.$bug_id"; - $this->assertEquals( + $this->assertCount( 3, - count($result), + $result, 'Expected count of first result set to be 2' ); $this->assertEquals(1, $result[0][$key]); @@ -91,9 +91,9 @@ public function testSelectGroupByQualified() $bugs_products = $this->_db->quoteIdentifier('zfbugs_products'); $bug_id = $this->_db->quoteIdentifier('bug_id'); $key = "$bugs_products.$bug_id"; - $this->assertEquals( + $this->assertCount( 3, - count($result), + $result, 'Expected count of first result set to be 2' ); $this->assertEquals(1, $result[0][$key]); @@ -118,7 +118,7 @@ public function testSelectHaving() $bugs_products = $this->_db->quoteIdentifier('zfbugs_products'); $bug_id = $this->_db->quoteIdentifier('bug_id'); $key = "$bugs_products.$bug_id"; - $this->assertEquals(2, count($result)); + $this->assertCount(2, $result); $this->assertEquals(1, $result[0][$key]); $this->assertEquals(3, $result[0]['thecount']); } @@ -135,7 +135,7 @@ public function testSelectHavingWithParameter() $bugs_products = $this->_db->quoteIdentifier('zfbugs_products'); $bug_id = $this->_db->quoteIdentifier('bug_id'); $key = "$bugs_products.$bug_id"; - $this->assertEquals(2, count($result)); + $this->assertCount(2, $result); $this->assertEquals(1, $result[0][$key]); $this->assertEquals(3, $result[0]['thecount']); } @@ -152,7 +152,7 @@ public function testSelectHavingOr() $bugs_products = $this->_db->quoteIdentifier('zfbugs_products'); $bug_id = $this->_db->quoteIdentifier('bug_id'); $key = "$bugs_products.$bug_id"; - $this->assertEquals(3, count($result)); + $this->assertCount(3, $result); $this->assertEquals(1, $result[0][$key]); $this->assertEquals(3, $result[0]['thecount']); $this->assertEquals(2, $result[1][$key]); @@ -171,7 +171,7 @@ public function testSelectHavingOrWithParameter() $bugs_products = $this->_db->quoteIdentifier('zfbugs_products'); $bug_id = $this->_db->quoteIdentifier('bug_id'); $key = "$bugs_products.$bug_id"; - $this->assertEquals(3, count($result)); + $this->assertCount(3, $result); $this->assertEquals(1, $result[0][$key]); $this->assertEquals(3, $result[0]['thecount']); $this->assertEquals(2, $result[1][$key]); diff --git a/tests/Zend/Db/Select/TestCommon.php b/tests/Zend/Db/Select/TestCommon.php index 995e028..f20f286 100644 --- a/tests/Zend/Db/Select/TestCommon.php +++ b/tests/Zend/Db/Select/TestCommon.php @@ -52,7 +52,7 @@ public function testSelect() $stmt = $this->_db->query($select); $row = $stmt->fetch(); $stmt->closeCursor(); - $this->assertEquals(2, count($row)); // correct number of fields + $this->assertCount(2, $row); // correct number of fields $this->assertEquals(1, $row['product_id']); // correct data } @@ -75,7 +75,7 @@ public function testSelectQuery() $stmt = $select->query(); $row = $stmt->fetch(); $stmt->closeCursor(); - $this->assertEquals(2, count($row)); // correct number of fields + $this->assertCount(2, $row); // correct number of fields $this->assertEquals(1, $row['product_id']); // correct data } @@ -97,7 +97,7 @@ public function testSelectQueryWithBinds() $stmt = $select->query(); $row = $stmt->fetch(); $stmt->closeCursor(); - $this->assertEquals(2, count($row)); // correct number of fields + $this->assertCount(2, $row); // correct number of fields $this->assertEquals(1, $row['product_id']); // correct data } @@ -116,8 +116,8 @@ public function testSelectColumnsScalar() $select = $this->_selectColumnsScalar(); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals(3, count($result), 'Expected count of result set to be 2'); - $this->assertEquals(1, count($result[0]), 'Expected column count of result set to be 1'); + $this->assertCount(3, $result, 'Expected count of result set to be 2'); + $this->assertCount(1, $result[0], 'Expected column count of result set to be 1'); $this->assertThat($result[0], $this->arrayHasKey('product_name')); } @@ -133,8 +133,8 @@ public function testSelectColumnsArray() $select = $this->_selectColumnsArray(); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals(3, count($result), 'Expected count of result set to be 2'); - $this->assertEquals(2, count($result[0]), 'Expected column count of result set to be 2'); + $this->assertCount(3, $result, 'Expected count of result set to be 2'); + $this->assertCount(2, $result[0], 'Expected column count of result set to be 2'); $this->assertThat($result[0], $this->arrayHasKey('product_id')); $this->assertThat($result[0], $this->arrayHasKey('product_name')); } @@ -155,7 +155,7 @@ public function testSelectColumnsAliases() $select = $this->_selectColumnsAliases(); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals(3, count($result), 'Expected count of result set to be 2'); + $this->assertCount(3, $result, 'Expected count of result set to be 2'); $this->assertThat($result[0], $this->arrayHasKey('alias')); $this->assertThat($result[0], $this->logicalNot($this->arrayHasKey('product_name'))); } @@ -238,7 +238,7 @@ public function testSelectDistinctModifier() $select = $this->_selectDistinctModifier(); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals(1, count($result)); + $this->assertCount(1, $result); } /** @@ -266,7 +266,7 @@ public function testSelectFromQualified() $select = $this->_selectFromQualified(); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals(3, count($result)); + $this->assertCount(3, $result); } /** @@ -364,7 +364,7 @@ public function testSelectColumnWithColonQuotedParameter() $result = $stmt->fetchAll(); if (is_array($result)) { - $this->assertEquals(0, count($result)); + $this->assertCount(0, $result); } else { $this->assertNull($result); } @@ -381,7 +381,7 @@ public function testSelectFromForUpdate() ->forUpdate(); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals(3, count($result)); + $this->assertCount(3, $result); } /** @@ -404,8 +404,8 @@ public function testSelectJoin() $select = $this->_selectJoin(); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals(6, count($result)); - $this->assertEquals(3, count($result[0])); + $this->assertCount(6, $result); + $this->assertCount(3, $result[0]); } /** @@ -430,8 +430,8 @@ public function testSelectJoinWithCorrelationName() $select = $this->_selectJoinWithCorrelationName(); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals(1, count($result)); - $this->assertEquals(3, count($result[0])); + $this->assertCount(1, $result); + $this->assertCount(3, $result[0]); } /** @@ -455,8 +455,8 @@ public function testSelectJoinInner() $select = $this->_selectJoinInner(); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals(6, count($result)); - $this->assertEquals(3, count($result[0])); + $this->assertCount(6, $result); + $this->assertCount(3, $result[0]); } /** @@ -482,8 +482,8 @@ public function testSelectJoinWithNocolumns() $select = $this->_selectJoinWithNocolumns(); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals(3, count($result)); - $this->assertEquals(2, count($result[0])); + $this->assertCount(3, $result); + $this->assertCount(2, $result[0]); } /** @@ -506,8 +506,8 @@ public function testSelectJoinLeft() $select = $this->_selectJoinLeft(); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals(7, count($result)); - $this->assertEquals(9, count($result[0])); + $this->assertCount(7, $result); + $this->assertCount(9, $result[0]); $this->assertEquals(3, $result[3]['product_id']); $this->assertNull($result[6]['product_id']); } @@ -562,8 +562,8 @@ public function testSelectJoinRight() $select = $this->_selectJoinRight(); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals(7, count($result)); - $this->assertEquals(9, count($result[0])); + $this->assertCount(7, $result); + $this->assertCount(9, $result[0]); $this->assertEquals(3, $result[3]['product_id']); $this->assertNull($result[6]['product_id']); } @@ -584,8 +584,8 @@ public function testSelectJoinCross() $select = $this->_selectJoinCross(); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals(18, count($result)); - $this->assertEquals(3, count($result[0])); + $this->assertCount(18, $result); + $this->assertCount(3, $result[0]); } /** @@ -610,8 +610,8 @@ public function testSelectJoinQualified() $select = $this->_selectJoinQualified(); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals(6, count($result)); - $this->assertEquals(3, count($result[0])); + $this->assertCount(6, $result); + $this->assertCount(3, $result[0]); } protected function _selectJoinUsing() @@ -648,7 +648,7 @@ public function testSelectJoinUsing() $sql = preg_replace('/\\s+/', ' ', $select->assemble()); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals(3, count($result)); + $this->assertCount(3, $result); $this->assertEquals(1, $result[0]['product_id']); } @@ -671,7 +671,7 @@ public function testSelectJoinInnerUsing() $sql = preg_replace('/\\s+/', ' ', $select->assemble()); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals(3, count($result)); + $this->assertCount(3, $result); $this->assertEquals(1, $result[0]['product_id']); } @@ -736,7 +736,7 @@ public function testSelectWhere() $select = $this->_selectWhere(); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals(1, count($result)); + $this->assertCount(1, $result); $this->assertEquals(2, $result[0]['product_id']); } @@ -780,7 +780,7 @@ public function testSelectWhereArray() $select = $this->_selectWhereArray(); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals(3, count($result)); + $this->assertCount(3, $result); } /** @@ -803,7 +803,7 @@ public function testSelectWhereAnd() $select = $this->_selectWhereAnd(); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals(0, count($result)); + $this->assertCount(0, $result); } /** @@ -825,7 +825,7 @@ public function testSelectWhereWithParameter() $select = $this->_selectWhereWithParameter(); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals(1, count($result)); + $this->assertCount(1, $result); $this->assertEquals(2, $result[0]['product_id']); } @@ -848,7 +848,7 @@ public function testSelectWhereWithType() $select = $this->_selectWhereWithType(); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals(1, count($result)); + $this->assertCount(1, $result); $this->assertEquals(2, $result[0]['product_id']); } @@ -873,7 +873,7 @@ public function testSelectWhereWithTypeFloat() $select = $this->_selectWhereWithTypeFloat(); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals(1, count($result)); + $this->assertCount(1, $result); $this->assertEquals(200.45, $result[0]['price_total']); try { @@ -881,7 +881,7 @@ public function testSelectWhereWithTypeFloat() $select = $this->_selectWhereWithTypeFloat(); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals(1, count($result)); + $this->assertCount(1, $result); $this->assertEquals(200.45, $result[0]['price_total']); } catch (Zend_Exception $e) { setlocale(LC_ALL, $locale); @@ -910,7 +910,7 @@ public function testSelectWhereOr() $select = $this->_selectWhereOr(); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals(2, count($result)); + $this->assertCount(2, $result); $this->assertEquals(1, $result[0]['product_id']); $this->assertEquals(2, $result[1]['product_id']); } @@ -935,7 +935,7 @@ public function testSelectWhereOrWithParameter() $select = $this->_selectWhereOrWithParameter(); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals(2, count($result)); + $this->assertCount(2, $result); $this->assertEquals(1, $result[0]['product_id']); $this->assertEquals(2, $result[1]['product_id']); } @@ -959,9 +959,9 @@ public function testSelectGroupBy() $select = $this->_selectGroupBy(); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals( + $this->assertCount( 3, - count($result), + $result, 'Expected count of first result set to be 2' ); $this->assertEquals(1, $result[0]['bug_id']); @@ -994,9 +994,9 @@ public function testSelectGroupByQualified() $select = $this->_selectGroupByQualified(); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals( + $this->assertCount( 3, - count($result), + $result, 'Expected count of first result set to be 2' ); $this->assertEquals(1, $result[0]['bug_id']); @@ -1030,9 +1030,9 @@ public function testSelectGroupByExpr() $select = $this->_selectGroupByExpr(); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals( + $this->assertCount( 3, - count($result), + $result, 'Expected count of first result set to be 2' ); $this->assertEquals( @@ -1082,7 +1082,7 @@ public function testSelectGroupByAutoExpr() $select = $this->_selectGroupByAutoExpr(); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals(3, count($result), 'Expected count of first result set to be 2'); + $this->assertCount(3, $result, 'Expected count of first result set to be 2'); $this->assertEquals(1, $result[0]['bug_id']); $this->assertEquals(3, $result[0]['thecount'], 'Expected count(*) of first result set to be 2'); $this->assertEquals(2, $result[1]['bug_id']); @@ -1107,7 +1107,7 @@ public function testSelectHaving() $select = $this->_selectHaving(); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals(2, count($result)); + $this->assertCount(2, $result); $this->assertEquals(1, $result[0]['bug_id']); $this->assertEquals(3, $result[0]['thecount']); } @@ -1128,7 +1128,7 @@ public function testSelectHavingAnd() $select = $this->_selectHavingAnd(); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals(0, count($result)); + $this->assertCount(0, $result); } /** @@ -1151,7 +1151,7 @@ public function testSelectHavingWithParameter() $select = $this->_selectHavingWithParameter(); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals(2, count($result)); + $this->assertCount(2, $result); $this->assertEquals(1, $result[0]['bug_id']); $this->assertEquals(3, $result[0]['thecount']); } @@ -1176,7 +1176,7 @@ public function testSelectHavingOr() $select = $this->_selectHavingOr(); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals(3, count($result)); + $this->assertCount(3, $result); $this->assertEquals(1, $result[0]['bug_id']); $this->assertEquals(3, $result[0]['thecount']); $this->assertEquals(2, $result[1]['bug_id']); @@ -1203,7 +1203,7 @@ public function testSelectHavingOrWithParameter() $select = $this->_selectHavingOrWithParameter(); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals(3, count($result)); + $this->assertCount(3, $result); $this->assertEquals(1, $result[0]['bug_id']); $this->assertEquals(3, $result[0]['thecount']); $this->assertEquals(2, $result[1]['bug_id']); @@ -1242,9 +1242,9 @@ public function testSelectOrderByArray() $select = $this->_selectOrderByArray(); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals( + $this->assertCount( 3, - count($result), + $result, 'Expected count of result set to be 3' ); $this->assertEquals('Linux', $result[0]['product_name']); @@ -1264,9 +1264,9 @@ public function testSelectOrderByAsc() $select = $this->_selectOrderByAsc(); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals( + $this->assertCount( 3, - count($result), + $result, 'Expected count of result set to be 2' ); $this->assertEquals(1, $result[0]['product_id']); @@ -1365,9 +1365,9 @@ public function testSelectOrderByDesc() $select = $this->_selectOrderByDesc(); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals( + $this->assertCount( 3, - count($result), + $result, 'Expected count of result set to be 2' ); $this->assertEquals(3, $result[0]['product_id']); @@ -1490,7 +1490,7 @@ public function testSelectLimit() $select = $this->_selectLimit(); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals(1, count($result)); + $this->assertCount(1, $result); $this->assertEquals(1, $result[0]['product_id']); $this->_checkExtraField($result[0]); } @@ -1509,7 +1509,7 @@ public function testSelectLimitFetchCol() ->limit(1); $result = $this->_db->fetchCol($select); - $this->assertEquals(1, count($result)); + $this->assertCount(1, $result); $this->assertEquals('OS X', $result[0]); $this->_checkExtraField($result); } @@ -1531,7 +1531,7 @@ public function testSelectLimitNone() $select = $this->_selectLimitNone(); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals(3, count($result)); + $this->assertCount(3, $result); $this->_checkExtraField($result[0]); } @@ -1552,7 +1552,7 @@ public function testSelectLimitOffset() $select = $this->_selectLimitOffset(); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals(1, count($result)); + $this->assertCount(1, $result); $this->assertEquals(2, $result[0]['product_id']); $this->_checkExtraField($result[0]); } @@ -1577,7 +1577,7 @@ public function testSelectLimitPageOne() $select = $this->_selectLimitPageOne(); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals(1, count($result)); + $this->assertCount(1, $result); $this->assertEquals(1, $result[0]['product_id']); $this->_checkExtraField($result[0]); } @@ -1599,7 +1599,7 @@ public function testSelectLimitPageTwo() $select = $this->_selectLimitPageTwo(); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals(1, count($result)); + $this->assertCount(1, $result); $this->assertEquals(2, $result[0]['product_id']); $this->_checkExtraField($result[0]); } @@ -1651,7 +1651,7 @@ public function testSelectUnionString() $select = $this->_selectUnionString(); $stmt = $this->_db->query($select); $result = $stmt->fetchAll(); - $this->assertEquals(7, count($result)); + $this->assertCount(7, $result); $this->assertEquals(1, $result[0]['id']); } diff --git a/tests/Zend/Db/Statement/MysqliTest.php b/tests/Zend/Db/Statement/MysqliTest.php index b957ab4..c8d0747 100644 --- a/tests/Zend/Db/Statement/MysqliTest.php +++ b/tests/Zend/Db/Statement/MysqliTest.php @@ -296,7 +296,7 @@ public function testNumberOfBoundParamsDoesNotMatchNumberOfTokens() } $result = $stmt->fetch(); $this->assertInternalType('array', $result); - $this->assertEquals(5, count($result)); + $this->assertCount(5, $result); $this->assertEquals(1, $result['object_id']); $this->assertEquals(1, $result['object_type']); $this->assertEquals(1, $result['object_status']); diff --git a/tests/Zend/Db/Statement/Pdo/MysqlTest.php b/tests/Zend/Db/Statement/Pdo/MysqlTest.php index 9f870e7..9829875 100644 --- a/tests/Zend/Db/Statement/Pdo/MysqlTest.php +++ b/tests/Zend/Db/Statement/Pdo/MysqlTest.php @@ -61,12 +61,12 @@ public function testZF2059() { $sql = "SELECT bug_id FROM zfbugs WHERE bug_status != ':0'"; $results = $this->_db->fetchAll($sql); - $this->assertEquals(4, count($results)); + $this->assertCount(4, $results); $select = $this->_db->select()->from('zfbugs', 'bug_id') ->where('bug_status != ?', ':0'); $results = $this->_db->fetchAll($select); - $this->assertEquals(4, count($results)); + $this->assertCount(4, $results); } /** diff --git a/tests/Zend/Db/Statement/SqlsrvTest.php b/tests/Zend/Db/Statement/SqlsrvTest.php index 197a549..7ae3390 100644 --- a/tests/Zend/Db/Statement/SqlsrvTest.php +++ b/tests/Zend/Db/Statement/SqlsrvTest.php @@ -126,7 +126,7 @@ public function testStatementNextRowsetWithProcedure() $result2 = $stmt->fetchAll(); - $this->assertEquals(4, count($result2), 'Expected 3 results from original data and one 1 row'); + $this->assertCount(4, $result2, 'Expected 3 results from original data and one 1 row'); $this->assertEquals('Product', $result2[3]['product_name']); $stmt->closeCursor(); @@ -154,7 +154,7 @@ public function testStatementWithProcedure() $result1 = $stmt->fetchAll(); - $this->assertEquals(3, count($result1), 'Expected 3 results from original data'); + $this->assertCount(3, $result1, 'Expected 3 results from original data'); $stmt->closeCursor(); } @@ -179,7 +179,7 @@ public function testStatementErrorInfo() $this->assertEquals(-11, $stmt->errorCode()); $errors = $stmt->errorInfo(); - $this->assertEquals(2, count($errors)); + $this->assertCount(2, $errors); $this->assertEquals($stmt->errorCode(), $errors[0]); $this->assertInternalType('string', $errors[1]); } diff --git a/tests/Zend/Db/Statement/TestCommon.php b/tests/Zend/Db/Statement/TestCommon.php index 7be37f1..7f57f52 100644 --- a/tests/Zend/Db/Statement/TestCommon.php +++ b/tests/Zend/Db/Statement/TestCommon.php @@ -233,8 +233,8 @@ public function testStatementSetFetchModeAssoc() $stmt->setFetchMode(Zend_Db::FETCH_ASSOC); $result = $stmt->fetchAll(); - $this->assertEquals(2, count($result)); - $this->assertEquals(2, count($result[0])); + $this->assertCount(2, $result); + $this->assertCount(2, $result[0]); // check for FETCH_ASSOC entries $this->assertEquals(2, $result[0]['product_id']); @@ -257,8 +257,8 @@ public function testStatementSetFetchModeNum() $stmt->setFetchMode(Zend_Db::FETCH_NUM); $result = $stmt->fetchAll(); - $this->assertEquals(2, count($result)); - $this->assertEquals(2, count($result[0])); + $this->assertCount(2, $result); + $this->assertCount(2, $result[0]); // check for FETCH_ASSOC entries $this->assertFalse(isset($result[0]['product_id'])); @@ -281,8 +281,8 @@ public function testStatementSetFetchModeBoth() $stmt->setFetchMode(Zend_Db::FETCH_BOTH); $result = $stmt->fetchAll(); - $this->assertEquals(2, count($result)); - $this->assertEquals(4, count($result[0])); + $this->assertCount(2, $result); + $this->assertCount(4, $result[0]); // check for FETCH_ASSOC entries $this->assertEquals(2, $result[0]['product_id']); @@ -305,7 +305,7 @@ public function testStatementSetFetchModeObj() $stmt->setFetchMode(Zend_Db::FETCH_OBJ); $result = $stmt->fetchAll(); - $this->assertEquals(2, count($result)); + $this->assertCount(2, $result); $this->assertTrue($result[0] instanceof stdClass); // check for FETCH_OBJ entries @@ -340,8 +340,8 @@ public function testStatementFetchAll() $stmt = $this->_db->query("SELECT * FROM $products WHERE $product_id > 1 ORDER BY $product_id ASC"); $result = $stmt->fetchAll(); - $this->assertEquals(2, count($result)); - $this->assertEquals(2, count($result[0])); + $this->assertCount(2, $result); + $this->assertCount(2, $result[0]); $this->assertEquals(2, $result[0]['product_id']); $this->assertFalse(isset($result[0][0])); } @@ -354,8 +354,8 @@ public function testStatementFetchAllStyleNum() $stmt = $this->_db->query("SELECT * FROM $products WHERE $product_id > 1 ORDER BY $product_id ASC"); $result = $stmt->fetchAll(Zend_Db::FETCH_NUM); - $this->assertEquals(2, count($result)); - $this->assertEquals(2, count($result[0])); + $this->assertCount(2, $result); + $this->assertCount(2, $result[0]); $this->assertEquals(2, $result[0][0]); $this->assertEquals('Linux', $result[0][1]); $this->assertFalse(isset($result[0]['product_id'])); @@ -369,8 +369,8 @@ public function testStatementFetchAllStyleAssoc() $stmt = $this->_db->query("SELECT * FROM $products WHERE $product_id > 1 ORDER BY $product_id ASC"); $result = $stmt->fetchAll(Zend_Db::FETCH_ASSOC); - $this->assertEquals(2, count($result)); - $this->assertEquals(2, count($result[0])); + $this->assertCount(2, $result); + $this->assertCount(2, $result[0]); $this->assertEquals(2, $result[0]['product_id']); $this->assertFalse(isset($result[0][0])); } @@ -383,8 +383,8 @@ public function testStatementFetchAllStyleBoth() $stmt = $this->_db->query("SELECT * FROM $products WHERE $product_id > 1 ORDER BY $product_id ASC"); $result = $stmt->fetchAll(Zend_Db::FETCH_BOTH); - $this->assertEquals(2, count($result)); - $this->assertEquals(4, count($result[0])); + $this->assertCount(2, $result); + $this->assertCount(4, $result[0]); $this->assertEquals(2, $result[0][0]); $this->assertEquals('Linux', $result[0][1]); $this->assertEquals(2, $result[0]['product_id']); @@ -399,7 +399,7 @@ public function testStatementFetchAllStyleObj() $stmt = $this->_db->query("SELECT * FROM $products WHERE $product_id > 1 ORDER BY $product_id ASC"); $result = $stmt->fetchAll(Zend_Db::FETCH_OBJ); - $this->assertEquals(2, count($result)); + $this->assertCount(2, $result); $this->assertTrue($result[0] instanceof stdClass); $this->assertEquals(2, $result[0]->product_id); } @@ -412,7 +412,7 @@ public function testStatementFetchAllStyleColumn() $stmt = $this->_db->query("SELECT * FROM $products WHERE $product_id > 1 ORDER BY $product_id ASC"); $result = $stmt->fetchAll(Zend_Db::FETCH_COLUMN); - $this->assertEquals(2, count($result)); + $this->assertCount(2, $result); $this->assertEquals(2, $result[0]); $this->assertEquals(3, $result[1]); } @@ -425,7 +425,7 @@ public function testStatementFetchAllStyleColumnWithArg() $stmt = $this->_db->query("SELECT * FROM $products WHERE $product_id > 1 ORDER BY $product_id ASC"); $result = $stmt->fetchAll(Zend_Db::FETCH_COLUMN, 1); - $this->assertEquals(2, count($result)); + $this->assertCount(2, $result); $this->assertInternalType('string', $result[0]); $this->assertEquals('Linux', $result[0]); $this->assertEquals('OS X', $result[1]); diff --git a/tests/Zend/Db/Table/Pdo/PgsqlTest.php b/tests/Zend/Db/Table/Pdo/PgsqlTest.php index 42dc06f..c927e08 100644 --- a/tests/Zend/Db/Table/Pdo/PgsqlTest.php +++ b/tests/Zend/Db/Table/Pdo/PgsqlTest.php @@ -197,9 +197,9 @@ public function testTableFetchAllSchemaSet() $this->isInstanceOf('Zend_Db_Table_Rowset') ); - $this->assertEquals( + $this->assertCount( 4, - count($rowset) + $rowset ); } } diff --git a/tests/Zend/Db/Table/Relationships/TestCommon.php b/tests/Zend/Db/Table/Relationships/TestCommon.php index 1c3abb8..4f35868 100644 --- a/tests/Zend/Db/Table/Relationships/TestCommon.php +++ b/tests/Zend/Db/Table/Relationships/TestCommon.php @@ -494,9 +494,9 @@ public function testTableRelationshipCascadingUpdateUsageBasicString() ->current(); $bug_id = $this->_db->foldCase('bug_id'); - $this->assertEquals( + $this->assertCount( 3, - count($bugProducts = $bug->findDependentRowset('My_ZendDbTable_TableBugsProductsCustom')), + $bugProducts = $bug->findDependentRowset('My_ZendDbTable_TableBugsProductsCustom'), 'Expecting to find three dependent rows' ); @@ -504,9 +504,9 @@ public function testTableRelationshipCascadingUpdateUsageBasicString() $bug->save(); - $this->assertEquals( + $this->assertCount( 3, - count($bugProducts = $bug->findDependentRowset('My_ZendDbTable_TableBugsProductsCustom')), + $bugProducts = $bug->findDependentRowset('My_ZendDbTable_TableBugsProductsCustom'), 'Expecting to find three dependent rows' ); @@ -518,9 +518,9 @@ public function testTableRelationshipCascadingUpdateUsageBasicString() $bug->save(); - $this->assertEquals( + $this->assertCount( 3, - count($bugProducts = $bug->findDependentRowset('My_ZendDbTable_TableBugsProductsCustom')), + $bugProducts = $bug->findDependentRowset('My_ZendDbTable_TableBugsProductsCustom'), 'Expecting to find three dependent rows' ); @@ -542,9 +542,9 @@ public function testTableRelationshipCascadingUpdateUsageBasicArray() $account_name = $this->_db->foldCase('account_name'); $reported_by = $this->_db->foldCase('reported_by'); - $this->assertEquals( + $this->assertCount( 1, - count($account1->findDependentRowset('My_ZendDbTable_TableBugsCustom')), + $account1->findDependentRowset('My_ZendDbTable_TableBugsCustom'), 'Expecting to find one dependent row' ); @@ -552,9 +552,9 @@ public function testTableRelationshipCascadingUpdateUsageBasicArray() $account1->save(); - $this->assertEquals( + $this->assertCount( 1, - count($account1Bugs = $account1->findDependentRowset('My_ZendDbTable_TableBugsCustom')), + $account1Bugs = $account1->findDependentRowset('My_ZendDbTable_TableBugsCustom'), 'Expecting to find one dependent row' ); @@ -566,9 +566,9 @@ public function testTableRelationshipCascadingUpdateUsageBasicArray() $account1->save(); - $this->assertEquals( + $this->assertCount( 1, - count($account1Bugs = $account1->findDependentRowset('My_ZendDbTable_TableBugsCustom')), + $account1Bugs = $account1->findDependentRowset('My_ZendDbTable_TableBugsCustom'), 'Expecting to find one dependent row' ); @@ -588,9 +588,9 @@ public function testTableRelationshipCascadingUpdateUsageInvalidNoop() ->find(1) ->current(); - $this->assertEquals( + $this->assertCount( 1, - count($product1->findDependentRowset('My_ZendDbTable_TableBugsProductsCustom')), + $product1->findDependentRowset('My_ZendDbTable_TableBugsProductsCustom'), 'Expecting to find one dependent row' ); @@ -599,9 +599,9 @@ public function testTableRelationshipCascadingUpdateUsageInvalidNoop() $product1->save(); - $this->assertEquals( + $this->assertCount( 0, - count($product1BugsProducts = $product1->findDependentRowset('My_ZendDbTable_TableBugsProductsCustom')), + $product1BugsProducts = $product1->findDependentRowset('My_ZendDbTable_TableBugsProductsCustom'), 'Expecting to find one dependent row' ); @@ -609,9 +609,9 @@ public function testTableRelationshipCascadingUpdateUsageInvalidNoop() $product1->save(); - $this->assertEquals( + $this->assertCount( 1, - count($product1BugsProducts = $product1->findDependentRowset('My_ZendDbTable_TableBugsProductsCustom')), + $product1BugsProducts = $product1->findDependentRowset('My_ZendDbTable_TableBugsProductsCustom'), 'Expecting to find one dependent row' ); @@ -631,9 +631,9 @@ public function testTableRelationshipCascadingDeleteUsageBasicString() ->find(1) ->current(); - $this->assertEquals( + $this->assertCount( 3, - count($bug1->findDependentRowset('My_ZendDbTable_TableBugsProductsCustom')), + $bug1->findDependentRowset('My_ZendDbTable_TableBugsProductsCustom'), 'Expecting to find three dependent rows' ); @@ -641,9 +641,9 @@ public function testTableRelationshipCascadingDeleteUsageBasicString() $bug_id = $this->_db->quoteIdentifier('bug_id', true); - $this->assertEquals( + $this->assertCount( 0, - count($this->_getTable('My_ZendDbTable_TableBugsProductsCustom')->fetchAll("$bug_id = 1")), + $this->_getTable('My_ZendDbTable_TableBugsProductsCustom')->fetchAll("$bug_id = 1"), 'Expecting cascading delete to have reduced dependent rows to zero' ); } @@ -661,9 +661,9 @@ public function testTableRelationshipCascadingDeleteUsageBasicArray() ->find('mmouse') ->current(); - $this->assertEquals( + $this->assertCount( 1, - count($account1->findDependentRowset('My_ZendDbTable_TableBugsCustom')), + $account1->findDependentRowset('My_ZendDbTable_TableBugsCustom'), 'Expecting to find one dependent row' ); @@ -671,14 +671,13 @@ public function testTableRelationshipCascadingDeleteUsageBasicArray() $tableBugsCustom = $this->_getTable('My_ZendDbTable_TableBugsCustom'); - $this->assertEquals( + $this->assertCount( 0, - count( + $tableBugsCustom->fetchAll( $tableBugsCustom->getAdapter() ->quoteInto("$reported_by = ?", 'mmouse') - ) - ), + ), 'Expecting cascading delete to have reduced dependent rows to zero' ); } @@ -694,9 +693,9 @@ public function testTableRelationshipCascadingDeleteUsageInvalidNoop() ->find(1) ->current(); - $this->assertEquals( + $this->assertCount( 1, - count($product1->findDependentRowset('My_ZendDbTable_TableBugsProductsCustom')), + $product1->findDependentRowset('My_ZendDbTable_TableBugsProductsCustom'), 'Expecting to find one dependent row' ); @@ -704,9 +703,9 @@ public function testTableRelationshipCascadingDeleteUsageInvalidNoop() $product_id = $this->_db->quoteIdentifier('product_id', true); - $this->assertEquals( + $this->assertCount( 1, - count($this->_getTable('My_ZendDbTable_TableBugsProductsCustom')->fetchAll("$product_id = 1")), + $this->_getTable('My_ZendDbTable_TableBugsProductsCustom')->fetchAll("$product_id = 1"), 'Expecting to find one dependent row' ); } @@ -840,7 +839,7 @@ public function testTableRelationshipFindDependentRowsetCustomInstance() "Expecting object of type $myRowsetClass, got " . get_class($bugs) ); - $this->assertEquals(3, count($bugs)); + $this->assertCount(3, $bugs); foreach ($bugs as $bug) { $this->assertTrue( @@ -876,7 +875,7 @@ public function testTableRelationshipFindDependentRowsetCustomClass() "Expecting object of type $myRowsetClass, got " . get_class($bugs) ); - $this->assertEquals(3, count($bugs)); + $this->assertCount(3, $bugs); foreach ($bugs as $bug) { $this->assertTrue( @@ -916,7 +915,7 @@ public function testTableRelationshipFindManyToManyRowsetCustomInstance() "Expecting object of type $myRowsetClass, got " . get_class($bug1Products) ); - $this->assertEquals(3, count($bug1Products)); + $this->assertCount(3, $bug1Products); foreach ($bug1Products as $bug1Product) { $this->assertTrue( @@ -954,7 +953,7 @@ public function testTableRelationshipFindManyToManyRowsetCustomClass() "Expecting object of type $myRowsetClass, got " . get_class($bug1Products) ); - $this->assertEquals(3, count($bug1Products)); + $this->assertCount(3, $bug1Products); foreach ($bug1Products as $bug1Product) { $this->assertTrue( @@ -1223,7 +1222,7 @@ public function testTableRelationshipCanFindDependentRowsetViaConcreteInstantiat $this->assertEquals('Windows', $productRow->product_name); - $this->assertEquals(1, count($productRow->findDependentRowset('BugsProducts', 'Product'))); + $this->assertCount(1, $productRow->findDependentRowset('BugsProducts', 'Product')); $bugsProductRow = $productRow->findDependentRowset('BugsProducts', 'Product')->current(); $this->assertEquals(1, $bugsProductRow->product_id); diff --git a/tests/Zend/Db/Table/Row/TestCommon.php b/tests/Zend/Db/Table/Row/TestCommon.php index 9b5379b..cbb1954 100644 --- a/tests/Zend/Db/Table/Row/TestCommon.php +++ b/tests/Zend/Db/Table/Row/TestCommon.php @@ -83,7 +83,7 @@ public function testTableFindRow() $rowset instanceof Zend_Db_Table_Rowset_Abstract, 'Expecting object of type Zend_Db_Table_Rowset_Abstract, got ' . get_class($rowset) ); - $this->assertEquals(1, count($rowset)); + $this->assertCount(1, $rowset); } public function testTableRowConstructor() diff --git a/tests/Zend/Db/Table/Rowset/TestCommon.php b/tests/Zend/Db/Table/Rowset/TestCommon.php index 2d7451a..a1a2a90 100644 --- a/tests/Zend/Db/Table/Rowset/TestCommon.php +++ b/tests/Zend/Db/Table/Rowset/TestCommon.php @@ -155,7 +155,7 @@ public function testTableRowsetEmpty() $table = $this->_table['bugs']; $rows = $table->fetchAll("$bug_id = -1"); - $this->assertEquals(0, count($rows)); + $this->assertCount(0, $rows); $this->assertNull($rows->current()); } @@ -165,7 +165,7 @@ public function testTableRowsetToArray() $bug_description = $this->_db->foldCase('bug_description'); $rows = $table->find(array(1, 2)); - $this->assertEquals(2, count($rows)); + $this->assertCount(2, $rows); // iterate through the rowset, because that's the only way // to force it to instantiate the individual Rows @@ -178,7 +178,7 @@ public function testTableRowsetToArray() $this->assertInternalType('array', $a); $this->assertEquals(count($a), count($rows)); $this->assertInternalType('array', $a[0]); - $this->assertEquals(8, count($a[0])); + $this->assertCount(8, $a[0]); $this->assertEquals('foo', $a[0][$bug_description]); } diff --git a/tests/Zend/Db/Table/Select/Pdo/PgsqlTest.php b/tests/Zend/Db/Table/Select/Pdo/PgsqlTest.php index 2b9e114..b12fbf3 100644 --- a/tests/Zend/Db/Table/Select/Pdo/PgsqlTest.php +++ b/tests/Zend/Db/Table/Select/Pdo/PgsqlTest.php @@ -64,7 +64,7 @@ public function testSelectFromSchemaSpecified() $rowset = $this->_db->fetchAll($sql); - $this->assertEquals(4, count($rowset)); + $this->assertCount(4, $rowset); } /** @@ -85,7 +85,7 @@ public function testSelectFromSchemaInName() $rowset = $this->_db->fetchAll($sql); - $this->assertEquals(4, count($rowset)); + $this->assertCount(4, $rowset); } /** @@ -106,7 +106,7 @@ public function testSelectFromSchemaInNameOverridesSchemaArgument() $rowset = $this->_db->fetchAll($sql); - $this->assertEquals(4, count($rowset)); + $this->assertCount(4, $rowset); } /** diff --git a/tests/Zend/Db/Table/Select/Pdo/SqliteTest.php b/tests/Zend/Db/Table/Select/Pdo/SqliteTest.php index 1be4214..1343fb5 100644 --- a/tests/Zend/Db/Table/Select/Pdo/SqliteTest.php +++ b/tests/Zend/Db/Table/Select/Pdo/SqliteTest.php @@ -65,9 +65,9 @@ public function testSelectGroupBy() $bugs_products = $this->_db->quoteIdentifier('zfbugs_products'); $bug_id = $this->_db->quoteIdentifier('bug_id'); $key = "$bugs_products.$bug_id"; - $this->assertEquals( + $this->assertCount( 3, - count($result), + $result, 'Expected count of first result set to be 2' ); $this->assertEquals(1, $result[0][$key]); @@ -92,9 +92,9 @@ public function testSelectGroupByQualified() $bugs_products = $this->_db->quoteIdentifier('zfbugs_products'); $bug_id = $this->_db->quoteIdentifier('bug_id'); $key = "$bugs_products.$bug_id"; - $this->assertEquals( + $this->assertCount( 3, - count($result), + $result, 'Expected count of first result set to be 2' ); $this->assertEquals(1, $result[0][$key]); @@ -119,7 +119,7 @@ public function testSelectHaving() $bugs_products = $this->_db->quoteIdentifier('zfbugs_products'); $bug_id = $this->_db->quoteIdentifier('bug_id'); $key = "$bugs_products.$bug_id"; - $this->assertEquals(2, count($result)); + $this->assertCount(2, $result); $this->assertEquals(1, $result[0][$key]); $this->assertEquals(3, $result[0]['thecount']); } @@ -136,7 +136,7 @@ public function testSelectHavingWithParameter() $bugs_products = $this->_db->quoteIdentifier('zfbugs_products'); $bug_id = $this->_db->quoteIdentifier('bug_id'); $key = "$bugs_products.$bug_id"; - $this->assertEquals(2, count($result)); + $this->assertCount(2, $result); $this->assertEquals(1, $result[0][$key]); $this->assertEquals(3, $result[0]['thecount']); } @@ -153,7 +153,7 @@ public function testSelectHavingOr() $bugs_products = $this->_db->quoteIdentifier('zfbugs_products'); $bug_id = $this->_db->quoteIdentifier('bug_id'); $key = "$bugs_products.$bug_id"; - $this->assertEquals(3, count($result)); + $this->assertCount(3, $result); $this->assertEquals(1, $result[0][$key]); $this->assertEquals(3, $result[0]['thecount']); $this->assertEquals(2, $result[1][$key]); @@ -172,7 +172,7 @@ public function testSelectHavingOrWithParameter() $bugs_products = $this->_db->quoteIdentifier('zfbugs_products'); $bug_id = $this->_db->quoteIdentifier('bug_id'); $key = "$bugs_products.$bug_id"; - $this->assertEquals(3, count($result)); + $this->assertCount(3, $result); $this->assertEquals(1, $result[0][$key]); $this->assertEquals(3, $result[0]['thecount']); $this->assertEquals(2, $result[1][$key]); diff --git a/tests/Zend/Db/Table/Select/TestCommon.php b/tests/Zend/Db/Table/Select/TestCommon.php index 3fa9f0b..4353d02 100644 --- a/tests/Zend/Db/Table/Select/TestCommon.php +++ b/tests/Zend/Db/Table/Select/TestCommon.php @@ -220,12 +220,12 @@ public function testTableWillReturnSelectObjectWithFromPart() { $table = $this->_getSelectTable('accounts'); $select1 = $table->select(); - $this->assertEquals(0, count($select1->getPart(Zend_Db_Table_Select::FROM))); - $this->assertEquals(0, count($select1->getPart(Zend_Db_Table_Select::COLUMNS))); + $this->assertCount(0, $select1->getPart(Zend_Db_Table_Select::FROM)); + $this->assertCount(0, $select1->getPart(Zend_Db_Table_Select::COLUMNS)); $select2 = $table->select(true); - $this->assertEquals(1, count($select2->getPart(Zend_Db_Table_Select::FROM))); - $this->assertEquals(1, count($select2->getPart(Zend_Db_Table_Select::COLUMNS))); + $this->assertCount(1, $select2->getPart(Zend_Db_Table_Select::FROM)); + $this->assertCount(1, $select2->getPart(Zend_Db_Table_Select::COLUMNS)); $this->assertEquals($select1->__toString(), $select2->__toString()); diff --git a/tests/Zend/Db/Table/TestCommon.php b/tests/Zend/Db/Table/TestCommon.php index f2d9c3e..cc6833d 100644 --- a/tests/Zend/Db/Table/TestCommon.php +++ b/tests/Zend/Db/Table/TestCommon.php @@ -129,7 +129,7 @@ public function testTableInfo() $this->assertEquals('zfbugs', $info['name']); - $this->assertEquals(8, count($info['cols'])); + $this->assertCount(8, $info['cols']); $cols = array( 'bug_id', 'bug_description', @@ -142,7 +142,7 @@ public function testTableInfo() ); $this->assertEquals($cols, $info['cols']); - $this->assertEquals(1, count($info['primary'])); + $this->assertCount(1, $info['primary']); $pk = array('bug_id'); $this->assertEquals($pk, array_values($info['primary'])); @@ -584,7 +584,7 @@ public function testTableFindSingleRow() $rowset instanceof Zend_Db_Table_Rowset_Abstract, 'Expecting object of type Zend_Db_Table_Rowset_Abstract, got ' . get_class($rowset) ); - $this->assertEquals(1, count($rowset)); + $this->assertCount(1, $rowset); } public function testTableFindMultipleRows() @@ -595,7 +595,7 @@ public function testTableFindMultipleRows() $rowset instanceof Zend_Db_Table_Rowset_Abstract, 'Expecting object of type Zend_Db_Table_Rowset_Abstract, got ' . get_class($rowset) ); - $this->assertEquals(2, count($rowset)); + $this->assertCount(2, $rowset); } public function testTableFindExceptionTooFewKeys() @@ -636,7 +636,7 @@ public function testTableFindCompoundSingleRow() $rowset instanceof Zend_Db_Table_Rowset_Abstract, 'Expecting object of type Zend_Db_Table_Rowset_Abstract, got ' . get_class($rowset) ); - $this->assertEquals(1, count($rowset)); + $this->assertCount(1, $rowset); } public function testTableFindCompoundMultipleRows() @@ -647,7 +647,7 @@ public function testTableFindCompoundMultipleRows() $rowset instanceof Zend_Db_Table_Rowset_Abstract, 'Expecting object of type Zend_Db_Table_Rowset_Abstract, got ' . get_class($rowset) ); - $this->assertEquals(2, count($rowset)); + $this->assertCount(2, $rowset); } public function testTableFindCompoundMultipleExceptionIncorrectValueCount() @@ -676,7 +676,7 @@ public function testTableFindMultipleRowsWithKeys() $rowset instanceof Zend_Db_Table_Rowset_Abstract, 'Expecting object of type Zend_Db_Table_Rowset_Abstract, got ' . get_class($rowset) ); - $this->assertEquals(3, count($rowset)); + $this->assertCount(3, $rowset); } /** @@ -691,7 +691,7 @@ public function testTableFindWithEmptyArray() $rowset instanceof Zend_Db_Table_Rowset_Abstract, 'Expecting object of type Zend_Db_Table_Rowset_Abstract, got ' . get_class($rowset) ); - $this->assertEquals(0, count($rowset)); + $this->assertCount(0, $rowset); } public function testTableInsert() @@ -792,7 +792,7 @@ public function testTableInsertNaturalCompound() ); $primary = $table->insert($row); $this->assertInternalType('array', $primary); - $this->assertEquals(2, count($primary)); + $this->assertCount(2, $primary); $this->assertEquals(array(2, 1), array_values($primary)); } @@ -939,7 +939,7 @@ public function testTableUpdate() $rowset instanceof Zend_Db_Table_Rowset_Abstract, 'Expecting object of type Zend_Db_Table_Rowset_Abstract, got ' . get_class($rowset) ); - $this->assertEquals(1, count($rowset), 'Expecting rowset count to be 1'); + $this->assertCount(1, $rowset, 'Expecting rowset count to be 1'); $row = $rowset->current(); $this->assertTrue( $row instanceof Zend_Db_Table_Row_Abstract, @@ -1012,12 +1012,12 @@ public function testTableDelete() $table = $this->_table['bugs']; $rowset = $table->find(array(1, 2)); - $this->assertEquals(2, count($rowset)); + $this->assertCount(2, $rowset); $table->delete("$bug_id = 2"); $rowset = $table->find(array(1, 2)); - $this->assertEquals(1, count($rowset)); + $this->assertCount(1, $rowset); } public function testTableDeleteWithSchema() @@ -1053,7 +1053,7 @@ public function testTableDeleteWhereArray() $this->assertEquals(2, $this->_table['bugs']->delete($where)); - $this->assertEquals(0, count($this->_table['bugs']->find(array(1, 3)))); + $this->assertCount(0, $this->_table['bugs']->find(array(1, 3))); } public function testTableCreateRow() @@ -1275,7 +1275,7 @@ public function testTableFetchAll() $rowset instanceof Zend_Db_Table_Rowset_Abstract, 'Expecting object of type Zend_Db_Table_Rowset_Abstract, got ' . get_class($rowset) ); - $this->assertEquals(4, count($rowset)); + $this->assertCount(4, $rowset); $row1 = $rowset->current(); $this->assertTrue( $row1 instanceof Zend_Db_Table_Row_Abstract, @@ -1294,7 +1294,7 @@ public function testTableFetchAllWhere() $rowset instanceof Zend_Db_Table_Rowset_Abstract, 'Expecting object of type Zend_Db_Table_Rowset_Abstract, got ' . get_class($rowset) ); - $this->assertEquals(1, count($rowset)); + $this->assertCount(1, $rowset); $row1 = $rowset->current(); $this->assertTrue( $row1 instanceof Zend_Db_Table_Row_Abstract, @@ -1317,7 +1317,7 @@ public function testTableFetchAllWhereSelect() $rowset instanceof Zend_Db_Table_Rowset_Abstract, 'Expecting object of type Zend_Db_Table_Rowset_Abstract, got ' . get_class($rowset) ); - $this->assertEquals(1, count($rowset)); + $this->assertCount(1, $rowset); $row1 = $rowset->current(); $this->assertTrue( $row1 instanceof Zend_Db_Table_Row_Abstract, @@ -1335,7 +1335,7 @@ public function testTableFetchAllOrder() $rowset instanceof Zend_Db_Table_Rowset_Abstract, 'Expecting object of type Zend_Db_Table_Rowset_Abstract, got ' . get_class($rowset) ); - $this->assertEquals(4, count($rowset)); + $this->assertCount(4, $rowset); $row1 = $rowset->current(); $this->assertTrue( $row1 instanceof Zend_Db_Table_Row_Abstract, @@ -1356,7 +1356,7 @@ public function testTableFetchAllOrderSelect() $rowset instanceof Zend_Db_Table_Rowset_Abstract, 'Expecting object of type Zend_Db_Table_Rowset_Abstract, got ' . get_class($rowset) ); - $this->assertEquals(4, count($rowset)); + $this->assertCount(4, $rowset); $row1 = $rowset->current(); $this->assertTrue( $row1 instanceof Zend_Db_Table_Row_Abstract, @@ -1377,7 +1377,7 @@ public function testTableFetchAllOrderExpr() $rowset instanceof Zend_Db_Table_Rowset, 'Expecting object of type Zend_Db_Table_Rowset, got ' . get_class($rowset) ); - $this->assertEquals(4, count($rowset)); + $this->assertCount(4, $rowset); $row1 = $rowset->current(); $this->assertTrue( $row1 instanceof Zend_Db_Table_Row, @@ -1395,7 +1395,7 @@ public function testTableFetchAllLimit() $rowset instanceof Zend_Db_Table_Rowset, 'Expecting object of type Zend_Db_Table_Rowset, got ' . get_class($rowset) ); - $this->assertEquals(2, count($rowset)); + $this->assertCount(2, $rowset); $row1 = $rowset->current(); $this->assertTrue( $row1 instanceof Zend_Db_Table_Row, @@ -1417,7 +1417,7 @@ public function testTableFetchAllLimitSelect() $rowset instanceof Zend_Db_Table_Rowset, 'Expecting object of type Zend_Db_Table_Rowset, got ' . get_class($rowset) ); - $this->assertEquals(2, count($rowset)); + $this->assertCount(2, $rowset); $row1 = $rowset->current(); $this->assertTrue( $row1 instanceof Zend_Db_Table_Row, @@ -1434,7 +1434,7 @@ public function testTableFetchAllEmpty() $table = $this->_table['bugs']; $rowset = $table->fetchAll("$bug_id = -1"); - $this->assertEquals(0, count($rowset)); + $this->assertCount(0, $rowset); } public function testTableLoadsCustomRowClass() @@ -1735,7 +1735,7 @@ public function testTableCascadeDelete() ->where($product_id . ' = ?', 2); $rows = $table->fetchAll($select); - $this->assertEquals(0, count($rows)); + $this->assertCount(0, $rows); } /** @@ -1750,7 +1750,7 @@ public function testTableCascadeRecurseDelete() $this->assertTrue($parentRow instanceof Zend_Db_Table_Row); $childRows = $parentRow->findDependentRowset('My_ZendDbTable_TableCascadeRecursive', 'Children'); $this->assertTrue($childRows instanceof Zend_Db_Table_Rowset); - $this->assertEquals(2, count($childRows)); + $this->assertCount(2, $childRows); foreach ($childRows as $childRow) { $this->assertTrue($childRow instanceof Zend_Db_Table_Row); $subChildRows = $childRow->findDependentRowset('My_ZendDbTable_TableCascadeRecursive', 'Children'); @@ -1783,7 +1783,7 @@ public function testTableCascadeRecurseDeleteUsingTableDeleteMethod() $this->assertTrue($parentRow instanceof Zend_Db_Table_Row); $childRows = $parentRow->findDependentRowset('My_ZendDbTable_TableCascadeRecursive', 'Children'); $this->assertTrue($childRows instanceof Zend_Db_Table_Rowset); - $this->assertEquals(2, count($childRows)); + $this->assertCount(2, $childRows); foreach ($childRows as $childRow) { $this->assertTrue($childRow instanceof Zend_Db_Table_Row); $subChildRows = $childRow->findDependentRowset('My_ZendDbTable_TableCascadeRecursive', 'Children'); @@ -1819,7 +1819,7 @@ public function testTableFetchallCanHandleWhereWithParameritizationCharacters() $table = $this->_table['products']; $where = $table->getAdapter()->quoteInto("$product_name = ?", "some?product's"); $rows = $table->fetchAll($where); - $this->assertEquals(0, count($rows)); + $this->assertCount(0, $rows); } /** @@ -1831,7 +1831,7 @@ public function testTableConcreteInstantiation() $table = new Zend_Db_Table('zfbugs'); $rowset = $table->find(1); - $this->assertEquals(1, count($rowset)); + $this->assertCount(1, $rowset); Zend_Db_Table::setDefaultAdapter(); @@ -1840,7 +1840,7 @@ public function testTableConcreteInstantiation() 'db' => $this->_db )); $rowset = $table->find(1); - $this->assertEquals(1, count($rowset)); + $this->assertCount(1, $rowset); } @@ -1917,7 +1917,7 @@ public function testTableAndIdentityWithVeryLongName() $row = $table->createRow($this->_getRowForTableAndIdentityWithVeryLongName()); $row->save(); $rowset = $table->find(1); - $this->assertEquals(1, count($rowset)); + $this->assertCount(1, $rowset); $this->_util->dropTable('thisisaveryverylongtablename'); }