Skip to content

Commit 3f3d697

Browse files
committed
Tests for ApiKey and Scope done
1 parent cb2f5b2 commit 3f3d697

32 files changed

+666
-33
lines changed

LaravelDoctrineApiKey.skipper

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0"?>
22
<skipper version="3.2.36.1772" mvc="Without MVC" orm="Doctrine2" name="doctrine-apikey" uuid="853f158e-72be-49b9-9f8c-ffef53333777">
3-
<module name="\MainBundle" local-name="MainBundle" namespace="\ApiSkeletons\Laravel\Doctrine\ApiKey" local-namespace="ApiSkeletons\Laravel\Doctrine\ApiKey" export-format="Doctrine2Xml" export-path="config/orm" uuid="5bbfe5b4-7579-44ee-81f9-fa036ee071a3">
4-
<entity name="\ApiSkeletons\Laravel\Doctrine\ApiKey\ApiKey" local-name="ApiKey" namespace="\ApiSkeletons\Laravel\Doctrine\ApiKey" uuid="5d41775f-e84c-4890-a202-19c4f93e3b58">
3+
<module name="\MainBundle" local-name="MainBundle" namespace="\ApiSkeletons\Laravel\Doctrine\ApiKey\Entity" local-namespace="ApiSkeletons\Laravel\Doctrine\ApiKey\Entity" export-format="Doctrine2Xml" export-path="config/orm" uuid="5bbfe5b4-7579-44ee-81f9-fa036ee071a3">
4+
<entity name="\ApiSkeletons\Laravel\Doctrine\ApiKey\Entity\ApiKey" local-name="ApiKey" namespace="\ApiSkeletons\Laravel\Doctrine\ApiKey\Entity" uuid="5d41775f-e84c-4890-a202-19c4f93e3b58">
55
<field name="id" type="bigint" required="true" unique="true" primary="true" auto-increment="true" uuid="1425ce9b-57d6-4c28-bd8b-89fffce92468"/>
66
<field name="name" type="string" required="true" unique="true" uuid="a0ea0895-aab4-4c93-b119-47c9539e95a2"/>
77
<field name="key" type="string" required="true" unique="true" uuid="e5a11137-9889-470a-8d5d-7ce1273d13df"/>
@@ -10,9 +10,10 @@
1010
<field name="deleted_at" type="datetime" uuid="49072f5c-bbbd-4e04-85df-656eaffd9025"/>
1111
<orm-attributes>
1212
<attribute name="table">api_keys</attribute>
13+
<attribute name="repository-class">ApiSkeletons\Laravel\Doctrine\ApiKey\Repository\ApiKeyRepository</attribute>
1314
</orm-attributes>
1415
</entity>
15-
<entity name="\ApiSkeletons\Laravel\Doctrine\ApiKey\AccessEvent" local-name="AccessEvent" namespace="\ApiSkeletons\Laravel\Doctrine\ApiKey" uuid="3affb470-569a-4814-9456-e72403fe11d1">
16+
<entity name="\ApiSkeletons\Laravel\Doctrine\ApiKey\Entity\AccessEvent" local-name="AccessEvent" namespace="\ApiSkeletons\Laravel\Doctrine\ApiKey\Entity" uuid="3affb470-569a-4814-9456-e72403fe11d1">
1617
<field name="id" type="bigint" required="true" unique="true" primary="true" auto-increment="true" uuid="c5dc4997-b4de-4e4b-a908-5a18449cb408"/>
1718
<field name="api_key_id" type="bigint" required="true" uuid="bbf2e1bc-0f62-4e9f-b7ca-2d7e22c183b7"/>
1819
<field name="ip_address" type="string" required="true" uuid="e2cbaf2c-9780-42d9-9268-fa01aab29a50"/>
@@ -22,10 +23,10 @@
2223
<attribute name="table">api_key_access_events</attribute>
2324
</orm-attributes>
2425
</entity>
25-
<association from="\ApiSkeletons\Laravel\Doctrine\ApiKey\AccessEvent" to="\ApiSkeletons\Laravel\Doctrine\ApiKey\ApiKey" caption="ApiKey AccessEvents" owner-alias="accessEvents" inverse-alias="apiKey" many-owner="true" many-inverse="false" parent-required="true" uuid="056be1e5-0677-44ad-8f6f-1b4023eb9a7d">
26+
<association from="\ApiSkeletons\Laravel\Doctrine\ApiKey\Entity\AccessEvent" to="\ApiSkeletons\Laravel\Doctrine\ApiKey\Entity\ApiKey" caption="ApiKey AccessEvents" owner-alias="accessEvents" inverse-alias="apiKey" many-owner="true" many-inverse="false" parent-required="true" uuid="056be1e5-0677-44ad-8f6f-1b4023eb9a7d">
2627
<association-field from="api_key_id" to="id" uuid="513eb40e-bd2d-4cd7-90c1-0bfadd7fd65b"/>
2728
</association>
28-
<entity name="\ApiSkeletons\Laravel\Doctrine\ApiKey\AdminEvent" local-name="AdminEvent" namespace="\ApiSkeletons\Laravel\Doctrine\ApiKey" uuid="69a65682-1289-49d8-a90b-4354347cb63a">
29+
<entity name="\ApiSkeletons\Laravel\Doctrine\ApiKey\Entity\AdminEvent" local-name="AdminEvent" namespace="\ApiSkeletons\Laravel\Doctrine\ApiKey\Entity" uuid="69a65682-1289-49d8-a90b-4354347cb63a">
2930
<field name="id" type="bigint" required="true" unique="true" primary="true" auto-increment="true" uuid="f0ee1b16-32ab-41a6-98ec-6d2dfa79fdf4"/>
3031
<field name="api_key_id" type="bigint" required="true" uuid="b4a70cfd-ff9e-4a70-91a8-aeb5b9a12e66"/>
3132
<field name="ip_address" type="string" required="true" uuid="829642e0-c00a-467a-982e-3300f7857a20"/>
@@ -35,29 +36,30 @@
3536
<attribute name="table">api_key_admin_events</attribute>
3637
</orm-attributes>
3738
</entity>
38-
<association from="\ApiSkeletons\Laravel\Doctrine\ApiKey\AdminEvent" to="\ApiSkeletons\Laravel\Doctrine\ApiKey\ApiKey" caption="ApiKey AdminEvents" owner-alias="adminEvents" inverse-alias="apiKey" many-owner="true" many-inverse="false" parent-required="true" uuid="c997c4aa-195c-4f0e-8a32-5506f53f0ab9">
39+
<association from="\ApiSkeletons\Laravel\Doctrine\ApiKey\Entity\AdminEvent" to="\ApiSkeletons\Laravel\Doctrine\ApiKey\Entity\ApiKey" caption="ApiKey AdminEvents" owner-alias="adminEvents" inverse-alias="apiKey" many-owner="true" many-inverse="false" parent-required="true" uuid="c997c4aa-195c-4f0e-8a32-5506f53f0ab9">
3940
<association-field from="api_key_id" to="id" uuid="3008ad81-ee90-414d-a9e1-942008dfdbd2"/>
4041
</association>
41-
<entity name="\ApiSkeletons\Laravel\Doctrine\ApiKey\Scope" local-name="Scope" namespace="\ApiSkeletons\Laravel\Doctrine\ApiKey" uuid="e2fc4483-5bba-4764-81cb-ca00f3a97ee2">
42+
<entity name="\ApiSkeletons\Laravel\Doctrine\ApiKey\Entity\Scope" local-name="Scope" namespace="\ApiSkeletons\Laravel\Doctrine\ApiKey\Entity" uuid="e2fc4483-5bba-4764-81cb-ca00f3a97ee2">
4243
<field name="id" type="integer" required="true" unique="true" primary="true" auto-increment="true" uuid="83bbd436-c932-4790-ae35-fa8e9fc6b440"/>
4344
<field name="name" type="string" required="true" unique="true" uuid="3e14cc31-010e-454e-b57a-103b82b8386c"/>
4445
<field name="created_at" type="datetime" required="true" uuid="d590b2e3-48a9-4a50-831c-f9847aac3d13"/>
4546
<orm-attributes>
4647
<attribute name="table">api_key_scopes</attribute>
48+
<attribute name="repository-class">ApiSkeletons\Laravel\Doctrine\ApiKey\Repository\ScopeRepository</attribute>
4749
</orm-attributes>
4850
</entity>
49-
<entity name="\ApiSkeletons\Laravel\Doctrine\ApiKey\ApiKeyToScope" local-name="ApiKeyToScope" namespace="\ApiSkeletons\Laravel\Doctrine\ApiKey" uuid="b9c06238-4131-4393-b380-09fd0e013f59">
51+
<entity name="\ApiSkeletons\Laravel\Doctrine\ApiKey\Entity\ApiKeyToScope" local-name="ApiKeyToScope" namespace="\ApiSkeletons\Laravel\Doctrine\ApiKey\Entity" uuid="b9c06238-4131-4393-b380-09fd0e013f59">
5052
<field name="scope_id" type="integer" required="true" primary="true" uuid="10cf6d1a-8e05-457a-8ed2-c5625a73dd05"/>
5153
<field name="api_key_id" type="bigint" required="true" primary="true" uuid="4f02d09a-6c5e-4bc8-88fd-7a6990ef36fe"/>
5254
<orm-attributes>
5355
<attribute name="table">api_keys_to_scopes</attribute>
5456
</orm-attributes>
5557
</entity>
56-
<many-to-many mn-entity="\ApiSkeletons\Laravel\Doctrine\ApiKey\ApiKeyToScope" caption="ApiKey to Scope" uuid="f3287250-6321-4387-b98d-40b7df23f443">
57-
<many-to-many-entity name="\ApiSkeletons\Laravel\Doctrine\ApiKey\Scope" owning-side="true" alias="scopes" uuid="f75b71c7-98c4-4a41-88ad-6a9609396693">
58+
<many-to-many mn-entity="\ApiSkeletons\Laravel\Doctrine\ApiKey\Entity\ApiKeyToScope" caption="ApiKey to Scope" uuid="f3287250-6321-4387-b98d-40b7df23f443">
59+
<many-to-many-entity name="\ApiSkeletons\Laravel\Doctrine\ApiKey\Entity\Scope" owning-side="true" alias="scopes" uuid="f75b71c7-98c4-4a41-88ad-6a9609396693">
5860
<many-to-many-field from="scope_id" to="id" uuid="0eb7b1ed-b349-4194-a950-367fcedf472d"/>
5961
</many-to-many-entity>
60-
<many-to-many-entity name="\ApiSkeletons\Laravel\Doctrine\ApiKey\ApiKey" owning-side="false" alias="apiKeys" uuid="0a6141b6-7908-46b6-b601-1baf1f494b63">
62+
<many-to-many-entity name="\ApiSkeletons\Laravel\Doctrine\ApiKey\Entity\ApiKey" owning-side="false" alias="apiKeys" uuid="0a6141b6-7908-46b6-b601-1baf1f494b63">
6163
<many-to-many-field from="api_key_id" to="id" uuid="372299e3-ff2e-4880-a61e-4fe2a6b6ac36"/>
6264
</many-to-many-entity>
6365
</many-to-many>

composer.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@
55
"license": "MIT",
66
"autoload": {
77
"psr-4": {
8-
"ApiSkeletons\\Laravel\\Doctrine\\Apikey\\": "src/"
8+
"ApiSkeletons\\Laravel\\Doctrine\\ApiKey\\": "src/"
9+
}
10+
},
11+
"autoload-dev": {
12+
"psr-4": {
13+
"ApiSkeletonsTest\\Laravel\\Doctrine\\ApiKey\\": "test/"
914
}
1015
},
1116
"authors": [
@@ -19,7 +24,8 @@
1924
"laravel-doctrine/orm": "^1.6"
2025
},
2126
"require-dev": {
22-
"phpunit/phpunit": "^9.5"
27+
"phpunit/phpunit": "^9.5",
28+
"orchestra/testbench": "^6.23"
2329
},
2430
"extra": {
2531
"laravel": {
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0"?>
2+
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
3+
<entity name="ApiSkeletons\Laravel\Doctrine\ApiKey\Entity\AccessEvent" table="api_key_access_events">
4+
<id name="id" type="bigint">
5+
<generator strategy="AUTO"/>
6+
</id>
7+
<field name="ip_address" type="string" nullable="false"/>
8+
<field name="url" type="text" nullable="false"/>
9+
<field name="created_at" type="datetime" nullable="false"/>
10+
<many-to-one field="apiKey" target-entity="ApiSkeletons\Laravel\Doctrine\ApiKey\Entity\ApiKey" inversed-by="accessEvents">
11+
<join-columns>
12+
<join-column name="api_key_id" referenced-column-name="id" nullable="false"/>
13+
</join-columns>
14+
</many-to-one>
15+
</entity>
16+
</doctrine-mapping>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0"?>
2+
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
3+
<entity name="ApiSkeletons\Laravel\Doctrine\ApiKey\Entity\AdminEvent" table="api_key_admin_events">
4+
<id name="id" type="bigint">
5+
<generator strategy="AUTO"/>
6+
</id>
7+
<field name="ip_address" type="string" nullable="false"/>
8+
<field name="event" type="string" nullable="false"/>
9+
<field name="created_at" type="datetime" nullable="false"/>
10+
<many-to-one field="apiKey" target-entity="ApiSkeletons\Laravel\Doctrine\ApiKey\Entity\ApiKey" inversed-by="adminEvents">
11+
<join-columns>
12+
<join-column name="api_key_id" referenced-column-name="id" nullable="false"/>
13+
</join-columns>
14+
</many-to-one>
15+
</entity>
16+
</doctrine-mapping>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0"?>
2+
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
3+
<entity name="ApiSkeletons\Laravel\Doctrine\ApiKey\Entity\ApiKey" table="api_keys" repository-class="ApiSkeletons\Laravel\Doctrine\ApiKey\Repository\ApiKeyRepository">
4+
<id name="id" type="bigint">
5+
<generator strategy="AUTO"/>
6+
</id>
7+
<field name="name" type="string" unique="true" nullable="false"/>
8+
<field name="key" type="string" unique="true" nullable="false"/>
9+
<field name="is_deleted" type="boolean" nullable="false"/>
10+
<field name="created_at" type="datetime" nullable="false"/>
11+
<field name="deleted_at" type="datetime" nullable="true"/>
12+
<one-to-many field="accessEvents" target-entity="ApiSkeletons\Laravel\Doctrine\ApiKey\Entity\AccessEvent" mapped-by="apiKey"/>
13+
<one-to-many field="adminEvents" target-entity="ApiSkeletons\Laravel\Doctrine\ApiKey\Entity\AdminEvent" mapped-by="apiKey"/>
14+
<many-to-many field="scopes" target-entity="ApiSkeletons\Laravel\Doctrine\ApiKey\Entity\Scope" mapped-by="apiKeys"/>
15+
</entity>
16+
</doctrine-mapping>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0"?>
2+
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
3+
<entity name="ApiSkeletons\Laravel\Doctrine\ApiKey\Entity\Scope" table="api_key_scopes" repository-class="ApiSkeletons\Laravel\Doctrine\ApiKey\Repository\ScopeRepository">
4+
<id name="id" type="integer">
5+
<generator strategy="AUTO"/>
6+
</id>
7+
<field name="name" type="string" unique="true" nullable="false"/>
8+
<field name="created_at" type="datetime" nullable="false"/>
9+
<many-to-many field="apiKeys" target-entity="ApiSkeletons\Laravel\Doctrine\ApiKey\Entity\ApiKey" inversed-by="scopes">
10+
<join-table name="api_keys_to_scopes">
11+
<join-columns>
12+
<join-column name="scope_id" referenced-column-name="id" nullable="false"/>
13+
</join-columns>
14+
<inverse-join-columns>
15+
<join-column name="api_key_id" referenced-column-name="id" nullable="false"/>
16+
</inverse-join-columns>
17+
</join-table>
18+
</many-to-many>
19+
</entity>
20+
</doctrine-mapping>

src/Command/AddScopeToApiKey.php

Whitespace-only changes.

src/Command/CreateApiKey.php

Whitespace-only changes.

src/Command/CreateScope.php

Whitespace-only changes.

src/Command/DeleteApiKey.php

Whitespace-only changes.

0 commit comments

Comments
 (0)