Skip to content

Latest commit

 

History

History
75 lines (52 loc) · 1.48 KB

testing.md

File metadata and controls

75 lines (52 loc) · 1.48 KB

Testing

This bundle provides a set of shortcuts to help during tests.

DataCollector

// TODO

Assertions

A set of assertions is available thanks to the MeiliSearchBundleAssertionTrait during functional tests:

<?php

use PHPUnit\Framework\TestCase;
use MeiliSearchBundle\Test\MeiliSearchBundleAssertionTrait;

final class Test extends TestCase
{
    use MeiliSearchBundleAssertionTrait;

    public function testHomepage(): void
    {
        // ...
        
        static::assertIndexCreatedCount(1);
    }
}
<?php

use PHPUnit\Framework\TestCase;
use MeiliSearchBundle\Test\MeiliSearchBundleAssertionTrait;

final class Test extends TestCase
{
    use MeiliSearchBundleAssertionTrait;

    public function testHomepage(): void
    {
        // ...
        
        static::assertIndexRemovedCount(1);
    }
}
  • Search | Allow to test the number of search performed:
<?php

use PHPUnit\Framework\TestCase;
use MeiliSearchBundle\Test\MeiliSearchBundleAssertionTrait;

final class Test extends TestCase
{
    use MeiliSearchBundleAssertionTrait;

    public function testHomepage(): void
    {
        // ...
        
        static::assertSearchCount(1);
    }
}