Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Test-Driven Development

Avatar for Sam Starling Sam Starling
December 07, 2012

Test-Driven Development

Avatar for Sam Starling

Sam Starling

December 07, 2012

More Decks by Sam Starling

Other Decks in Programming

Transcript

  1. Does it work the way it should? Have I broken

    anything on the way? Is this task done yet?
  2. Does it work the way it should? Have I broken

    anything on the way? Is this task done yet?
  3. Does it work the way it should? Have I broken

    anything on the way? Is this task done yet?
  4. Have I done everything I needed to? Does everything I’ve

    done still work? Can I go to the pub yet?
  5. Have I done everything I needed to? Does everything I’ve

    done still work? Can I go to the pub yet?
  6. Have I done everything I needed to? Does everything I’ve

    done still work? Can I go to the pub yet?
  7. public function getBeacon($seedRandom = false) { // toggle a seeded

    random number for unit testing if ($seedRandom) { mt_srand(0); } $beaconTokens = array( 's' => 'News', 't' => ($this->getBeaconToken() ?: 0), 'i' => ($this->getAssetId() ?: 0), 'p' => ($this->getSectionId() ?: 0), 'a' => ($this->getEdition() ?: 0), 'u' => ($this->getAsseturi() ?: 0), 'r' => 0, // http_referrer 'q' => 0, // query_string 'z' => mt_rand(1, 10000)); foreach ($beaconTokens as $key => $value) { $this->beacon .= sprintf('~RS~%s~RS~%s', $key, $value); } return $this->beacon . '~RS~'; }