diff --git a/exercises/practice/protein-translation/.meta/config.json b/exercises/practice/protein-translation/.meta/config.json index e66c8a91f..1b1907b9f 100644 --- a/exercises/practice/protein-translation/.meta/config.json +++ b/exercises/practice/protein-translation/.meta/config.json @@ -2,6 +2,9 @@ "authors": [ "MichaelBunker" ], + "contributors": [ + "resu-xuniL" + ], "files": { "solution": [ "ProteinTranslation.php" diff --git a/exercises/practice/protein-translation/ProteinTranslationTest.php b/exercises/practice/protein-translation/ProteinTranslationTest.php index a73c98f18..c3b6cddda 100644 --- a/exercises/practice/protein-translation/ProteinTranslationTest.php +++ b/exercises/practice/protein-translation/ProteinTranslationTest.php @@ -7,25 +7,19 @@ class ProteinTranslationTest extends TestCase { - private ProteinTranslation $translator; - public static function setUpBeforeClass(): void { require_once 'ProteinTranslation.php'; } - public function setUp(): void - { - $this->translator = new ProteinTranslation(); - } - /** * uuid 2c44f7bf-ba20-43f7-a3bf-f2219c0c3f98 */ #[TestDox('Empty RNA sequence results in no proteins')] public function testEmptyRnaSequence(): void { - $this->assertEquals([], $this->translator->getProteins('')); + $translator = new ProteinTranslation(); + $this->assertEquals([], $translator->getProteins('')); } /** @@ -34,7 +28,8 @@ public function testEmptyRnaSequence(): void #[TestDox('Methionine RNA sequence')] public function testMethionineRnaSequence(): void { - $this->assertEquals(['Methionine'], $this->translator->getProteins('AUG')); + $translator = new ProteinTranslation(); + $this->assertEquals(['Methionine'], $translator->getProteins('AUG')); } /** @@ -43,7 +38,8 @@ public function testMethionineRnaSequence(): void #[TestDox('Phenylalanine RNA sequence 1')] public function testPhenylalanineRnaSequenceOne(): void { - $this->assertEquals(['Phenylalanine'], $this->translator->getProteins('UUU')); + $translator = new ProteinTranslation(); + $this->assertEquals(['Phenylalanine'], $translator->getProteins('UUU')); } /** @@ -52,7 +48,8 @@ public function testPhenylalanineRnaSequenceOne(): void #[TestDox('Phenylalanine RNA sequence 2')] public function testPhenylalanineRnaSequenceTwo(): void { - $this->assertEquals(['Phenylalanine'], $this->translator->getProteins('UUC')); + $translator = new ProteinTranslation(); + $this->assertEquals(['Phenylalanine'], $translator->getProteins('UUC')); } /** @@ -61,7 +58,8 @@ public function testPhenylalanineRnaSequenceTwo(): void #[TestDox('Leucine RNA sequence 1')] public function testLeucineRnaSequenceOne(): void { - $this->assertEquals(['Leucine'], $this->translator->getProteins('UUA')); + $translator = new ProteinTranslation(); + $this->assertEquals(['Leucine'], $translator->getProteins('UUA')); } /** @@ -70,7 +68,8 @@ public function testLeucineRnaSequenceOne(): void #[TestDox('Leucine RNA sequence 2')] public function testLeucineRnaSequenceTwo(): void { - $this->assertEquals(['Leucine'], $this->translator->getProteins('UUG')); + $translator = new ProteinTranslation(); + $this->assertEquals(['Leucine'], $translator->getProteins('UUG')); } /** @@ -79,7 +78,8 @@ public function testLeucineRnaSequenceTwo(): void #[TestDox('Serine RNA sequence 1')] public function testSerineRnaSequenceOne(): void { - $this->assertEquals(['Serine'], $this->translator->getProteins('UCU')); + $translator = new ProteinTranslation(); + $this->assertEquals(['Serine'], $translator->getProteins('UCU')); } /** @@ -88,7 +88,8 @@ public function testSerineRnaSequenceOne(): void #[TestDox('Serine RNA sequence 2')] public function testSerineRnaSequenceTwo(): void { - $this->assertEquals(['Serine'], $this->translator->getProteins('UCC')); + $translator = new ProteinTranslation(); + $this->assertEquals(['Serine'], $translator->getProteins('UCC')); } /** @@ -97,7 +98,8 @@ public function testSerineRnaSequenceTwo(): void #[TestDox('Serine RNA sequence 3')] public function testSerineRnaSequenceThree(): void { - $this->assertEquals(['Serine'], $this->translator->getProteins('UCA')); + $translator = new ProteinTranslation(); + $this->assertEquals(['Serine'], $translator->getProteins('UCA')); } /** @@ -106,7 +108,8 @@ public function testSerineRnaSequenceThree(): void #[TestDox('Serine RNA sequence 4')] public function testSerineRnaSequenceFour(): void { - $this->assertEquals(['Serine'], $this->translator->getProteins('UCG')); + $translator = new ProteinTranslation(); + $this->assertEquals(['Serine'], $translator->getProteins('UCG')); } /** @@ -115,7 +118,8 @@ public function testSerineRnaSequenceFour(): void #[TestDox('Tyrosine RNA sequence 1')] public function testTyrosineRnaSequenceOne(): void { - $this->assertEquals(['Tyrosine'], $this->translator->getProteins('UAU')); + $translator = new ProteinTranslation(); + $this->assertEquals(['Tyrosine'], $translator->getProteins('UAU')); } /** @@ -124,7 +128,8 @@ public function testTyrosineRnaSequenceOne(): void #[TestDox('Tyrosine RNA sequence 2')] public function testTyrosineRnaSequenceTwo(): void { - $this->assertEquals(['Tyrosine'], $this->translator->getProteins('UAC')); + $translator = new ProteinTranslation(); + $this->assertEquals(['Tyrosine'], $translator->getProteins('UAC')); } /** @@ -133,7 +138,8 @@ public function testTyrosineRnaSequenceTwo(): void #[TestDox('Cysteine RNA sequence 1')] public function testCysteineRnaSequenceOne(): void { - $this->assertEquals(['Cysteine'], $this->translator->getProteins('UGU')); + $translator = new ProteinTranslation(); + $this->assertEquals(['Cysteine'], $translator->getProteins('UGU')); } /** @@ -142,7 +148,8 @@ public function testCysteineRnaSequenceOne(): void #[TestDox('Cysteine RNA sequence 2')] public function testCysteineRnaSequenceTwo(): void { - $this->assertEquals(['Cysteine'], $this->translator->getProteins('UGC')); + $translator = new ProteinTranslation(); + $this->assertEquals(['Cysteine'], $translator->getProteins('UGC')); } /** @@ -151,7 +158,8 @@ public function testCysteineRnaSequenceTwo(): void #[TestDox('Tryptophan RNA sequence')] public function testTryptophanRnaSequence(): void { - $this->assertEquals(['Tryptophan'], $this->translator->getProteins('UGG')); + $translator = new ProteinTranslation(); + $this->assertEquals(['Tryptophan'], $translator->getProteins('UGG')); } /** @@ -160,7 +168,8 @@ public function testTryptophanRnaSequence(): void #[TestDox('STOP codon RNA sequence 1')] public function testStopCodonRnaSequenceOne(): void { - $this->assertEquals([], $this->translator->getProteins('UAA')); + $translator = new ProteinTranslation(); + $this->assertEquals([], $translator->getProteins('UAA')); } /** @@ -169,7 +178,8 @@ public function testStopCodonRnaSequenceOne(): void #[TestDox('STOP codon RNA sequence 2')] public function testStopCodonRnaSequenceTwo(): void { - $this->assertEquals([], $this->translator->getProteins('UAG')); + $translator = new ProteinTranslation(); + $this->assertEquals([], $translator->getProteins('UAG')); } /** @@ -178,7 +188,8 @@ public function testStopCodonRnaSequenceTwo(): void #[TestDox('STOP codon RNA sequence 3')] public function testStopCodonRnaSequenceThree(): void { - $this->assertEquals([], $this->translator->getProteins('UGA')); + $translator = new ProteinTranslation(); + $this->assertEquals([], $translator->getProteins('UGA')); } /** @@ -187,7 +198,8 @@ public function testStopCodonRnaSequenceThree(): void #[TestDox('Sequence of two protein codons translates into proteins')] public function testToCodonsTranslateToProteins(): void { - $this->assertEquals(['Phenylalanine', 'Phenylalanine'], $this->translator->getProteins('UUUUUU')); + $translator = new ProteinTranslation(); + $this->assertEquals(['Phenylalanine', 'Phenylalanine'], $translator->getProteins('UUUUUU')); } /** @@ -196,7 +208,8 @@ public function testToCodonsTranslateToProteins(): void #[TestDox('Sequence of two different protein codons translates into proteins')] public function testToDifferentCodonsTranslateToProteins(): void { - $this->assertEquals(['Leucine', 'Leucine'], $this->translator->getProteins('UUAUUG')); + $translator = new ProteinTranslation(); + $this->assertEquals(['Leucine', 'Leucine'], $translator->getProteins('UUAUUG')); } /** @@ -205,9 +218,10 @@ public function testToDifferentCodonsTranslateToProteins(): void #[TestDox('Translate RNA strand into correct protein list')] public function testTranslateRnaStrandIntoCorrectProteinList(): void { + $translator = new ProteinTranslation(); $this->assertEquals( ['Methionine', 'Phenylalanine', 'Tryptophan'], - $this->translator->getProteins('AUGUUUUGG') + $translator->getProteins('AUGUUUUGG') ); } @@ -217,7 +231,8 @@ public function testTranslateRnaStrandIntoCorrectProteinList(): void #[TestDox('Translation stops if STOP codon at beginning of sequence')] public function testTranslationStopsIfStopCodonAtBeginningOfSequence(): void { - $this->assertEquals([], $this->translator->getProteins('UAGUGG')); + $translator = new ProteinTranslation(); + $this->assertEquals([], $translator->getProteins('UAGUGG')); } /** @@ -226,7 +241,8 @@ public function testTranslationStopsIfStopCodonAtBeginningOfSequence(): void #[TestDox('Translation stops if STOP codon at end of two-codon sequence')] public function testTranslationStopsIfStopCodonAtEndOfTwoCodonSequence(): void { - $this->assertEquals(['Tryptophan'], $this->translator->getProteins('UGGUAG')); + $translator = new ProteinTranslation(); + $this->assertEquals(['Tryptophan'], $translator->getProteins('UGGUAG')); } /** @@ -235,7 +251,8 @@ public function testTranslationStopsIfStopCodonAtEndOfTwoCodonSequence(): void #[TestDox('Translation stops if STOP codon at end of three-codon sequence')] public function testTranslationStopsIfStopCodonAtEndOfThreeCodonSequence(): void { - $this->assertEquals(['Methionine', 'Phenylalanine'], $this->translator->getProteins('AUGUUUUAA')); + $translator = new ProteinTranslation(); + $this->assertEquals(['Methionine', 'Phenylalanine'], $translator->getProteins('AUGUUUUAA')); } /** @@ -244,7 +261,8 @@ public function testTranslationStopsIfStopCodonAtEndOfThreeCodonSequence(): void #[TestDox('Translation stops if STOP codon in middle of three-codon sequence"')] public function testTranslationStopsIfStopCodonInMiddleOfThreeCodonSequence(): void { - $this->assertEquals(['Tryptophan'], $this->translator->getProteins('UGGUAGUGG')); + $translator = new ProteinTranslation(); + $this->assertEquals(['Tryptophan'], $translator->getProteins('UGGUAGUGG')); } /** @@ -253,9 +271,10 @@ public function testTranslationStopsIfStopCodonInMiddleOfThreeCodonSequence(): v #[TestDox('Translation stops if STOP codon in middle of six-codon sequence')] public function testTranslationStopsIfStopCodonInMiddleOfSixCodonSequence(): void { + $translator = new ProteinTranslation(); $this->assertEquals( ['Tryptophan', 'Cysteine', 'Tyrosine'], - $this->translator->getProteins('UGGUGUUAUUAAUGGUUU') + $translator->getProteins('UGGUGUUAUUAAUGGUUU') ); } @@ -265,9 +284,10 @@ public function testTranslationStopsIfStopCodonInMiddleOfSixCodonSequence(): voi #[TestDox('Sequence of two non-STOP codons does not translate to a STOP codon')] public function testSequenceOfTwoNonStopCodonsDoesNotTranslateToAStopCodon(): void { + $translator = new ProteinTranslation(); $this->assertEquals( ['Methionine', 'Methionine'], - $this->translator->getProteins('AUGAUG') + $translator->getProteins('AUGAUG') ); } @@ -277,9 +297,10 @@ public function testSequenceOfTwoNonStopCodonsDoesNotTranslateToAStopCodon(): vo #[TestDox("Unknown amino acids, not part of a codon, can't translate")] public function testUnknownAminoAcidsCantTranslate(): void { + $translator = new ProteinTranslation(); $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Invalid codon'); - $this->translator->getProteins('XYZ'); + $translator->getProteins('XYZ'); } @@ -289,9 +310,10 @@ public function testUnknownAminoAcidsCantTranslate(): void #[TestDox("Incomplete RNA sequence can't translate")] public function testIncompleteRnaSequenceCantTranslate(): void { + $translator = new ProteinTranslation(); $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Invalid codon'); - $this->translator->getProteins('AUGU'); + $translator->getProteins('AUGU'); } /** @@ -300,6 +322,7 @@ public function testIncompleteRnaSequenceCantTranslate(): void #[TestDox('Incomplete RNA sequence can translate if valid until a STOP codon')] public function testIncompleteRnaSequenceCanTranslateIfValidUntilStop(): void { - $this->assertEquals(['Phenylalanine', 'Phenylalanine'], $this->translator->getProteins('UUCUUCUAAUGGU')); + $translator = new ProteinTranslation(); + $this->assertEquals(['Phenylalanine', 'Phenylalanine'], $translator->getProteins('UUCUUCUAAUGGU')); } } diff --git a/exercises/practice/proverb/.meta/config.json b/exercises/practice/proverb/.meta/config.json index 4fe3605c1..2301d3801 100644 --- a/exercises/practice/proverb/.meta/config.json +++ b/exercises/practice/proverb/.meta/config.json @@ -3,7 +3,8 @@ "MichaelBunker" ], "contributors": [ - "luciagiampieri" + "luciagiampieri", + "resu-xuniL" ], "files": { "solution": [ diff --git a/exercises/practice/proverb/ProverbTest.php b/exercises/practice/proverb/ProverbTest.php index faeca570f..60f3f5c58 100644 --- a/exercises/practice/proverb/ProverbTest.php +++ b/exercises/practice/proverb/ProverbTest.php @@ -7,65 +7,73 @@ class ProverbTest extends TestCase { - private Proverb $proverb; - public static function setUpBeforeClass(): void { require_once 'Proverb.php'; } - public function setUp(): void - { - $this->proverb = new Proverb(); - } - - /** @uuid e974b73e-7851-484f-8d6d-92e07fe742fc */ + /** + * uuid e974b73e-7851-484f-8d6d-92e07fe742fc + */ #[TestDox('Zero pieces')] public function testZeroPieces(): void { + $proverb = new Proverb(); $pieces = []; $expected = []; - $this->assertEquals($expected, $this->proverb->recite($pieces)); + $this->assertEquals($expected, $proverb->recite($pieces)); } - /** @uuid 2fcd5f5e-8b82-4e74-b51d-df28a5e0faa4 */ + /** + * uuid 2fcd5f5e-8b82-4e74-b51d-df28a5e0faa4 + */ #[TestDox('One piece')] public function testOnePiece(): void { + $proverb = new Proverb(); $pieces = ['nail']; $expected = ['And all for the want of a nail.']; - $this->assertEquals($expected, $this->proverb->recite($pieces)); + $this->assertEquals($expected, $proverb->recite($pieces)); } - /** @uuid d9d0a8a1-d933-46e2-aa94-eecf679f4b0e */ + /** + * uuid d9d0a8a1-d933-46e2-aa94-eecf679f4b0e + */ #[TestDox('Two pieces')] public function testTwoPieces(): void { + $proverb = new Proverb(); $pieces = ['nail', 'shoe']; $expected = [ 'For want of a nail the shoe was lost.', 'And all for the want of a nail.' ]; - $this->assertEquals($expected, $this->proverb->recite($pieces)); + $this->assertEquals($expected, $proverb->recite($pieces)); } - /** @uuid c95ef757-5e94-4f0d-a6cb-d2083f5e5a83 */ + /** + * uuid c95ef757-5e94-4f0d-a6cb-d2083f5e5a83 + */ #[TestDox('Three pieces')] public function testThreePieces(): void { + $proverb = new Proverb(); $pieces = ['nail', 'shoe', 'horse']; $expected = [ 'For want of a nail the shoe was lost.', 'For want of a shoe the horse was lost.', 'And all for the want of a nail.' ]; - $this->assertEquals($expected, $this->proverb->recite($pieces)); + $this->assertEquals($expected, $proverb->recite($pieces)); } - /** @uuid 433fb91c-35a2-4d41-aeab-4de1e82b2126 */ + /** + * uuid 433fb91c-35a2-4d41-aeab-4de1e82b2126 + */ #[TestDox('Full proverb')] public function testFullProverb(): void { + $proverb = new Proverb(); $pieces = ['nail', 'shoe', 'horse', 'rider', 'message', 'battle', 'kingdom']; $expected = [ 'For want of a nail the shoe was lost.', @@ -76,13 +84,16 @@ public function testFullProverb(): void 'For want of a battle the kingdom was lost.', 'And all for the want of a nail.' ]; - $this->assertEquals($expected, $this->proverb->recite($pieces)); + $this->assertEquals($expected, $proverb->recite($pieces)); } - /** @uuid c1eefa5a-e8d9-41c7-91d4-99fab6d6b9f7 */ + /** + * uuid c1eefa5a-e8d9-41c7-91d4-99fab6d6b9f7 + */ #[TestDox('Four pieces modernized')] public function testFourPiecesModernized(): void { + $proverb = new Proverb(); $pieces = ['pin', 'gun', 'soldier', 'battle']; $expected = [ 'For want of a pin the gun was lost.', @@ -90,6 +101,6 @@ public function testFourPiecesModernized(): void 'For want of a soldier the battle was lost.', 'And all for the want of a pin.' ]; - $this->assertEquals($expected, $this->proverb->recite($pieces)); + $this->assertEquals($expected, $proverb->recite($pieces)); } } diff --git a/exercises/practice/resistor-color-duo/ResistorColorDuoTest.php b/exercises/practice/resistor-color-duo/ResistorColorDuoTest.php index 24ac44f1c..864fb4cb1 100644 --- a/exercises/practice/resistor-color-duo/ResistorColorDuoTest.php +++ b/exercises/practice/resistor-color-duo/ResistorColorDuoTest.php @@ -7,25 +7,19 @@ class ResistorColorDuoTest extends TestCase { - private ResistorColorDuo $resistor; - public static function setUpBeforeClass(): void { require_once 'ResistorColorDuo.php'; } - public function setUp(): void - { - $this->resistor = new ResistorColorDuo(); - } - /** * uuid ce11995a-5b93-4950-a5e9-93423693b2fc */ #[TestDox('Brown and black')] public function testBrownAndBlack(): void { - $this->assertEquals(10, $this->resistor->getColorsValue(['brown', 'black'])); + $resistor = new ResistorColorDuo(); + $this->assertEquals(10, $resistor->getColorsValue(['brown', 'black'])); } /** @@ -34,7 +28,8 @@ public function testBrownAndBlack(): void #[TestDox('Blue and grey')] public function testBlueAndGrey(): void { - $this->assertEquals(68, $this->resistor->getColorsValue(['blue', 'grey'])); + $resistor = new ResistorColorDuo(); + $this->assertEquals(68, $resistor->getColorsValue(['blue', 'grey'])); } /** @@ -43,7 +38,8 @@ public function testBlueAndGrey(): void #[TestDox('Yellow and violet')] public function testYellowAndViolet(): void { - $this->assertEquals(47, $this->resistor->getColorsValue(['yellow', 'violet'])); + $resistor = new ResistorColorDuo(); + $this->assertEquals(47, $resistor->getColorsValue(['yellow', 'violet'])); } /** @@ -52,7 +48,8 @@ public function testYellowAndViolet(): void #[TestDox('White and red')] public function testWhiteAndRed(): void { - $this->assertEquals(92, $this->resistor->getColorsValue(['white', 'red'])); + $resistor = new ResistorColorDuo(); + $this->assertEquals(92, $resistor->getColorsValue(['white', 'red'])); } /** @@ -61,7 +58,8 @@ public function testWhiteAndRed(): void #[TestDox('Orange and orange')] public function testOrangeAndOrange(): void { - $this->assertEquals(33, $this->resistor->getColorsValue(['orange', 'orange'])); + $resistor = new ResistorColorDuo(); + $this->assertEquals(33, $resistor->getColorsValue(['orange', 'orange'])); } /** @@ -70,7 +68,8 @@ public function testOrangeAndOrange(): void #[TestDox('Ignore additional colors')] public function testIgnoreAdditionalColors(): void { - $this->assertEquals(51, $this->resistor->getColorsValue(['green', 'brown', 'orange'])); + $resistor = new ResistorColorDuo(); + $this->assertEquals(51, $resistor->getColorsValue(['green', 'brown', 'orange'])); } /** @@ -79,6 +78,7 @@ public function testIgnoreAdditionalColors(): void #[TestDox('Black and brown, one-digit')] public function testBlackAndBrownOneDigit(): void { - $this->assertEquals(1, $this->resistor->getColorsValue(['black', 'brown'])); + $resistor = new ResistorColorDuo(); + $this->assertEquals(1, $resistor->getColorsValue(['black', 'brown'])); } } diff --git a/exercises/practice/resistor-color-trio/ResistorColorTrioTest.php b/exercises/practice/resistor-color-trio/ResistorColorTrioTest.php index 686b874c6..4ed81df56 100644 --- a/exercises/practice/resistor-color-trio/ResistorColorTrioTest.php +++ b/exercises/practice/resistor-color-trio/ResistorColorTrioTest.php @@ -7,25 +7,19 @@ class ResistorColorTrioTest extends TestCase { - private ResistorColorTrio $resistor; - public static function setUpBeforeClass(): void { require_once 'ResistorColorTrio.php'; } - public function setUp(): void - { - $this->resistor = new ResistorColorTrio(); - } - /** * uuid d6863355-15b7-40bb-abe0-bfb1a25512ed */ #[TestDox('Orange and orange and black')] public function testOrangeAndOrangeAndBlack(): void { - $this->assertEquals('33 ohms', $this->resistor->label(['orange', 'orange', 'black'])); + $resistor = new ResistorColorTrio(); + $this->assertEquals('33 ohms', $resistor->label(['orange', 'orange', 'black'])); } /** @@ -34,7 +28,8 @@ public function testOrangeAndOrangeAndBlack(): void #[TestDox('Blue and grey and brown')] public function testBlueAndGreyAndBrown(): void { - $this->assertEquals('680 ohms', $this->resistor->label(['blue', 'grey', 'brown'])); + $resistor = new ResistorColorTrio(); + $this->assertEquals('680 ohms', $resistor->label(['blue', 'grey', 'brown'])); } /** @@ -43,7 +38,8 @@ public function testBlueAndGreyAndBrown(): void #[TestDox('Red and black and red')] public function testRedAndBlackAndRed(): void { - $this->assertEquals('2 kiloohms', $this->resistor->label(['red', 'black', 'red'])); + $resistor = new ResistorColorTrio(); + $this->assertEquals('2 kiloohms', $resistor->label(['red', 'black', 'red'])); } /** @@ -52,7 +48,8 @@ public function testRedAndBlackAndRed(): void #[TestDox('Green and brown and orange')] public function testGreenAndBrownAndOrange(): void { - $this->assertEquals('51 kiloohms', $this->resistor->label(['green', 'brown', 'orange'])); + $resistor = new ResistorColorTrio(); + $this->assertEquals('51 kiloohms', $resistor->label(['green', 'brown', 'orange'])); } /** @@ -61,7 +58,8 @@ public function testGreenAndBrownAndOrange(): void #[TestDox('Yellow and violet and yellow')] public function testYellowAndVioletAndYellow(): void { - $this->assertEquals('470 kiloohms', $this->resistor->label(['yellow', 'violet', 'yellow'])); + $resistor = new ResistorColorTrio(); + $this->assertEquals('470 kiloohms', $resistor->label(['yellow', 'violet', 'yellow'])); } /** @@ -70,7 +68,8 @@ public function testYellowAndVioletAndYellow(): void #[TestDox('Blue and violet and blue')] public function testBlueAndVioletAndBlue(): void { - $this->assertEquals('67 megaohms', $this->resistor->label(['blue', 'violet', 'blue'])); + $resistor = new ResistorColorTrio(); + $this->assertEquals('67 megaohms', $resistor->label(['blue', 'violet', 'blue'])); } /** @@ -79,7 +78,8 @@ public function testBlueAndVioletAndBlue(): void #[TestDox('Minimum possible value')] public function testMinimumPossibleValue(): void { - $this->assertEquals('0 ohms', $this->resistor->label(['black', 'black', 'black'])); + $resistor = new ResistorColorTrio(); + $this->assertEquals('0 ohms', $resistor->label(['black', 'black', 'black'])); } /** @@ -88,7 +88,8 @@ public function testMinimumPossibleValue(): void #[TestDox('Maximum possible value')] public function testMaximumPossibleValue(): void { - $this->assertEquals('99 gigaohms', $this->resistor->label(['white', 'white', 'white'])); + $resistor = new ResistorColorTrio(); + $this->assertEquals('99 gigaohms', $resistor->label(['white', 'white', 'white'])); } /** @@ -97,7 +98,8 @@ public function testMaximumPossibleValue(): void #[TestDox('First two colors make an invalid octal number')] public function testFirstTwoColorsMakeAnInvalidOctalNumber(): void { - $this->assertEquals('8 ohms', $this->resistor->label(['black', 'grey', 'black'])); + $resistor = new ResistorColorTrio(); + $this->assertEquals('8 ohms', $resistor->label(['black', 'grey', 'black'])); } /** @@ -106,6 +108,7 @@ public function testFirstTwoColorsMakeAnInvalidOctalNumber(): void #[TestDox('Ignore extra colors')] public function testIgnoreExtraColors(): void { - $this->assertEquals('650 kiloohms', $this->resistor->label(['blue', 'green', 'yellow', 'orange'])); + $resistor = new ResistorColorTrio(); + $this->assertEquals('650 kiloohms', $resistor->label(['blue', 'green', 'yellow', 'orange'])); } }