[Quick Links] |
Search Site

Site Details

rendered in 0.1324 secs

Captain's Log | Wednesday 14th of October 2015

Draytek router emulators | simulator dreytek


AP-900 - http://eu.draytek.com:10900/
AP-800 - http://www.draytek.com/demo/VigorAP800/v1.0.4/
Vigor 3900 - http://60.250.189.150:3900/
Vigor 2830 - http://eu.draytek.com:12830/
Vigor 2860 - http://eu.draytek.com:12860/
Vigor 2920 - http://eu.draytek.com:12920/

book review: Clean Code - A Handbook of Agile Software Craftsmanship


An average book which emphasizes putting in the effort to make your code as readable as possible. A lot of code review inside which isn't great if you're listening to it in the car rather than have a hard copy in front of you, but enough theory and thought behind the ideas to still make it a good listen.


how to use private class variables in your tests | phpunit codeigniter ci kenjis/ci-phpunit-test


class Bfmyops_test extends TestCase
{    
    private $nextMarketId;
  
    public function setUp()
    {
        $this->resetInstance();
        $this->CI->load->model('Bfmyops');
        $this->nextMarketId = $this->CI->Bfmyops->getNextRaceMarketId();
    }

    public function testInsertPriceAnGetNextRaceMarketId()
    {
        /**
         * we used to query todays_card_basic and get a marketid then pass that in InsertPrice, but sometimes the dev DB was empty which would cause tests to fail. This way we get to test two methods and make sure the marketId is valid.
         * once inserted we get the last successful insert ID and then make sure this is an int. we would then get a failure if the in sert fails as it wouldn't return an insert_id
         */
        $this->CI->Bfmyops->insertPrice($this->nextMarketId);
        $final_insert_id = $this->CI->db->insert_id();
        echo "testInsertID last id inserted: ".$final_insert_id;
        $this->assertInternalType("int", $final_insert_id);
    }

    public function testGetNextRaceStartTime() {
        $test_passed = FALSE;

        $next_race_start_time = $this->CI->Bfmyops->getNextRaceStartTime();
        if($next_race_start_time > date('Y-m-d H:i:s')) {
            $test_passed = TRUE;
        }
        $this->assertTrue($test_passed);
    }

    ... then you can use $this->nextMarketId in another method further down without having to make another call to the model ...
}