mirror of
https://github.com/pnx/neotest-phpunit
synced 2026-06-16 03:54:55 +02:00
Pest runs with dummy code
This commit is contained in:
parent
0fbc1ad183
commit
f6c7185eb7
3 changed files with 52 additions and 1 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
|
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
|
||||||
bootstrap="vendor/autoload.php"
|
bootstrap="src/autoload.php"
|
||||||
colors="true"
|
colors="true"
|
||||||
>
|
>
|
||||||
<testsuites>
|
<testsuites>
|
||||||
|
|
|
||||||
48
src/User.php
Normal file
48
src/User.php
Normal file
|
|
@ -0,0 +1,48 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace TestProject;
|
||||||
|
|
||||||
|
use InvalidArgumentException;
|
||||||
|
|
||||||
|
class User
|
||||||
|
{
|
||||||
|
public int $age;
|
||||||
|
public array $favorite_movies = [];
|
||||||
|
public string $name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $age
|
||||||
|
* @param string $name
|
||||||
|
*/
|
||||||
|
public function __construct(int $age, string $name)
|
||||||
|
{
|
||||||
|
$this->age = $age;
|
||||||
|
$this->name = $name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function tellName(): string
|
||||||
|
{
|
||||||
|
return "My name is " . $this->name . ".";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function tellAge(): string
|
||||||
|
{
|
||||||
|
return "I am " . $this->age . " years old.";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addFavoriteMovie(string $movie): bool
|
||||||
|
{
|
||||||
|
$this->favorite_movies[] = $movie;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeFavoriteMovie(string $movie): bool
|
||||||
|
{
|
||||||
|
if (!in_array($movie, $this->favorite_movies)) throw new InvalidArgumentException("Unknown movie: " . $movie);
|
||||||
|
|
||||||
|
unset($this->favorite_movies[array_search($movie, $this->favorite_movies)]);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
3
src/autoload.php
Normal file
3
src/autoload.php
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require __DIR__ . "/../src/User.php";
|
||||||
Loading…
Add table
Add a link
Reference in a new issue