Applied rectors phpunit 9 migrations to tests

This commit is contained in:
Jan Böhmer 2023-06-11 15:15:55 +02:00
parent 684334ba22
commit fcbb1849ec
22 changed files with 162 additions and 187 deletions

View file

@ -34,17 +34,15 @@ class BBCodeToMarkdownConverterTest extends TestCase
$this->converter = new BBCodeToMarkdownConverter();
}
public function dataProvider(): array
public function dataProvider(): \Iterator
{
return [
['[b]Bold[/b]', '**Bold**'],
['[i]Italic[/i]', '*Italic*'],
['[s]Strike[/s]', '<s>Strike</s>'],
['[url]https://foo.bar[/url]', '<https://foo.bar>'],
['[url=https://foo.bar]test[/url]', '[test](https://foo.bar)'],
['[center]Centered[/center]', '<div style="text-align:center">Centered</div>'],
['test no change', 'test no change'],
];
yield ['[b]Bold[/b]', '**Bold**'];
yield ['[i]Italic[/i]', '*Italic*'];
yield ['[s]Strike[/s]', '<s>Strike</s>'];
yield ['[url]https://foo.bar[/url]', '<https://foo.bar>'];
yield ['[url=https://foo.bar]test[/url]', '[test](https://foo.bar)'];
yield ['[center]Centered[/center]', '<div style="text-align:center">Centered</div>'];
yield ['test no change', 'test no change'];
}
/**

View file

@ -118,17 +118,17 @@ class ProjectBuildRequestTest extends TestCase
//The values should be already prefilled correctly
$request = new ProjectBuildRequest($this->project1, 10);
//We need totally 20: Take 10 from the first (maximum 10) and 10 from the second (maximum 20)
$this->assertEquals(10, $request->getLotWithdrawAmount($this->lot1a));
$this->assertEquals(10, $request->getLotWithdrawAmount($this->lot1b));
$this->assertSame(10, $request->getLotWithdrawAmount($this->lot1a));
$this->assertSame(10, $request->getLotWithdrawAmount($this->lot1b));
//If the needed amount is higher than the maximum, we should get the maximum
$this->assertEquals(2.5, $request->getLotWithdrawAmount($this->lot2));
$this->assertSame(2.5, $request->getLotWithdrawAmount($this->lot2));
}
public function testGetNumberOfBuilds(): void
{
$build_request = new ProjectBuildRequest($this->project1, 5);
$this->assertEquals(5, $build_request->getNumberOfBuilds());
$this->assertSame(5, $build_request->getNumberOfBuilds());
}
public function testGetProject(): void
@ -140,9 +140,9 @@ class ProjectBuildRequestTest extends TestCase
public function testGetNeededAmountForBOMEntry(): void
{
$build_request = new ProjectBuildRequest($this->project1, 5);
$this->assertEquals(10, $build_request->getNeededAmountForBOMEntry($this->bom_entry1a));
$this->assertEquals(7.5, $build_request->getNeededAmountForBOMEntry($this->bom_entry1b));
$this->assertEquals(20, $build_request->getNeededAmountForBOMEntry($this->bom_entry1c));
$this->assertSame(10, $build_request->getNeededAmountForBOMEntry($this->bom_entry1a));
$this->assertSame(7.5, $build_request->getNeededAmountForBOMEntry($this->bom_entry1b));
$this->assertSame(20, $build_request->getNeededAmountForBOMEntry($this->bom_entry1c));
}
public function testGetSetLotWithdrawAmount(): void
@ -154,8 +154,8 @@ class ProjectBuildRequestTest extends TestCase
$build_request->setLotWithdrawAmount($this->lot1b->getID(), 3);
//And it should be possible to get the amount via the lot object or via the ID
$this->assertEquals(2, $build_request->getLotWithdrawAmount($this->lot1a->getID()));
$this->assertEquals(3, $build_request->getLotWithdrawAmount($this->lot1b));
$this->assertSame(2, $build_request->getLotWithdrawAmount($this->lot1a->getID()));
$this->assertSame(3, $build_request->getLotWithdrawAmount($this->lot1b));
}
public function testGetWithdrawAmountSum(): void
@ -166,9 +166,9 @@ class ProjectBuildRequestTest extends TestCase
$build_request->setLotWithdrawAmount($this->lot1a, 2);
$build_request->setLotWithdrawAmount($this->lot1b, 3);
$this->assertEquals(5, $build_request->getWithdrawAmountSum($this->bom_entry1a));
$this->assertSame(5, $build_request->getWithdrawAmountSum($this->bom_entry1a));
$build_request->setLotWithdrawAmount($this->lot2, 1.5);
$this->assertEquals(1.5, $build_request->getWithdrawAmountSum($this->bom_entry1b));
$this->assertSame(1.5, $build_request->getWithdrawAmountSum($this->bom_entry1b));
}