Add Columns Map test
- All of the files are located inside: magento_root/app/code/community/RocketWeb/GoogleBaseFeedGenerator/ if not written otherwise!
- In all YAML files be extremely careful of space denotation (using two spaces)!
Setting up default columns map
Open test
Test/Model/Generator.phpand edit methodRocketWeb_GoogleBaseFeedGenerator_Test_Model_Generator::getColumnsMap()/** * @test * @loadFixture feed * @loadFixture config * @loadExpectation * @dataProvider dataProvider */ public function getColumnsMap($feedId) { // Comment out this line //$expected = $this->expected('map_%s', $feedId)->getData(); $this->setModel(); $map = $this->model->getColumnsMap(); // Add this two lines $tmp = $this->toYaml($map, ' '); $this->debug($tmp); // Comment out this line //$this->assertEquals($expected, $map, "Columns map was changed!"); }Open fixture
Test/Model/Generator/fixtures/feed.yamland add new feed:tables: rw_gfeed_feed: - id: 101 store_id: 0 name: 'PHPUnit feed' type: 'generic' status: 1 - id: 102 store_id: 0 name: 'PHPUnit feed' type: 'google_shoppings' status: 1 # Copy a section and change id & type value, id must be 100+ (101, 102, 103, ...)Open fixture
Test/Model/Generator/providers/getColumnMap.yamland add:... Existing lines ... - - 103 # Feed ID - add the ID from the previous step
Run the test with filter (phpunit --filter getColumnsMap) and this time, you will receive an output inside the console:
phpunit --filter getColumnsMap PHPUnit 4.7.6 by Sebastian Bergmann and contributors. .' id: column:id attribute:rw_gbase_directive_id param:0 order:10 title: column:title attribute:name ... MORE OUTPUT ... attribute:rw_gbase_directive_product_type_magento_category param:3 order:120 ' .Copy the whole text between two qoutes (so lines from id to the end) for the last chunk (each feed will output this chunk)
Open file
Test/Model/Generator/expectations/getColumns.yamland add:... Existing code ... map_FEED_ID: # FEED_ID is the ID from step 2 id: column:id ... The chunk copied in previous step ... attribute:rw_gbase_directive_product_type_magento_category param:3 order:120- Revert the changes in 1. step and rerun phpunit
No comments to display
No comments to display