php-juicer/tests/Recipe/Mixer/MixerTest.php

59 lines
1.6 KiB
PHP

<?php
namespace NoccyLabs\Juicer\Recipe\Mixer;
use NoccyLabs\Juicer\Recipe\Recipe;
use NoccyLabs\Juicer\Ingredient\Ingredient;
use NoccyLabs\Juicer\Ingredient\Base;
class MixerTest extends \PhpUnit\Framework\TestCase
{
public function testMixingEmptyRecipesWithVg()
{
$recipe = new Recipe();
$mixer = new Mixer();
$base = new Base("VG100");
$mixed = $mixer->mixRecipe($recipe, 10, $base, 0);
$this->assertCount(1, $mixed);
$mixedVg = reset($mixed);
$this->assertEquals(10, $mixedVg->getVolume());
$this->assertEquals("VG", $mixedVg->getFlavorName());
}
public function testMixingEmptyRecipesWithPg()
{
$recipe = new Recipe();
$mixer = new Mixer();
$base = new Base("PG100");
$mixed = $mixer->mixRecipe($recipe, 10, $base, 0);
$this->assertCount(1, $mixed);
$mixedPg = reset($mixed);
$this->assertEquals(10, $mixedPg->getVolume());
$this->assertEquals("PG", $mixedPg->getFlavorName());
}
public function testMixingEmptyRecipesWith70Vg30Pg()
{
$recipe = new Recipe();
$mixer = new Mixer();
$base = new Base("VG70");
$mixed = $mixer->mixRecipe($recipe, 10, $base, 0);
$this->assertCount(2, $mixed);
$mixedVg = array_shift($mixed);
$this->assertEquals(10, $mixedVg->getVolume());
$this->assertEquals("VG", $mixedVg->getFlavorName());
$mixedPg = array_shift($mixed);
$this->assertEquals(10, $mixedPg->getVolume());
$this->assertEquals("PG", $mixedPg->getFlavorName());
}
}