Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
33.33% covered (danger)
33.33%
2 / 6
CRAP
33.33% covered (danger)
33.33%
2 / 6
Unit
0.00% covered (danger)
0.00%
0 / 1
33.33% covered (danger)
33.33%
2 / 6
16.67
33.33% covered (danger)
33.33%
2 / 6
 visit
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 file
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 auth
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 write
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 collect
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 crypter
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
<?php
declare(strict_types=1);
namespace Eywa\Testing {
    use Eywa\Collection\Collect;
    use Eywa\Database\Model\Model;
    use Eywa\Exception\Kedavra;
    use Eywa\File\File;
    use Eywa\Http\Request\ServerRequest;
    use Eywa\Http\Response\Response;
    use Eywa\Http\Routing\Router;
    use Eywa\Message\Email\Write;
    use Eywa\Security\Authentication\Auth;
    use Eywa\Security\Crypt\Crypter;
    use Eywa\Session\ArraySession;
    use PHPUnit\Framework\TestCase;
    use ReflectionException;
    class Unit extends TestCase
    {
        /**
         *
         * Visit a page
         *
         * @param string $url
         * @param string $method
         *
         * @return Response
         *
         * @throws Kedavra
         * @throws ReflectionException
         *
         */
        public function visit(string $url, string $method = GET): Response
        {
            return (new Router(new ServerRequest($url, $method)))->run();
        }
        /**
         * @param string $filename
         * @param string $mode
         *
         * @return File
         *
         * @throws Kedavra
         *
         */
        public function file(string $filename, string $mode = READ_FILE_MODE): File
        {
            return new File($filename, $mode);
        }
        /**
         *
         *
         * @param string $model
         *
         * @return Auth
         *
         * @throws Kedavra
         *
         */
        public function auth(string $model): Auth
        {
            return new Auth(new ArraySession(), $model);
        }
        /**
         * @param string $subject
         * @param string $message
         * @param string $author_email
         * @param string $to
         * @return Write
         *
         * @throws Kedavra
         */
        public function write(string $subject, string $message, string $author_email, string $to): Write
        {
            return new Write($subject, $message, $author_email, $to);
        }
        /**
         *
         * @param array<mixed> $data
         *
         * @return Collect
         *
         */
        public function collect(array $data = []): Collect
        {
            return new Collect($data);
        }
        /**
         * @return Crypter
         */
        public function crypter(): Crypter
        {
            return new Crypter();
        }
    }
}