#Tournament Exercise in PHP - logic done, but I don't get the input

5 messages · Page 1 of 1 (latest)

rocky latch
#

Hello, as I said in the title I don't know if I should give an input or if I should create an instance of the class. I've done the tournament.php locally and it works fine.

I mean, all the prevoius exercises i have done were straightforward, the exercise itself gave me instructions or indications about the input and I only had to pay attention to the logic.
But in this case, I am not sure. Should I print from the constructor method (this is my solution right now), should I return the solution from other function?

To be more specific, all tests fail for the same reason "ArgumentCountError: Too few arguments to function Tournament::__construct(), 0 passed in /mnt/exercism-iteration/TournamentTest.php".
If I create an instance of the class and give a parameter, I only have problems in Test 1 when $input = "";

Thank you.

untold laurel
#

Looking at the tests might help you understand how the functions are supposed to be constructed.
It sounds like your construct is expecting more arguments than the tests are passing it.

mystic heron
#

an example test:

    public function testThereCanBeMultipleMatches(): void
    {
        $this->markTestSkipped();
        $scores =
            "Allegoric Alaskans;Blithering Badgers;win\n" .
            "Allegoric Alaskans;Blithering Badgers;win";
        $expected =
            "Team                           | MP |  W |  D |  L |  P\n" .
            "Allegoric Alaskans             |  2 |  2 |  0 |  0 |  6\n" .
            "Blithering Badgers             |  2 |  0 |  0 |  2 |  0";
        $this->assertEquals($expected, $this->tournament->tally($scores));
    }

so from this you can glean

  • the test passes one input to tally
  • that one input is a single string
  • the test expects tally to return a string (and not print to console or anything else) so it can compare it to the string in $expected
manic timber
#

Hi, in this exercice do we create the input ourselves ? the exercice doesn't give us a string to work with in the first place

#

it's disturbing a little bit