Get sponsors by level

This commit is contained in:
Oliver Davies 2019-05-20 22:38:43 +01:00
parent 299bb34988
commit b23d170804
2 changed files with 30 additions and 2 deletions

View file

@ -4,6 +4,10 @@ namespace App\Sponsors\Model;
class Sponsor
{
const LEVEL_GOLD = 'gold';
const LEVEL_SILVER = 'silver';
const LEVEL_BRONZE = 'bronze';
/** @var array */
private $data = [];

View file

@ -2,14 +2,38 @@
namespace App\Tests\Sponsors;
use App\Sponsors\Model\Sponsor;
use App\Sponsors\TwigExtension\SponsorsExtension;
use PHPUnit\Framework\TestCase;
class SponsorsTest extends TestCase
{
/** @var SponsorsExtension */
private $extension;
protected function setUp(): void
{
parent::setUp();
$this->extension = new SponsorsExtension();
}
/** @test */
public function get_sponsors_by_level()
{
$this->markTestIncomplete();
$data = [
Sponsor::LEVEL_GOLD => [
['name' => 'Microserve', 'confirmed' => true],
],
Sponsor::LEVEL_SILVER => [
['name' => 'Drupalize.me', 'confirmed' => true],
],
];
$sponsors = $this->extension->getSponsors($data, Sponsor::LEVEL_SILVER);
$this->assertCount(1, $sponsors);
$this->assertSame('Drupalize.me', $sponsors[0]['name']);
}
/** @test */