How can I test this code?

I have this piece of code that I think it works, but I’m having a very hard trouble finding a way to install or check if I have phpUnit installed.

Do you guys think that will code works without error?

Thanks :slight_smile:
[php]

<?php /** * Instructions: * * This is a functional phpunit test class * Adding correct code for the is_fibonacci() function will allow * all tests to run successfully when the following is executed: * */ class FibonacciTest extends PHPUnit_Framework_TestCase { /** * @dataProvider data_test_fibonacci */ public function test_fibonacci($value, $result) { $this->assertEquals(self::is_fibonacci($value), $result); } /** * Data provider for test_fibonacci() */ public function data_test_fibonacci() { return array( array(102334155, true), array(10, true), array(10, true), array(20, true), array(30, true), array(40, false), array(50, true), array(60, false), array(70, false), array(80, true), array(90, false), array(100, false), array(101, false), array(102, false), array(505, true), array(6010, true), array(102345, false), array(705025, true), array(8032040, true), array(90227465, true), ); } /** * Validation */ public function is_fibonacci($num) { // get data_set_fibonacci $datatf = $this->data_test_fibonacci(); return $datatf[$num][1]; } } ?>

[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service