Learn, todo and done 12-16/10/20

Learn Yii2 JavaScript, FCC CSS, FCC Clean Code, YouTube Todo - Github issue Follow up PR Add-delete-button-#457 Study Add link preview #61, Link previews #428 2.1 Start with Add the metadata schema on dataset page to allow Hypothesis to parse citation DOI #85 2.2 Then Add the metadata schema on dataset page to allow other web sites to make link previews of our web site #513 2.3 Finally Link previews #428 Follow up Update porject links via admin pages #375 ...

October 12, 2020 · 1 min · 135 words · Ken Cho

Learn, todo and done 5-9/10/20

Learn Yii2 JavaScript, FCC CSS, FCC Clean Code, YouTube Todo To start a new project Publon DOI, user story Done Merged and closed Change wip to ok #511 Follow up PR Add-delete-button-#457 2.1 Update feature file 2.2 Create EntryLog.php component class to log createNewEntry event 2.3 Try to create component services for curation log and dataset log which are not needed 2.4 To add static function in models/CurationLog.php and unit test the static function Create behat test for PR Remove-publisher-option-#507 Study Add link preview #61 Study Update porject links via admin pages #375 - Made different scenario for this feature in gist - Looked into check_duplicate Reference How to approach professional web design, referred figure Popular web layout frameworks: 2.1 Bootstrap 4.5 2.2 Foundation 6 CSS technologies 3.1 LESS 3.2 SASS/SCSS 3.3 SMACSS CSS cheat sheet ...

October 5, 2020 · 1 min · 136 words · Ken Cho

Learn, todo and done 28/9-2/10/20

Learn Yii2 JavaScript, FCC CSS, FCC Clean Code, YouTube Todo To start a new project, user story Done PR Remove publisher option in admin page #507 Comment on Update porject links via admin pages #375 Made different scenario for this feature in gist Looked into check_duplicate Studied Add link preview #61 Reference Yii2 Database migration

September 28, 2020 · 1 min · 55 words · Ken Cho

Learn, todo and done 21-24/9/20

Learn Yii2 JavaScript, FCC CSS, FCC Clean Code, YouTube Todo To start a new project, user story Done Merged PR Delete button #503 Closed and merged PR Pagination #495 Reference

September 21, 2020 · 1 min · 30 words · Ken Cho

Commands use to run gigadb

