PHP code example of akuma / testing-component

1. Go to this page and download the library: Download akuma/testing-component library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

akuma / testing-component example snippets




namespace Acme\Bundle\SampleBundle\Tests\Functional;

use Akuma\Component\Testing\TestCase\WebTestCase;
use Acme\Bundle\SampleBundle\Entity\SomeEntity;

class AcmeSampleTest extends WebTestCase
{
    /**
     * {@inheritdoc}
     */
    protected function setUp()
    {
        $this->initClient(); // Required
        $this->loadFixtures([
            \Acme\Bundle\SampleBundle\Tests\Functional\Fixtures\TestFixture::class,
            dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Fixtures/alice_fixture.yml',
        ]);
    }

    public function testXXX()
    {
        var_dump($this->getContainer()->get('doctrine')->getRepository(SomeEntity::class)->findAll([]));
    }
}



namespace Acme\Bundle\SampleBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Table(name="some_entity_table")
 */
class SomeEntity
{
    /**
     * @var int
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @return int
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * @var string
     *
     * @ORM\Column(name="domain", type="string", length=255, nullable=false, unique=true)
     */
    private $domain;

    /**
     * @var string
     *
     * @ORM\Column(name="token", type="string", length=255, nullable=false, unique=true)
     */
    private $token;

    /**
     * @param string $domain
     *
     * @return $this
     */
    public function setDomain($domain)
    {
        $this->domain = $domain;

        return $this;
    }

    /**
     * @return string
     */
    public function getDomain()
    {
        return $this->domain;
    }

    /**
     * @param string $token
     *
     * @return $this
     */
    public function setToken($token)
    {
        $this->token = $token;

        return $this;
    }

    /**
     * @return string
     */
    public function getToken()
    {
        return $this->token;
    }
}