Tests/Unit/Import/ImportHelperTest.php
/**
     * Tests getStatement logic of ImportHelper static class.
     */
Tests getStatement logic of ImportHelper static class.
Tests getStatement logic of ImportHelper static class .
public function testImportHelperGetStatement()
    {
        $testParameters = [ 'parameterA' => 'valueA', 'parameterB' => 'valueB' ];
        $mockStatement = $this->getMockBuilder('Doctrine\DBAL\Statement')
            ->disableOriginalConstructor()
            ->setMethods(['bindValue', 'setFetchMode', 'execute'])
            ->getMock();
        $mockStatement->expects($this->exactly(2))->method('bindValue')->withAnyParameters()->willReturn(null);
        $mockStatement->expects($this->once())->method('setFetchMode')->withAnyParameters()->willReturn(null);
        $mockStatement->expects($this->once())->method('execute');
        $mockConnection = $this->getMockBuilder('Doctrine\DBAL\Connection')
            ->disableOriginalConstructor()
            ->setMethods(['prepare'])
            ->getMock();
        $mockConnection->expects($this->once())->method('prepare')->with('Test')->willReturn($mockStatement);
        $out = ImportHelper::getStatement($mockConnection, 'Test', $testParameters);
        $this->assertEquals($out, $mockStatement);
    }
public function testImportHelperGetStatement ( ) { $ testParameters = [ 'parameterA' => 'valueA' , 'parameterB' => 'valueB' ] ; $ mockStatement = $ this -> getMockBuilder ( 'Doctrine\DBAL\Statement' ) -> disableOriginalConstructor ( ) -> setMethods ( [ 'bindValue' , 'setFetchMode' , 'execute' ] ) -> getMock ( ) ; $ mockStatement -> expects ( $ this -> exactly ( 2 ) ) -> method ( 'bindValue' ) -> withAnyParameters ( ) -> willReturn ( null ) ; $ mockStatement -> expects ( $ this -> once ( ) ) -> method ( 'setFetchMode' ) -> withAnyParameters ( ) -> willReturn ( null ) ; $ mockStatement -> expects ( $ this -> once ( ) ) -> method ( 'execute' ) ; $ mockConnection = $ this -> getMockBuilder ( 'Doctrine\DBAL\Connection' ) -> disableOriginalConstructor ( ) -> setMethods ( [ 'prepare' ] ) -> getMock ( ) ; $ mockConnection -> expects ( $ this -> once ( ) ) -> method ( 'prepare' ) -> with ( 'Test' ) -> willReturn ( $ mockStatement ) ; $ out = ImportHelper :: getStatement ( $ mockConnection , 'Test' , $ testParameters ) ; $ this -> assertEquals ( $ out , $ mockStatement ) ; }
Tests getStatement logic of ImportHelper static class.
Tests getStatement logic of ImportHelper static class .