public function testFormatNoResult() { $con = Propel::getServiceContainer()->getConnection(BookPeer::DATABASE_NAME); $stmt = $con->query('SELECT * FROM book WHERE book.TITLE = "foo"'); $formatter = new StatementFormatter(); $formatter->init(new ModelCriteria('bookstore', '\\Propel\\Tests\\Bookstore\\Book')); $books = $formatter->format($stmt); $this->assertTrue($books instanceof PDOStatement, 'StatementFormatter::format() returns a PDOStatement'); $this->assertEquals(0, $books->rowCount(), 'StatementFormatter::format() returns as many rows as the results in the query'); }
public function testFormatNoResult() { $con = Propel::getServiceContainer()->getConnection(BookTableMap::DATABASE_NAME); $stmt = $con->query("SELECT * FROM book WHERE book.TITLE = 'foo'"); $formatter = new StatementFormatter(); $formatter->init(new ModelCriteria('bookstore', '\\Propel\\Tests\\Bookstore\\Book')); $books = $formatter->format($stmt); $this->assertInstanceOf('Propel\\Runtime\\Connection\\StatementWrapper', $books->getDataObject(), 'StatementFormatter::format() returns a StatementWrapper'); $this->assertEquals(0, $books->count(), 'StatementFormatter::format() returns as many rows as the results in the query'); }