To start a local gigaDB server docker-compose run --rm webapp Link to test if the web page is up If there are some build errors Rebuild and up the webapp containers again. docker-compose run --rm webapp If not work, restart the docker container app and rebuild the containers. If not work, check if psql, gigadb, database is presented in ~/.containers/-data and remove it. rm -rf ~/.containers-data/gigadb Run docker-compose run --rm webapp again to rebuild the containers. How to remove images List all images docker images -a Remove all images docker rmi $(docker images -a -q) How to remove container List all containers docker ps -a Stop the containers docker stop $(docker ps -a -q) Remove stopped containers docker rm $(docker ps -a -q) source digital ocean How to run a functional test in a docker environment for testing? Write unit test script and place in protected/tests/functional-test folder. Change the unit_functional script ./bin/phpunit protected/tests/functional-test --verbose --configuration protected/tests/phpunit.xml --no-coverage Run specific unit test: docker-compose run --rm test ./tests/unit_functional Output will be like this: PHPUnit 5.7.27 by Sebastian Bergmann and contributors. Runtime: PHP 7.1.30 with Xdebug 2.9.6 Configuration: /var/www/protected/tests/phpunit.xml ... 3 / 3 (100%) Time: 7.15 seconds, Memory: 14.00MB OK (3 tests, 7 assertions) How to run a functional test on a single file in docker environment? docker oneliner docker-compose run --rm test ./bin/phpunit --testsuite functional --bootstrap protected/tests/bootstrap.php --verbose --configuration protected/tests/phpunit.xml --no-coverage protected/tests/functional/AdminSiteAccessTest.php Or go into docker bash and run phpunit docker-compose run --rm test bash root@45a46a8441d3:/var/www# ./bin/phpunit --testsuite functional --bootstrap protected/tests/bootstrap.php --verbose --configuration protected/tests/phpunit.xml --no-coverage protected/tests/functional/AdminSiteAccessTest.php root@45a46a8441d3:/var/www# ./bin/phpunit --testsuite functional --bootstrap protected/tests/bootstrap.php --verbose --configuration protected/tests/phpunit.xml --no-coverage protected/tests/functional/AdminSiteAccessTest.php PHPUnit 5.7.27 by Sebastian Bergmann and contributors. Runtime: PHP 7.1.30 with Xdebug 2.9.6 Configuration: /var/www/protected/tests/phpunit.xml ... 3 / 3 (100%) Time: 4.18 seconds, Memory: 14.00MB OK (3 tests, 7 assertions) How to run a Behat test in a docker environment for testing Update the scenario syntax specific *.feature file, like: @ok @files Scenario: Files - Call to Actions Given I am not logged in to Gigadb web site When I go to "/dataset/101001" And I follow "Files" Then I should see a link "(FTP site)" to "ftp://climb.genomics.cn/pub/10.5524/101001_102000/101001/" with title "FTP site" Then I should see a button "Table Settings" Check if related functions in features/bootstrap/*.php needed to be updated, eg: public function iShouldSeeTabWithTable($arg1, TableNode $table) { if ("Funding" == $arg1) { $this->minkContext->getSession()->getPage()->clickLink($arg1); //| Funding body | Awardee | Award ID | Comments | foreach($table as $row) { PHPUnit_Framework_Assert::assertTrue( $this->minkContext->getSession()->getPage()->hasContent($row['Funding body']) ); PHPUnit_Framework_Assert::assertTrue( $this->minkContext->getSession()->getPage()->hasContent($row['Awardee']) ); PHPUnit_Framework_Assert::assertTrue( $this->minkContext->getSession()->getPage()->hasContent($row['Award ID']) ); PHPUnit_Framework_Assert::assertTrue( $this->minkContext->getSession()->getPage()->hasContent($row['Comments']) ); } } elseif("Files" == $arg1) { //| File name | Sample ID | Data Type | File Format | Size | Release date | link | foreach($table as $row) { $link = $row['link']; PHPUnit_Framework_Assert::assertTrue( $this->minkContext->getSession()->getPage()->hasContent($row['File name']), "File name match" ); PHPUnit_Framework_Assert::assertTrue( $this->minkContext->getSession()->getPage()->hasContent($row['Sample ID']), "Sample ID match" ); PHPUnit_Framework_Assert::assertTrue( $this->minkContext->getSession()->getPage()->hasContent($row['Data Type']), "Data Type match" ); PHPUnit_Framework_Assert::assertTrue( $this->minkContext->getSession()->getPage()->hasContent($row['File Format']), "File Format match" ); PHPUnit_Framework_Assert::assertTrue( $this->minkContext->getSession()->getPage()->hasContent($row['Size']), "Size match" ); PHPUnit_Framework_Assert::assertTrue( $this->minkContext->getSession()->getPage()->hasContent($row['Release date']), "Release date match" ); if ($link) { $this->minkContext->assertSession()->elementExists('css',"a.download-btn[href='$link']"); } } } elseif("Sample" == $arg1) { //| Sample ID | Common Name | Scientific Name | Sample Attributes | Taxonomic ID | Genbank Name | foreach($table as $row) { PHPUnit_Framework_Assert::assertTrue( $this->minkContext->getSession()->getPage()->hasContent($row['Sample ID']), "Sample ID match" ); if($row['Common Name']) { PHPUnit_Framework_Assert::assertTrue( $this->minkContext->getSession()->getPage()->hasContent($row['Common Name']), "Common Name match" ); } PHPUnit_Framework_Assert::assertTrue( $this->minkContext->getSession()->getPage()->hasContent($row['Scientific Name']), "Scientific Name match" ); PHPUnit_Framework_Assert::assertTrue( $this->minkContext->getSession()->getPage()->hasContent($row['Sample Attributes']), "Sample Attributes match" ); PHPUnit_Framework_Assert::assertTrue( $this->minkContext->getSession()->getPage()->hasContent($row['Taxonomic ID']), "Taxonomic ID match" ); PHPUnit_Framework_Assert::assertTrue( $this->minkContext->getSession()->getPage()->hasContent($row['Genbank Name']), "Genbank Name match" ); } } else { PHPUnit_Framework_Assert::fail("Unknown type of tab"); } } Assign @wip tag to the working scenario in .feature file, this can smooth the running of behat test. @wip @files Scenario: Files - Call to Actions Given I am not logged in to Gigadb web site When I go to "/dataset/101001" Run the Behat test command on specific scenario. docker-compose run --rm test bin/behat -vv --stop-on-failure --tags @wip ...

July 24, 2020 · 8 min · 1525 words · Ken Cho