tests/unit/Subjects/AbstractSubjectTest.php
/**
     * Test the getRowStoreId() method with an existing row.
     *
     * @return
     */
Test the getRowStoreId() method with an existing row.
@return
Test the getRowStoreId () method with an existing row . @return
public function testGetRowStoreIdWithRow()
    {
        $filename = 'product-import_20170706-160000_01.csv';
        $this->abstractSubject->setFilename($filename);
        $this->abstractSubject->setHeaders(array('col1' => 0, 'col2' => 1, ColumnKeys::STORE_VIEW_CODE => 2));
        $this->abstractSubject
             ->getSystemLogger()
             ->expects($this->once())
             ->method('debug')
             ->with(sprintf('Successfully processed operation "add-update" in file %s on line 1', $filename))
             ->willReturn(null);
        $this->abstractSubject->registerObserver(new PrepareStoreViewCodeObserverImpl(), 'import');
        $this->abstractSubject->importRow(array(0 => 'value1', 1 => 100, 2 => 'en_US'));
        $this->assertSame(2, $this->abstractSubject->getRowStoreId());
    }
public function testGetRowStoreIdWithRow ( ) { $ filename = 'product-import_20170706-160000_01.csv' ; $ this -> abstractSubject -> setFilename ( $ filename ) ; $ this -> abstractSubject -> setHeaders ( array ( 'col1' => 0 , 'col2' => 1 , ColumnKeys :: STORE_VIEW_CODE => 2 ) ) ; $ this -> abstractSubject -> getSystemLogger ( ) -> expects ( $ this -> once ( ) ) -> method ( 'debug' ) -> with ( sprintf ( 'Successfully processed operation "add-update" in file %s on line 1' , $ filename ) ) -> willReturn ( null ) ; $ this -> abstractSubject -> registerObserver ( new PrepareStoreViewCodeObserverImpl ( ) , 'import' ) ; $ this -> abstractSubject -> importRow ( array ( 0 => 'value1' , 1 => 100 , 2 => 'en_US' ) ) ; $ this -> assertSame ( 2 , $ this -> abstractSubject -> getRowStoreId ( ) ) ; }
Test the getRowStoreId() method with an existing row.
Test the getRowStoreId () method with an existing row .
// set the filename // set filename, headers and skip the first row // mock the system loggers debug() method // register the mock observers // start importing the row // make sure the store view code related store ID has been returned