public function testGetTagWeights() { $tagsWeight = $this->blogRepository->getTagWeights(array('php', 'code', 'code', 'symblog', 'blog')); $this->assertTrue(count($tagsWeight) > 1); // Caso de prueba, donde 'count' máximo pesa 5 $tagsWeight = $this->blogRepository->getTagWeights(array_fill(0, 10, 'php')); $this->assertTrue(count($tagsWeight) >= 1); // Caso de prueba con múltiples cuentas por encima del peso máximo de 5 $tagsWeight = $this->blogRepository->getTagWeights(array_merge(array_fill(0, 10, 'php'), array_fill(0, 2, 'html'), array_fill(0, 6, 'js'))); $this->assertEquals(5, $tagsWeight['php']); $this->assertEquals(3, $tagsWeight['js']); $this->assertEquals(1, $tagsWeight['html']); // Prueba el caso vacío $tagsWeight = $this->blogRepository->getTagWeights(array()); $this->assertEmpty($tagsWeight); }
public function testGetTagWeights() { $tagsWeight = $this->blogRepository->getTagWeights(array('php', 'code', 'code', 'symblog', 'blog')); $this->assertTrue(count($tagsWeight) > 1); // Test case where count is over max weight of 5 $tagsWeight = $this->blogRepository->getTagWeights(array_fill(0, 10, 'php')); $this->assertTrue(count($tagsWeight) >= 1); // Test case with multiple counts over max weight of 5 $tagsWeight = $this->blogRepository->getTagWeights(array_merge(array_fill(0, 10, 'php'), array_fill(0, 2, 'html'), array_fill(0, 6, 'js'))); $this->assertEquals(5, $tagsWeight['php']); $this->assertEquals(3, $tagsWeight['js']); $this->assertEquals(1, $tagsWeight['html']); // Test empty case $tagsWeight = $this->blogRepository->getTagWeights(array()); $this->assertEmpty($tagsWeight); }