@@ 57-80 (lines=24) @@ | ||
54 | /** |
|
55 | * @test |
|
56 | */ |
|
57 | public function shouldCreateAnEntity() |
|
58 | { |
|
59 | $controller = new GenericEntityCreateController( |
|
60 | $this->controllerHelper, |
|
61 | $this->argumentBuilder, |
|
62 | $this->container, |
|
63 | [ |
|
64 | 'entity-class' => SampleEntity::class |
|
65 | ] |
|
66 | ); |
|
67 | ||
68 | $this->controllerHelper->expects($this->once())->method('flushORM'); |
|
69 | $this->controllerHelper->expects($this->once())->method('persistEntity')->with( |
|
70 | $this->equalTo(new SampleEntity()) |
|
71 | ); |
|
72 | ||
73 | /** @var Request $request */ |
|
74 | $request = $this->createMock(Request::class); |
|
75 | ||
76 | /** @var Response $response */ |
|
77 | $response = $controller->createEntity($request); |
|
78 | ||
79 | $this->assertEquals(200, $response->getStatusCode()); |
|
80 | } |
|
81 | ||
82 | /** |
|
83 | * @test |
|
@@ 528-553 (lines=26) @@ | ||
525 | /** |
|
526 | * @test |
|
527 | */ |
|
528 | public function shouldBeCallableByInvokingController() |
|
529 | { |
|
530 | $controller = new GenericEntityCreateController( |
|
531 | $this->controllerHelper, |
|
532 | $this->argumentBuilder, |
|
533 | $this->container, |
|
534 | [ |
|
535 | 'entity-class' => SampleEntity::class |
|
536 | ] |
|
537 | ); |
|
538 | ||
539 | $this->controllerHelper->expects($this->once())->method('flushORM'); |
|
540 | $this->controllerHelper->expects($this->once())->method('persistEntity')->with( |
|
541 | $this->equalTo(new SampleEntity()) |
|
542 | ); |
|
543 | ||
544 | /** @var Request $request */ |
|
545 | $request = $this->createMock(Request::class); |
|
546 | ||
547 | $this->controllerHelper->method('getCurrentRequest')->willReturn($request); |
|
548 | ||
549 | /** @var Response $response */ |
|
550 | $response = $controller(); |
|
551 | ||
552 | $this->assertEquals(200, $response->getStatusCode()); |
|
553 | } |
|
554 | ||
555 | /** |
|
556 | * @test |