Fix tests

This commit is contained in:
philipp lang 2024-09-22 12:27:26 +02:00
parent 7c876d75c9
commit 3f5321af9d
4 changed files with 7 additions and 9 deletions

View File

@ -11,7 +11,7 @@ class CourseFactoryTest extends TestCase
{ {
public function testItCanRenderACourseAsJson(): void public function testItCanRenderACourseAsJson(): void
{ {
$course = Course::factory()->toCourse(); $course = Course::toFactory()->toCourse();
$json = $course->toArray(); $json = $course->toArray();
$data = json_decode(json_encode($json)); $data = json_decode(json_encode($json));

View File

@ -4,11 +4,9 @@ namespace Zoomyboy\LaravelNami\Tests\Unit;
use Zoomyboy\LaravelNami\Data\Course; use Zoomyboy\LaravelNami\Data\Course;
use Zoomyboy\LaravelNami\Exceptions\NoJsonReceivedException; use Zoomyboy\LaravelNami\Exceptions\NoJsonReceivedException;
use Zoomyboy\LaravelNami\Exceptions\NotAuthenticatedException;
use Zoomyboy\LaravelNami\Exceptions\NotSuccessfulException; use Zoomyboy\LaravelNami\Exceptions\NotSuccessfulException;
use Zoomyboy\LaravelNami\Fakes\CourseFake; use Zoomyboy\LaravelNami\Fakes\CourseFake;
use Zoomyboy\LaravelNami\LoginException; use Zoomyboy\LaravelNami\LoginException;
use Zoomyboy\LaravelNami\Nami;
use Zoomyboy\LaravelNami\Tests\TestCase; use Zoomyboy\LaravelNami\Tests\TestCase;
class CourseTest extends TestCase class CourseTest extends TestCase
@ -17,7 +15,7 @@ class CourseTest extends TestCase
{ {
app(CourseFake::class) app(CourseFake::class)
->fetches(11111, [788]) ->fetches(11111, [788])
->shows(11111, Course::factory()->toCourse([ ->shows(11111, Course::toFactory()->toCourse([
'bausteinId' => 506, 'bausteinId' => 506,
'id' => 788, 'id' => 788,
'veranstalter' => 'KJA', 'veranstalter' => 'KJA',
@ -41,8 +39,8 @@ class CourseTest extends TestCase
{ {
app(CourseFake::class) app(CourseFake::class)
->fetches(11111, [788, 789]) ->fetches(11111, [788, 789])
->shows(11111, Course::factory()->id(788)->toCourse()) ->shows(11111, Course::toFactory()->id(788)->toCourse())
->shows(11111, Course::factory()->id(789)->toCourse()); ->shows(11111, Course::toFactory()->id(789)->toCourse());
$courses = $this->login()->coursesOf(11111); $courses = $this->login()->coursesOf(11111);
@ -54,7 +52,7 @@ class CourseTest extends TestCase
app(CourseFake::class) app(CourseFake::class)
->fetches(11111, [788, 789]) ->fetches(11111, [788, 789])
->failsShowingWithHtml(11111, 788) ->failsShowingWithHtml(11111, 788)
->shows(11111, Course::factory()->id(789)->toCourse()); ->shows(11111, Course::toFactory()->id(789)->toCourse());
$courses = $this->login()->coursesOf(11111); $courses = $this->login()->coursesOf(11111);

View File

@ -11,7 +11,7 @@ class MemberFactoryTest extends TestCase
{ {
public function testItCanRenderMemberAsJson(): void public function testItCanRenderMemberAsJson(): void
{ {
$member = Member::factory()->toMember(); $member = Member::toFactory()->toMember();
$json = $member->toArray(); $json = $member->toArray();
$data = json_decode(json_encode($json)); $data = json_decode(json_encode($json));

View File

@ -11,7 +11,7 @@ class MembershipEntryFactoryTest extends TestCase
{ {
public function testItCanRenderACourseAsJson(): void public function testItCanRenderACourseAsJson(): void
{ {
$membership = MembershipEntry::factory()->toMembership(); $membership = MembershipEntry::toFactory()->toMembership();
$json = $membership->toArray(); $json = $membership->toArray();
$data = json_decode(json_encode($json)); $data = json_decode(json_encode($json));