You are here

public function TagadelicCloudTest::testGetCalculatedWeights in Tagadelic 7.2

Get Tags should calculate the weights

File

tests/TagadelicCloudTest.php, line 147

Class

TagadelicCloudTest
Generated by PHPUnit_SkeletonGenerator on 2012-05-16 at 15:23:33.

Code

public function testGetCalculatedWeights() {
  $mocks = array();
  $assert_table = array(
    //       name              , count , weight
    array(
      "Mary Read",
      1,
      1,
    ),
    array(
      "Jean Fleury",
      1,
      1,
    ),
    array(
      "François Le Clerc",
      1,
      1,
    ),
    array(
      "Blackbeard",
      2,
      1,
    ),
    array(
      "Henry Morgan",
      3,
      2,
    ),
    array(
      "Bartolomew Roberts",
      10,
      3,
    ),
    array(
      "Stede Bonnet",
      20,
      4,
    ),
    array(
      "Edward Low",
      40,
      5,
    ),
    array(
      "Anne Bonny",
      100,
      6,
    ),
  );
  $i = 1;
  foreach ($assert_table as $assertion) {
    $mock = $this
      ->getMock("TagadelicTag", array(
      "set_weight",
    ), array(
      $i++,
      $assertion[0],
      $assertion[1],
    ));
    $mock
      ->expects($this
      ->once())
      ->method("set_weight")
      ->with($assertion[2])
      ->will($this
      ->returnSelf());
    $mocks[] = $mock;
  }
  $this->object = new TagadelicCloud(1337, $mocks);
  $this->object
    ->get_tags();
}