Skip to content

piotrpog/craft-pest

 
 

Repository files navigation

craft-pest screen shot

Pest for Craft CMS

composer require markhuot/craft-pest --dev
./craft pest/test

Handles the setup and installation of Pest in to Craft CMS. This allows you to write tests that look something like this!

it('loads the homepage')
    ->get('/')
    ->assertOk();

it('has a welcoming h1 element')
    ->expect(fn() => $this->get('/'))
    ->querySelector('h1')->text->toBe('Welcome');

it('asserts nine list items')
    ->get('/')
    ->querySelector('li')
    ->assertCount(9);

it('expects nine list items')
    ->expect(fn() => $this->get('/'))
    ->querySelector('li')
    ->count->toBe(9);

it('promotes craft')
    ->get('/')
    ->assertHeader('x-powered-by', 'Craft CMS');

it('shows news on the homepage', function() {
    $titles = News::factory()->count(3)->create()->title;

    expect($this->get('/')->querySelector('.news__title'))
        ->count->toBe(3)
        ->text->sequence(...$titles);
});

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 98.4%
  • Other 1.6%