File tree Expand file tree Collapse file tree
Integration/Greeting/Infrastructure
Unit/Greeting/Infrastructure Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2525 *
2626 * @mixin BaseModel
2727 */
28- class User extends User_parent implements PersonalGreetingUserInterface
28+ class User extends User_parent implements UserInterface
2929{
3030 use PersonalGreetingUser;
3131}
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ /**
4+ * Copyright © OXID eSales AG. All rights reserved.
5+ * See LICENSE file for license details.
6+ */
7+
8+ namespace OxidEsales \ExamplesModule \Extension \Model ;
9+
10+ use OxidEsales \ExamplesModule \Greeting \Model \PersonalGreetingUserInterface ;
11+
12+ interface UserInterface extends PersonalGreetingUserInterface
13+ {
14+ }
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ class UserModelFactory implements UserModelFactoryInterface
1818 */
1919 public function create (): User
2020 {
21- return oxNew (User::class); /** @phpstan-ignore return.type */
21+ /** @phpstan-ignore return.type */
22+ return oxNew (User::class);
2223 }
2324}
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ /**
4+ * Copyright © . All rights reserved.
5+ * See LICENSE file for license details.
6+ */
7+
8+ declare (strict_types=1 );
9+
10+ namespace OxidEsales \ExamplesModule \Tests \Unit \Greeting \Infrastructure ;
11+
12+ use OxidEsales \ExamplesModule \Extension \Model \UserInterface ;
13+ use OxidEsales \ExamplesModule \Greeting \Infrastructure \UserModelFactory ;
14+ use PHPUnit \Framework \Attributes \Test ;
15+ use PHPUnit \Framework \TestCase ;
16+
17+ /**
18+ * @covers \OxidEsales\ExamplesModule\Greeting\Infrastructure\UserModelFactory
19+ */
20+ class UserModelFactoryTest extends TestCase
21+ {
22+ #[Test]
23+ public function createProducesCorrectTypeOfObjects (): void
24+ {
25+ $ sut = new UserModelFactory ();
26+
27+ $ user = $ sut ->create ();
28+ $ this ->assertInstanceOf (UserInterface::class, $ user );
29+ }
30+
31+ #[Test]
32+ public function createProducesNewObjectsWithEveryCall (): void
33+ {
34+ $ sut = new UserModelFactory ();
35+
36+ $ user1 = $ sut ->create ();
37+ $ user2 = $ sut ->create ();
38+
39+ $ this ->assertNotSame ($ user1 , $ user2 );
40+ }
41+ }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments