Code Duplication    Length = 18-21 lines in 2 locations

tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php 2 locations

@@ 693-713 (lines=21) @@
690
    /**
691
     * @group DBAL-196
692
     */
693
    public function testFetchAllSupportFetchClass()
694
    {
695
        $this->skipOci8AndMysqli();
696
        $this->setupFixture();
697
698
        $sql  = "SELECT test_int, test_string, test_datetime FROM fetch_table";
699
        $stmt = $this->_conn->prepare($sql);
700
        $stmt->execute();
701
702
        $results = $stmt->fetchAll(
703
            \PDO::FETCH_CLASS,
704
            __NAMESPACE__ . '\\MyFetchClass'
705
        );
706
707
        self::assertEquals(1, count($results));
708
        self::assertInstanceOf(__NAMESPACE__ . '\\MyFetchClass', $results[0]);
709
710
        self::assertEquals(1, $results[0]->test_int);
711
        self::assertEquals('foo', $results[0]->test_string);
712
        self::assertStringStartsWith('2010-01-01 10:10:10', $results[0]->test_datetime);
713
    }
714
715
    /**
716
     * @group DBAL-241
@@ 735-752 (lines=18) @@
732
    /**
733
     * @group DBAL-214
734
     */
735
    public function testSetFetchModeClassFetchAll()
736
    {
737
        $this->skipOci8AndMysqli();
738
        $this->setupFixture();
739
740
        $sql  = "SELECT * FROM fetch_table";
741
        $stmt = $this->_conn->query($sql);
742
        $stmt->setFetchMode(\PDO::FETCH_CLASS, __NAMESPACE__ . '\\MyFetchClass');
743
744
        $results = $stmt->fetchAll();
745
746
        self::assertEquals(1, count($results));
747
        self::assertInstanceOf(__NAMESPACE__ . '\\MyFetchClass', $results[0]);
748
749
        self::assertEquals(1, $results[0]->test_int);
750
        self::assertEquals('foo', $results[0]->test_string);
751
        self::assertStringStartsWith('2010-01-01 10:10:10', $results[0]->test_datetime);
752
    }
753
754
    /**
755
     * @group DBAL-214