Bladeren bron

wip testing

3.x
Andrew Wallo 1 jaar geleden
bovenliggende
commit
1ecc9c8cb6

+ 1
- 1
app/Filament/Company/Pages/Accounting/Transactions.php Bestand weergeven

@@ -497,7 +497,7 @@ class Transactions extends Page implements HasTable
497 497
         ];
498 498
     }
499 499
 
500
-    protected static function getUncategorizedAccountByType(TransactionType $type): ?Account
500
+    public static function getUncategorizedAccountByType(TransactionType $type): ?Account
501 501
     {
502 502
         [$category, $accountName] = match ($type) {
503 503
             TransactionType::Deposit => [AccountCategory::Revenue, 'Uncategorized Income'],

+ 99
- 98
composer.lock Bestand weergeven

@@ -497,16 +497,16 @@
497 497
         },
498 498
         {
499 499
             "name": "aws/aws-sdk-php",
500
-            "version": "3.323.1",
500
+            "version": "3.323.3",
501 501
             "source": {
502 502
                 "type": "git",
503 503
                 "url": "https://github.com/aws/aws-sdk-php.git",
504
-                "reference": "1b393c41a73e1ef4c493c60c5eee0bb4b0632264"
504
+                "reference": "9dec2a6453bdb32b3abeb475fc63b46ba1cbd996"
505 505
             },
506 506
             "dist": {
507 507
                 "type": "zip",
508
-                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/1b393c41a73e1ef4c493c60c5eee0bb4b0632264",
509
-                "reference": "1b393c41a73e1ef4c493c60c5eee0bb4b0632264",
508
+                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/9dec2a6453bdb32b3abeb475fc63b46ba1cbd996",
509
+                "reference": "9dec2a6453bdb32b3abeb475fc63b46ba1cbd996",
510 510
                 "shasum": ""
511 511
             },
512 512
             "require": {
@@ -589,9 +589,9 @@
589 589
             "support": {
590 590
                 "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
591 591
                 "issues": "https://github.com/aws/aws-sdk-php/issues",
592
-                "source": "https://github.com/aws/aws-sdk-php/tree/3.323.1"
592
+                "source": "https://github.com/aws/aws-sdk-php/tree/3.323.3"
593 593
             },
594
-            "time": "2024-10-04T18:07:17+00:00"
594
+            "time": "2024-10-08T18:05:47+00:00"
595 595
         },
596 596
         {
597 597
             "name": "aws/aws-sdk-php-laravel",
@@ -1660,16 +1660,16 @@
1660 1660
         },
1661 1661
         {
1662 1662
             "name": "filament/actions",
1663
-            "version": "v3.2.115",
1663
+            "version": "v3.2.116",
1664 1664
             "source": {
1665 1665
                 "type": "git",
1666 1666
                 "url": "https://github.com/filamentphp/actions.git",
1667
-                "reference": "38c6eb00c7e3265907b37482c2dfd411c6f910c9"
1667
+                "reference": "79dce62359b61b755a5e3d8faa0e047a1f92ad9a"
1668 1668
             },
1669 1669
             "dist": {
1670 1670
                 "type": "zip",
1671
-                "url": "https://api.github.com/repos/filamentphp/actions/zipball/38c6eb00c7e3265907b37482c2dfd411c6f910c9",
1672
-                "reference": "38c6eb00c7e3265907b37482c2dfd411c6f910c9",
1671
+                "url": "https://api.github.com/repos/filamentphp/actions/zipball/79dce62359b61b755a5e3d8faa0e047a1f92ad9a",
1672
+                "reference": "79dce62359b61b755a5e3d8faa0e047a1f92ad9a",
1673 1673
                 "shasum": ""
1674 1674
             },
1675 1675
             "require": {
@@ -1709,20 +1709,20 @@
1709 1709
                 "issues": "https://github.com/filamentphp/filament/issues",
1710 1710
                 "source": "https://github.com/filamentphp/filament"
1711 1711
             },
1712
-            "time": "2024-09-27T13:16:08+00:00"
1712
+            "time": "2024-10-08T14:24:13+00:00"
1713 1713
         },
1714 1714
         {
1715 1715
             "name": "filament/filament",
1716
-            "version": "v3.2.115",
1716
+            "version": "v3.2.116",
1717 1717
             "source": {
1718 1718
                 "type": "git",
1719 1719
                 "url": "https://github.com/filamentphp/panels.git",
1720
-                "reference": "8d0f0e7101c14fe2f00490172452767f16b39f02"
1720
+                "reference": "84f839b4b42549c0d4bd231648da17561ada70c2"
1721 1721
             },
1722 1722
             "dist": {
1723 1723
                 "type": "zip",
1724
-                "url": "https://api.github.com/repos/filamentphp/panels/zipball/8d0f0e7101c14fe2f00490172452767f16b39f02",
1725
-                "reference": "8d0f0e7101c14fe2f00490172452767f16b39f02",
1724
+                "url": "https://api.github.com/repos/filamentphp/panels/zipball/84f839b4b42549c0d4bd231648da17561ada70c2",
1725
+                "reference": "84f839b4b42549c0d4bd231648da17561ada70c2",
1726 1726
                 "shasum": ""
1727 1727
             },
1728 1728
             "require": {
@@ -1774,20 +1774,20 @@
1774 1774
                 "issues": "https://github.com/filamentphp/filament/issues",
1775 1775
                 "source": "https://github.com/filamentphp/filament"
1776 1776
             },
1777
-            "time": "2024-09-27T13:16:11+00:00"
1777
+            "time": "2024-10-08T14:24:12+00:00"
1778 1778
         },
1779 1779
         {
1780 1780
             "name": "filament/forms",
1781
-            "version": "v3.2.115",
1781
+            "version": "v3.2.116",
1782 1782
             "source": {
1783 1783
                 "type": "git",
1784 1784
                 "url": "https://github.com/filamentphp/forms.git",
1785
-                "reference": "ffa33043ea0ee67a4eed58535687f87311e4256b"
1785
+                "reference": "94f0c7c66d766efc0f1f5c80e790e2391c7c09d7"
1786 1786
             },
1787 1787
             "dist": {
1788 1788
                 "type": "zip",
1789
-                "url": "https://api.github.com/repos/filamentphp/forms/zipball/ffa33043ea0ee67a4eed58535687f87311e4256b",
1790
-                "reference": "ffa33043ea0ee67a4eed58535687f87311e4256b",
1789
+                "url": "https://api.github.com/repos/filamentphp/forms/zipball/94f0c7c66d766efc0f1f5c80e790e2391c7c09d7",
1790
+                "reference": "94f0c7c66d766efc0f1f5c80e790e2391c7c09d7",
1791 1791
                 "shasum": ""
1792 1792
             },
1793 1793
             "require": {
@@ -1830,20 +1830,20 @@
1830 1830
                 "issues": "https://github.com/filamentphp/filament/issues",
1831 1831
                 "source": "https://github.com/filamentphp/filament"
1832 1832
             },
1833
-            "time": "2024-09-27T13:16:04+00:00"
1833
+            "time": "2024-10-08T14:24:11+00:00"
1834 1834
         },
1835 1835
         {
1836 1836
             "name": "filament/infolists",
1837
-            "version": "v3.2.115",
1837
+            "version": "v3.2.116",
1838 1838
             "source": {
1839 1839
                 "type": "git",
1840 1840
                 "url": "https://github.com/filamentphp/infolists.git",
1841
-                "reference": "d4d3030644e3617aed252a5df3c385145ada0ec6"
1841
+                "reference": "fc5f01c094fe25ef906f3e1b88d3d8883a73d6be"
1842 1842
             },
1843 1843
             "dist": {
1844 1844
                 "type": "zip",
1845
-                "url": "https://api.github.com/repos/filamentphp/infolists/zipball/d4d3030644e3617aed252a5df3c385145ada0ec6",
1846
-                "reference": "d4d3030644e3617aed252a5df3c385145ada0ec6",
1845
+                "url": "https://api.github.com/repos/filamentphp/infolists/zipball/fc5f01c094fe25ef906f3e1b88d3d8883a73d6be",
1846
+                "reference": "fc5f01c094fe25ef906f3e1b88d3d8883a73d6be",
1847 1847
                 "shasum": ""
1848 1848
             },
1849 1849
             "require": {
@@ -1881,20 +1881,20 @@
1881 1881
                 "issues": "https://github.com/filamentphp/filament/issues",
1882 1882
                 "source": "https://github.com/filamentphp/filament"
1883 1883
             },
1884
-            "time": "2024-09-27T13:16:10+00:00"
1884
+            "time": "2024-10-08T14:24:09+00:00"
1885 1885
         },
1886 1886
         {
1887 1887
             "name": "filament/notifications",
1888
-            "version": "v3.2.115",
1888
+            "version": "v3.2.116",
1889 1889
             "source": {
1890 1890
                 "type": "git",
1891 1891
                 "url": "https://github.com/filamentphp/notifications.git",
1892
-                "reference": "0272612e1d54e0520f8717b24c71b9b70f198c8f"
1892
+                "reference": "a5f684b690354630210fc9a90bd06da9b1f6ae82"
1893 1893
             },
1894 1894
             "dist": {
1895 1895
                 "type": "zip",
1896
-                "url": "https://api.github.com/repos/filamentphp/notifications/zipball/0272612e1d54e0520f8717b24c71b9b70f198c8f",
1897
-                "reference": "0272612e1d54e0520f8717b24c71b9b70f198c8f",
1896
+                "url": "https://api.github.com/repos/filamentphp/notifications/zipball/a5f684b690354630210fc9a90bd06da9b1f6ae82",
1897
+                "reference": "a5f684b690354630210fc9a90bd06da9b1f6ae82",
1898 1898
                 "shasum": ""
1899 1899
             },
1900 1900
             "require": {
@@ -1933,20 +1933,20 @@
1933 1933
                 "issues": "https://github.com/filamentphp/filament/issues",
1934 1934
                 "source": "https://github.com/filamentphp/filament"
1935 1935
             },
1936
-            "time": "2024-09-27T13:16:07+00:00"
1936
+            "time": "2024-10-08T14:24:11+00:00"
1937 1937
         },
1938 1938
         {
1939 1939
             "name": "filament/support",
1940
-            "version": "v3.2.115",
1940
+            "version": "v3.2.116",
1941 1941
             "source": {
1942 1942
                 "type": "git",
1943 1943
                 "url": "https://github.com/filamentphp/support.git",
1944
-                "reference": "6dba51efd6f2a32db21bc8684cd663915ab0e4d7"
1944
+                "reference": "31fcff80b873b4decdba10d5f7010310e12c8e94"
1945 1945
             },
1946 1946
             "dist": {
1947 1947
                 "type": "zip",
1948
-                "url": "https://api.github.com/repos/filamentphp/support/zipball/6dba51efd6f2a32db21bc8684cd663915ab0e4d7",
1949
-                "reference": "6dba51efd6f2a32db21bc8684cd663915ab0e4d7",
1948
+                "url": "https://api.github.com/repos/filamentphp/support/zipball/31fcff80b873b4decdba10d5f7010310e12c8e94",
1949
+                "reference": "31fcff80b873b4decdba10d5f7010310e12c8e94",
1950 1950
                 "shasum": ""
1951 1951
             },
1952 1952
             "require": {
@@ -1956,7 +1956,7 @@
1956 1956
                 "illuminate/contracts": "^10.45|^11.0",
1957 1957
                 "illuminate/support": "^10.45|^11.0",
1958 1958
                 "illuminate/view": "^10.45|^11.0",
1959
-                "kirschbaum-development/eloquent-power-joins": "^3.0",
1959
+                "kirschbaum-development/eloquent-power-joins": "^3.0|^4.0",
1960 1960
                 "livewire/livewire": "^3.4.10 <= 3.5.6",
1961 1961
                 "php": "^8.1",
1962 1962
                 "ryangjchandler/blade-capture-directive": "^0.2|^0.3|^1.0",
@@ -1992,20 +1992,20 @@
1992 1992
                 "issues": "https://github.com/filamentphp/filament/issues",
1993 1993
                 "source": "https://github.com/filamentphp/filament"
1994 1994
             },
1995
-            "time": "2024-09-27T13:16:20+00:00"
1995
+            "time": "2024-10-08T14:24:29+00:00"
1996 1996
         },
1997 1997
         {
1998 1998
             "name": "filament/tables",
1999
-            "version": "v3.2.115",
1999
+            "version": "v3.2.116",
2000 2000
             "source": {
2001 2001
                 "type": "git",
2002 2002
                 "url": "https://github.com/filamentphp/tables.git",
2003
-                "reference": "07226fcd080f0f547aac31cf5117bfab192ea770"
2003
+                "reference": "152bf46a8f2c46f047835771a67085c2866b039b"
2004 2004
             },
2005 2005
             "dist": {
2006 2006
                 "type": "zip",
2007
-                "url": "https://api.github.com/repos/filamentphp/tables/zipball/07226fcd080f0f547aac31cf5117bfab192ea770",
2008
-                "reference": "07226fcd080f0f547aac31cf5117bfab192ea770",
2007
+                "url": "https://api.github.com/repos/filamentphp/tables/zipball/152bf46a8f2c46f047835771a67085c2866b039b",
2008
+                "reference": "152bf46a8f2c46f047835771a67085c2866b039b",
2009 2009
                 "shasum": ""
2010 2010
             },
2011 2011
             "require": {
@@ -2044,20 +2044,20 @@
2044 2044
                 "issues": "https://github.com/filamentphp/filament/issues",
2045 2045
                 "source": "https://github.com/filamentphp/filament"
2046 2046
             },
2047
-            "time": "2024-09-27T13:16:23+00:00"
2047
+            "time": "2024-10-08T14:24:25+00:00"
2048 2048
         },
2049 2049
         {
2050 2050
             "name": "filament/widgets",
2051
-            "version": "v3.2.115",
2051
+            "version": "v3.2.116",
2052 2052
             "source": {
2053 2053
                 "type": "git",
2054 2054
                 "url": "https://github.com/filamentphp/widgets.git",
2055
-                "reference": "06b70c4f260c91da03bdc51d1275543776ef7385"
2055
+                "reference": "14ae503aae8265ddc48274debbf7b7aefc7afb0b"
2056 2056
             },
2057 2057
             "dist": {
2058 2058
                 "type": "zip",
2059
-                "url": "https://api.github.com/repos/filamentphp/widgets/zipball/06b70c4f260c91da03bdc51d1275543776ef7385",
2060
-                "reference": "06b70c4f260c91da03bdc51d1275543776ef7385",
2059
+                "url": "https://api.github.com/repos/filamentphp/widgets/zipball/14ae503aae8265ddc48274debbf7b7aefc7afb0b",
2060
+                "reference": "14ae503aae8265ddc48274debbf7b7aefc7afb0b",
2061 2061
                 "shasum": ""
2062 2062
             },
2063 2063
             "require": {
@@ -2088,7 +2088,7 @@
2088 2088
                 "issues": "https://github.com/filamentphp/filament/issues",
2089 2089
                 "source": "https://github.com/filamentphp/filament"
2090 2090
             },
2091
-            "time": "2024-09-23T14:10:16+00:00"
2091
+            "time": "2024-10-08T14:24:26+00:00"
2092 2092
         },
2093 2093
         {
2094 2094
             "name": "firebase/php-jwt",
@@ -2774,27 +2774,28 @@
2774 2774
         },
2775 2775
         {
2776 2776
             "name": "kirschbaum-development/eloquent-power-joins",
2777
-            "version": "3.5.8",
2777
+            "version": "4.0.0",
2778 2778
             "source": {
2779 2779
                 "type": "git",
2780 2780
                 "url": "https://github.com/kirschbaum-development/eloquent-power-joins.git",
2781
-                "reference": "397ef08f15ceff48111fd7f57d9f1fd41bf1a453"
2781
+                "reference": "c6c42a52c5a097cc11761e72782b2d0215692caf"
2782 2782
             },
2783 2783
             "dist": {
2784 2784
                 "type": "zip",
2785
-                "url": "https://api.github.com/repos/kirschbaum-development/eloquent-power-joins/zipball/397ef08f15ceff48111fd7f57d9f1fd41bf1a453",
2786
-                "reference": "397ef08f15ceff48111fd7f57d9f1fd41bf1a453",
2785
+                "url": "https://api.github.com/repos/kirschbaum-development/eloquent-power-joins/zipball/c6c42a52c5a097cc11761e72782b2d0215692caf",
2786
+                "reference": "c6c42a52c5a097cc11761e72782b2d0215692caf",
2787 2787
                 "shasum": ""
2788 2788
             },
2789 2789
             "require": {
2790
-                "illuminate/database": "^8.0|^9.0|^10.0|^11.0",
2791
-                "illuminate/support": "^8.0|^9.0|^10.0|^11.0",
2792
-                "php": "^8.0"
2790
+                "illuminate/database": "^10.0|^11.0",
2791
+                "illuminate/support": "^10.0|^11.0",
2792
+                "php": "^8.1"
2793 2793
             },
2794 2794
             "require-dev": {
2795
+                "friendsofphp/php-cs-fixer": "dev-master",
2795 2796
                 "laravel/legacy-factories": "^1.0@dev",
2796
-                "orchestra/testbench": "^4.0|^5.0|^6.0|^7.0|^8.0|^9.0",
2797
-                "phpunit/phpunit": "^8.0|^9.0|^10.0"
2797
+                "orchestra/testbench": "^8.0|^9.0",
2798
+                "phpunit/phpunit": "^10.0"
2798 2799
             },
2799 2800
             "type": "library",
2800 2801
             "extra": {
@@ -2830,9 +2831,9 @@
2830 2831
             ],
2831 2832
             "support": {
2832 2833
                 "issues": "https://github.com/kirschbaum-development/eloquent-power-joins/issues",
2833
-                "source": "https://github.com/kirschbaum-development/eloquent-power-joins/tree/3.5.8"
2834
+                "source": "https://github.com/kirschbaum-development/eloquent-power-joins/tree/4.0.0"
2834 2835
             },
2835
-            "time": "2024-09-10T10:28:05+00:00"
2836
+            "time": "2024-10-06T12:28:14+00:00"
2836 2837
         },
2837 2838
         {
2838 2839
             "name": "knplabs/knp-snappy",
@@ -2903,16 +2904,16 @@
2903 2904
         },
2904 2905
         {
2905 2906
             "name": "laravel/framework",
2906
-            "version": "v11.26.0",
2907
+            "version": "v11.27.1",
2907 2908
             "source": {
2908 2909
                 "type": "git",
2909 2910
                 "url": "https://github.com/laravel/framework.git",
2910
-                "reference": "b8cb8998701d5b3cfe68539d3c3da1fc59ddd82b"
2911
+                "reference": "2634ad4a6a71da3288943f058a8abbfec6a65ebb"
2911 2912
             },
2912 2913
             "dist": {
2913 2914
                 "type": "zip",
2914
-                "url": "https://api.github.com/repos/laravel/framework/zipball/b8cb8998701d5b3cfe68539d3c3da1fc59ddd82b",
2915
-                "reference": "b8cb8998701d5b3cfe68539d3c3da1fc59ddd82b",
2915
+                "url": "https://api.github.com/repos/laravel/framework/zipball/2634ad4a6a71da3288943f058a8abbfec6a65ebb",
2916
+                "reference": "2634ad4a6a71da3288943f058a8abbfec6a65ebb",
2916 2917
                 "shasum": ""
2917 2918
             },
2918 2919
             "require": {
@@ -3108,7 +3109,7 @@
3108 3109
                 "issues": "https://github.com/laravel/framework/issues",
3109 3110
                 "source": "https://github.com/laravel/framework"
3110 3111
             },
3111
-            "time": "2024-10-01T14:29:34+00:00"
3112
+            "time": "2024-10-08T20:25:59+00:00"
3112 3113
         },
3113 3114
         {
3114 3115
             "name": "laravel/prompts",
@@ -3709,16 +3710,16 @@
3709 3710
         },
3710 3711
         {
3711 3712
             "name": "league/flysystem",
3712
-            "version": "3.29.0",
3713
+            "version": "3.29.1",
3713 3714
             "source": {
3714 3715
                 "type": "git",
3715 3716
                 "url": "https://github.com/thephpleague/flysystem.git",
3716
-                "reference": "0adc0d9a51852e170e0028a60bd271726626d3f0"
3717
+                "reference": "edc1bb7c86fab0776c3287dbd19b5fa278347319"
3717 3718
             },
3718 3719
             "dist": {
3719 3720
                 "type": "zip",
3720
-                "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/0adc0d9a51852e170e0028a60bd271726626d3f0",
3721
-                "reference": "0adc0d9a51852e170e0028a60bd271726626d3f0",
3721
+                "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/edc1bb7c86fab0776c3287dbd19b5fa278347319",
3722
+                "reference": "edc1bb7c86fab0776c3287dbd19b5fa278347319",
3722 3723
                 "shasum": ""
3723 3724
             },
3724 3725
             "require": {
@@ -3786,9 +3787,9 @@
3786 3787
             ],
3787 3788
             "support": {
3788 3789
                 "issues": "https://github.com/thephpleague/flysystem/issues",
3789
-                "source": "https://github.com/thephpleague/flysystem/tree/3.29.0"
3790
+                "source": "https://github.com/thephpleague/flysystem/tree/3.29.1"
3790 3791
             },
3791
-            "time": "2024-09-29T11:59:11+00:00"
3792
+            "time": "2024-10-08T08:58:34+00:00"
3792 3793
         },
3793 3794
         {
3794 3795
             "name": "league/flysystem-local",
@@ -4686,16 +4687,16 @@
4686 4687
         },
4687 4688
         {
4688 4689
             "name": "nette/schema",
4689
-            "version": "v1.3.1",
4690
+            "version": "v1.3.2",
4690 4691
             "source": {
4691 4692
                 "type": "git",
4692 4693
                 "url": "https://github.com/nette/schema.git",
4693
-                "reference": "9522dad6211c4d995a01a9ac529da88d0b0ba7b5"
4694
+                "reference": "da801d52f0354f70a638673c4a0f04e16529431d"
4694 4695
             },
4695 4696
             "dist": {
4696 4697
                 "type": "zip",
4697
-                "url": "https://api.github.com/repos/nette/schema/zipball/9522dad6211c4d995a01a9ac529da88d0b0ba7b5",
4698
-                "reference": "9522dad6211c4d995a01a9ac529da88d0b0ba7b5",
4698
+                "url": "https://api.github.com/repos/nette/schema/zipball/da801d52f0354f70a638673c4a0f04e16529431d",
4699
+                "reference": "da801d52f0354f70a638673c4a0f04e16529431d",
4699 4700
                 "shasum": ""
4700 4701
             },
4701 4702
             "require": {
@@ -4742,9 +4743,9 @@
4742 4743
             ],
4743 4744
             "support": {
4744 4745
                 "issues": "https://github.com/nette/schema/issues",
4745
-                "source": "https://github.com/nette/schema/tree/v1.3.1"
4746
+                "source": "https://github.com/nette/schema/tree/v1.3.2"
4746 4747
             },
4747
-            "time": "2024-10-05T03:01:50+00:00"
4748
+            "time": "2024-10-06T23:10:23+00:00"
4748 4749
         },
4749 4750
         {
4750 4751
             "name": "nette/utils",
@@ -4834,16 +4835,16 @@
4834 4835
         },
4835 4836
         {
4836 4837
             "name": "nikic/php-parser",
4837
-            "version": "v5.3.0",
4838
+            "version": "v5.3.1",
4838 4839
             "source": {
4839 4840
                 "type": "git",
4840 4841
                 "url": "https://github.com/nikic/PHP-Parser.git",
4841
-                "reference": "3abf7425cd284141dc5d8d14a9ee444de3345d1a"
4842
+                "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b"
4842 4843
             },
4843 4844
             "dist": {
4844 4845
                 "type": "zip",
4845
-                "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/3abf7425cd284141dc5d8d14a9ee444de3345d1a",
4846
-                "reference": "3abf7425cd284141dc5d8d14a9ee444de3345d1a",
4846
+                "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/8eea230464783aa9671db8eea6f8c6ac5285794b",
4847
+                "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b",
4847 4848
                 "shasum": ""
4848 4849
             },
4849 4850
             "require": {
@@ -4886,9 +4887,9 @@
4886 4887
             ],
4887 4888
             "support": {
4888 4889
                 "issues": "https://github.com/nikic/PHP-Parser/issues",
4889
-                "source": "https://github.com/nikic/PHP-Parser/tree/v5.3.0"
4890
+                "source": "https://github.com/nikic/PHP-Parser/tree/v5.3.1"
4890 4891
             },
4891
-            "time": "2024-09-29T13:56:26+00:00"
4892
+            "time": "2024-10-08T18:51:32+00:00"
4892 4893
         },
4893 4894
         {
4894 4895
             "name": "nunomaduro/termwind",
@@ -9154,16 +9155,16 @@
9154 9155
     "packages-dev": [
9155 9156
         {
9156 9157
             "name": "brianium/paratest",
9157
-            "version": "v7.5.6",
9158
+            "version": "v7.5.7",
9158 9159
             "source": {
9159 9160
                 "type": "git",
9160 9161
                 "url": "https://github.com/paratestphp/paratest.git",
9161
-                "reference": "8134d62d5b6f98b145f00db1421f39eb1fd0687b"
9162
+                "reference": "4890b17f569efea5e034e519dc883da53a67448d"
9162 9163
             },
9163 9164
             "dist": {
9164 9165
                 "type": "zip",
9165
-                "url": "https://api.github.com/repos/paratestphp/paratest/zipball/8134d62d5b6f98b145f00db1421f39eb1fd0687b",
9166
-                "reference": "8134d62d5b6f98b145f00db1421f39eb1fd0687b",
9166
+                "url": "https://api.github.com/repos/paratestphp/paratest/zipball/4890b17f569efea5e034e519dc883da53a67448d",
9167
+                "reference": "4890b17f569efea5e034e519dc883da53a67448d",
9167 9168
                 "shasum": ""
9168 9169
             },
9169 9170
             "require": {
@@ -9177,22 +9178,22 @@
9177 9178
                 "phpunit/php-code-coverage": "^11.0.6",
9178 9179
                 "phpunit/php-file-iterator": "^5.1.0",
9179 9180
                 "phpunit/php-timer": "^7.0.1",
9180
-                "phpunit/phpunit": "^11.3.6",
9181
+                "phpunit/phpunit": "^11.4.0",
9181 9182
                 "sebastian/environment": "^7.2.0",
9182
-                "symfony/console": "^6.4.11 || ^7.1.4",
9183
-                "symfony/process": "^6.4.8 || ^7.1.3"
9183
+                "symfony/console": "^6.4.11 || ^7.1.5",
9184
+                "symfony/process": "^6.4.8 || ^7.1.5"
9184 9185
             },
9185 9186
             "require-dev": {
9186 9187
                 "doctrine/coding-standard": "^12.0.0",
9187 9188
                 "ext-pcov": "*",
9188 9189
                 "ext-posix": "*",
9189
-                "infection/infection": "^0.29.6",
9190
-                "phpstan/phpstan": "^1.12.5",
9190
+                "infection/infection": "^0.29.7",
9191
+                "phpstan/phpstan": "^1.12.6",
9191 9192
                 "phpstan/phpstan-deprecation-rules": "^1.2.1",
9192 9193
                 "phpstan/phpstan-phpunit": "^1.4.0",
9193 9194
                 "phpstan/phpstan-strict-rules": "^1.6.1",
9194 9195
                 "squizlabs/php_codesniffer": "^3.10.3",
9195
-                "symfony/filesystem": "^6.4.9 || ^7.1.2"
9196
+                "symfony/filesystem": "^6.4.9 || ^7.1.5"
9196 9197
             },
9197 9198
             "bin": [
9198 9199
                 "bin/paratest",
@@ -9232,7 +9233,7 @@
9232 9233
             ],
9233 9234
             "support": {
9234 9235
                 "issues": "https://github.com/paratestphp/paratest/issues",
9235
-                "source": "https://github.com/paratestphp/paratest/tree/v7.5.6"
9236
+                "source": "https://github.com/paratestphp/paratest/tree/v7.5.7"
9236 9237
             },
9237 9238
             "funding": [
9238 9239
                 {
@@ -9244,7 +9245,7 @@
9244 9245
                     "type": "paypal"
9245 9246
                 }
9246 9247
             ],
9247
-            "time": "2024-10-02T05:22:28+00:00"
9248
+            "time": "2024-10-07T06:27:54+00:00"
9248 9249
         },
9249 9250
         {
9250 9251
             "name": "fakerphp/faker",
@@ -9619,16 +9620,16 @@
9619 9620
         },
9620 9621
         {
9621 9622
             "name": "laravel/sail",
9622
-            "version": "v1.34.0",
9623
+            "version": "v1.35.0",
9623 9624
             "source": {
9624 9625
                 "type": "git",
9625 9626
                 "url": "https://github.com/laravel/sail.git",
9626
-                "reference": "511e9c95b0f3ee778dc9e11e242bcd2af8e002cd"
9627
+                "reference": "992bc2d9e52174c79515967f30849d21daa334d8"
9627 9628
             },
9628 9629
             "dist": {
9629 9630
                 "type": "zip",
9630
-                "url": "https://api.github.com/repos/laravel/sail/zipball/511e9c95b0f3ee778dc9e11e242bcd2af8e002cd",
9631
-                "reference": "511e9c95b0f3ee778dc9e11e242bcd2af8e002cd",
9631
+                "url": "https://api.github.com/repos/laravel/sail/zipball/992bc2d9e52174c79515967f30849d21daa334d8",
9632
+                "reference": "992bc2d9e52174c79515967f30849d21daa334d8",
9632 9633
                 "shasum": ""
9633 9634
             },
9634 9635
             "require": {
@@ -9678,7 +9679,7 @@
9678 9679
                 "issues": "https://github.com/laravel/sail/issues",
9679 9680
                 "source": "https://github.com/laravel/sail"
9680 9681
             },
9681
-            "time": "2024-09-27T14:58:09+00:00"
9682
+            "time": "2024-10-08T14:45:26+00:00"
9682 9683
         },
9683 9684
         {
9684 9685
             "name": "mockery/mockery",

+ 12
- 0
database/factories/Accounting/TransactionFactory.php Bestand weergeven

@@ -133,6 +133,18 @@ class TransactionFactory extends Factory
133 133
         });
134 134
     }
135 135
 
136
+    public function forAccount(Account $account): static
137
+    {
138
+        return $this->state([
139
+            'account_id' => $account->id,
140
+        ]);
141
+    }
142
+
143
+    public function forType(TransactionType $type, int $amount): static
144
+    {
145
+        return $this->state(compact('type', 'amount'));
146
+    }
147
+
136 148
     public function asDeposit(int $amount): static
137 149
     {
138 150
         return $this->state(function () use ($amount) {

+ 3
- 3
package-lock.json Bestand weergeven

@@ -1159,9 +1159,9 @@
1159 1159
             "license": "MIT"
1160 1160
         },
1161 1161
         "node_modules/electron-to-chromium": {
1162
-            "version": "1.5.32",
1163
-            "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.32.tgz",
1164
-            "integrity": "sha512-M+7ph0VGBQqqpTT2YrabjNKSQ2fEl9PVx6AK3N558gDH9NO8O6XN9SXXFWRo9u9PbEg/bWq+tjXQr+eXmxubCw==",
1162
+            "version": "1.5.33",
1163
+            "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.33.tgz",
1164
+            "integrity": "sha512-+cYTcFB1QqD4j4LegwLfpCNxifb6dDFUAwk6RsLusCwIaZI6or2f+q8rs5tTB2YC53HhOlIbEaqHMAAC8IOIwA==",
1165 1165
             "dev": true,
1166 1166
             "license": "ISC"
1167 1167
         },

+ 343
- 24
tests/Feature/Accounting/TransactionTest.php Bestand weergeven

@@ -1,8 +1,18 @@
1 1
 <?php
2 2
 
3
+use App\Enums\Accounting\JournalEntryType;
4
+use App\Enums\Accounting\TransactionType;
5
+use App\Filament\Company\Pages\Accounting\Transactions;
6
+use App\Filament\Forms\Components\JournalEntryRepeater;
7
+use App\Filament\Tables\Actions\ReplicateBulkAction;
3 8
 use App\Models\Accounting\Account;
4 9
 use App\Models\Accounting\Transaction;
5 10
 use App\Utilities\Currency\ConfigureCurrencies;
11
+use Filament\Tables\Actions\DeleteAction;
12
+use Filament\Tables\Actions\DeleteBulkAction;
13
+use Filament\Tables\Actions\ReplicateAction;
14
+
15
+use function Pest\Livewire\livewire;
6 16
 
7 17
 it('creates correct journal entries for a deposit transaction', function () {
8 18
     $transaction = Transaction::factory()
@@ -59,14 +69,16 @@ it('does not create journal entries for a journal transaction', function () {
59 69
 });
60 70
 
61 71
 it('stores and sums correct debit and credit amounts for different transaction types', function ($method, $setupMethod, $amount) {
72
+    /** @var Transaction $transaction */
62 73
     $transaction = Transaction::factory()
63 74
         ->forDefaultBankAccount()
64 75
         ->{$setupMethod}()
65 76
         ->{$method}($amount)
66 77
         ->create();
67 78
 
68
-    expect($transaction->journalEntries->sumDebits()->getValue())->toEqual($amount)
69
-        ->and($transaction->journalEntries->sumCredits()->getValue())->toEqual($amount);
79
+    expect($transaction)
80
+        ->journalEntries->sumDebits()->getValue()->toEqual($amount)
81
+        ->journalEntries->sumCredits()->getValue()->toEqual($amount);
70 82
 })->with([
71 83
     ['asDeposit', 'forUncategorizedRevenue', 2000],
72 84
     ['asWithdrawal', 'forUncategorizedExpense', 500],
@@ -94,6 +106,7 @@ it('handles multi-currency transfers without conversion when the source bank acc
94 106
         ->withForeignBankAccount('Foreign Bank Account', 'EUR', 0.92)
95 107
         ->create();
96 108
 
109
+    /** @var Transaction $transaction */
97 110
     $transaction = Transaction::factory()
98 111
         ->forDefaultBankAccount()
99 112
         ->forDestinationBankAccount($foreignBankAccount)
@@ -102,12 +115,16 @@ it('handles multi-currency transfers without conversion when the source bank acc
102 115
 
103 116
     [$debitAccount, $creditAccount] = getTransactionDebitAndCreditAccounts($transaction);
104 117
 
105
-    expect($transaction->journalEntries->count())->toBe(2)
106
-        ->and($debitAccount->name)->toBe('Foreign Bank Account')
107
-        ->and($creditAccount->name)->toBe('Cash on Hand')
108
-        ->and($transaction->journalEntries->sumDebits()->getValue())->toEqual(1500)
109
-        ->and($transaction->journalEntries->sumCredits()->getValue())->toEqual(1500)
110
-        ->and($transaction->amount)->toEqual('1,500.00');
118
+    expect($debitAccount->is($foreignBankAccount))->toBeTrue()
119
+        ->and($creditAccount->name)->toBe('Cash on Hand');
120
+
121
+    $expectedUSDValue = 1500;
122
+
123
+    expect($transaction)
124
+        ->amount->toEqual('1,500.00')
125
+        ->journalEntries->count()->toBe(2)
126
+        ->journalEntries->sumDebits()->getValue()->toEqual($expectedUSDValue)
127
+        ->journalEntries->sumCredits()->getValue()->toEqual($expectedUSDValue);
111 128
 });
112 129
 
113 130
 it('handles multi-currency transfers correctly', function () {
@@ -118,6 +135,7 @@ it('handles multi-currency transfers correctly', function () {
118 135
     ConfigureCurrencies::syncCurrencies();
119 136
 
120 137
     // Create a transfer of 1500 CAD from the foreign bank account to USD bank account
138
+    /** @var Transaction $transaction */
121 139
     $transaction = Transaction::factory()
122 140
         ->forBankAccount($foreignBankAccount->bankAccount)
123 141
         ->forDestinationBankAccount()
@@ -126,18 +144,19 @@ it('handles multi-currency transfers correctly', function () {
126 144
 
127 145
     [$debitAccount, $creditAccount] = getTransactionDebitAndCreditAccounts($transaction);
128 146
 
129
-    expect($transaction->journalEntries->count())->toBe(2)
130
-        ->and($debitAccount->name)->toBe('Destination Bank Account') // Debit: Destination (USD) account
131
-        ->and($creditAccount->name)->toBe('CAD Bank Account'); // Credit: Foreign (CAD) account
147
+    expect($debitAccount->name)->toBe('Destination Bank Account') // Debit: Destination (USD) account
148
+        ->and($creditAccount->is($foreignBankAccount))->toBeTrue(); // Credit: Foreign Bank Account (CAD) account
132 149
 
133 150
     // The 1500 CAD is worth 1102.94 USD (1500 CAD / 1.36)
134 151
     $expectedUSDValue = round(1500 / 1.36, 2);
135 152
 
136 153
     // Verify that the debit is 1102.94 USD and the credit is 1500 CAD converted to 1102.94 USD
137 154
     // Transaction amount stays in source bank account currency (cast is applied)
138
-    expect($transaction->journalEntries->sumDebits()->getValue())->toEqual($expectedUSDValue)
139
-        ->and($transaction->journalEntries->sumCredits()->getValue())->toEqual($expectedUSDValue)
140
-        ->and($transaction->amount)->toEqual('1,500.00');
155
+    expect($transaction)
156
+        ->amount->toEqual('1,500.00')
157
+        ->journalEntries->count()->toBe(2)
158
+        ->journalEntries->sumDebits()->getValue()->toEqual($expectedUSDValue)
159
+        ->journalEntries->sumCredits()->getValue()->toEqual($expectedUSDValue);
141 160
 });
142 161
 
143 162
 it('handles multi-currency deposits correctly', function () {
@@ -148,6 +167,7 @@ it('handles multi-currency deposits correctly', function () {
148 167
     ConfigureCurrencies::syncCurrencies();
149 168
 
150 169
     // Create a deposit of 1500 BHD to the foreign bank account
170
+    /** @var Transaction $transaction */
151 171
     $transaction = Transaction::factory()
152 172
         ->forBankAccount($foreignBankAccount->bankAccount)
153 173
         ->forUncategorizedRevenue()
@@ -156,17 +176,18 @@ it('handles multi-currency deposits correctly', function () {
156 176
 
157 177
     [$debitAccount, $creditAccount] = getTransactionDebitAndCreditAccounts($transaction);
158 178
 
159
-    expect($transaction->journalEntries->count())->toBe(2)
160
-        ->and($debitAccount->name)->toBe('BHD Bank Account') // Debit: Foreign (BHD) account
179
+    expect($debitAccount->is($foreignBankAccount))->toBeTrue() // Debit: Foreign Bank Account (BHD) account
161 180
         ->and($creditAccount->name)->toBe('Uncategorized Income'); // Credit: Uncategorized Income (USD) account
162 181
 
163 182
     // Convert to USD using the rate 0.38 BHD per USD
164 183
     $expectedUSDValue = round(1500 / 0.38, 2);
165 184
 
166 185
     // Verify that the debit is 39473.68 USD and the credit is 1500 BHD converted to 39473.68 USD
167
-    expect($transaction->journalEntries->sumDebits()->getValue())->toEqual($expectedUSDValue)
168
-        ->and($transaction->journalEntries->sumCredits()->getValue())->toEqual($expectedUSDValue)
169
-        ->and($transaction->amount)->toEqual('1,500.000'); // Original amount in BHD (3 decimal precision)
186
+    expect($transaction)
187
+        ->amount->toEqual('1,500.000')
188
+        ->journalEntries->count()->toBe(2)
189
+        ->journalEntries->sumDebits()->getValue()->toEqual($expectedUSDValue)
190
+        ->journalEntries->sumCredits()->getValue()->toEqual($expectedUSDValue);
170 191
 });
171 192
 
172 193
 it('handles multi-currency withdrawals correctly', function () {
@@ -176,6 +197,7 @@ it('handles multi-currency withdrawals correctly', function () {
176 197
 
177 198
     ConfigureCurrencies::syncCurrencies();
178 199
 
200
+    /** @var Transaction $transaction */
179 201
     $transaction = Transaction::factory()
180 202
         ->forBankAccount($foreignBankAccount->bankAccount)
181 203
         ->forUncategorizedExpense()
@@ -184,13 +206,310 @@ it('handles multi-currency withdrawals correctly', function () {
184 206
 
185 207
     [$debitAccount, $creditAccount] = getTransactionDebitAndCreditAccounts($transaction);
186 208
 
187
-    expect($transaction->journalEntries->count())->toBe(2)
188
-        ->and($debitAccount->name)->toBe('Uncategorized Expense')
189
-        ->and($creditAccount->name)->toBe('Foreign Bank Account');
209
+    expect($debitAccount->name)->toBe('Uncategorized Expense')
210
+        ->and($creditAccount->is($foreignBankAccount))->toBeTrue();
190 211
 
191 212
     $expectedUSDValue = round(1500 / 0.76, 2);
192 213
 
193
-    expect($transaction->journalEntries->sumDebits()->getValue())->toEqual($expectedUSDValue)
194
-        ->and($transaction->journalEntries->sumCredits()->getValue())->toEqual($expectedUSDValue)
214
+    expect($transaction)
215
+        ->amount->toEqual('1,500.00')
216
+        ->journalEntries->count()->toBe(2)
217
+        ->journalEntries->sumDebits()->getValue()->toEqual($expectedUSDValue)
218
+        ->journalEntries->sumCredits()->getValue()->toEqual($expectedUSDValue);
219
+});
220
+
221
+it('can add an income or expense transaction', function (TransactionType $transactionType, string $actionName) {
222
+    $testCompany = $this->testCompany;
223
+    $defaultBankAccount = $testCompany->default->bankAccount;
224
+    $defaultAccount = Transactions::getUncategorizedAccountByType($transactionType);
225
+
226
+    livewire(Transactions::class)
227
+        ->mountAction($actionName)
228
+        ->assertActionDataSet([
229
+            'posted_at' => now()->toDateTimeString(),
230
+            'type' => $transactionType,
231
+            'bank_account_id' => $defaultBankAccount->id,
232
+            'amount' => '0.00',
233
+            'account_id' => $defaultAccount->id,
234
+        ])
235
+        ->setActionData([
236
+            'amount' => '500.00',
237
+        ])
238
+        ->callMountedAction()
239
+        ->assertHasNoActionErrors();
240
+
241
+    $transaction = Transaction::first();
242
+
243
+    expect($transaction)
244
+        ->not->toBeNull()
245
+        ->amount->toEqual('500.00')
246
+        ->type->toBe($transactionType)
247
+        ->bankAccount->is($defaultBankAccount)->toBeTrue()
248
+        ->account->is($defaultAccount)->toBeTrue()
249
+        ->journalEntries->count()->toBe(2);
250
+})->with([
251
+    [TransactionType::Deposit, 'addIncome'],
252
+    [TransactionType::Withdrawal, 'addExpense'],
253
+]);
254
+
255
+it('can add a transfer transaction', function () {
256
+    $testCompany = $this->testCompany;
257
+    $sourceBankAccount = $testCompany->default->bankAccount;
258
+    $destinationBankAccount = Account::factory()->withBankAccount('Destination Bank Account')->create();
259
+
260
+    livewire(Transactions::class)
261
+        ->mountAction('addTransfer')
262
+        ->assertActionDataSet([
263
+            'posted_at' => now()->toDateTimeString(),
264
+            'type' => TransactionType::Transfer,
265
+            'bank_account_id' => $sourceBankAccount->id,
266
+            'amount' => '0.00',
267
+            'account_id' => null,
268
+        ])
269
+        ->setActionData([
270
+            'account_id' => $destinationBankAccount->id,
271
+            'amount' => '1,500.00',
272
+        ])
273
+        ->callMountedAction()
274
+        ->assertHasNoActionErrors();
275
+
276
+    $transaction = Transaction::first();
277
+
278
+    expect($transaction)
279
+        ->not->toBeNull()
280
+        ->amount->toEqual('1,500.00')
281
+        ->type->toBe(TransactionType::Transfer)
282
+        ->bankAccount->is($sourceBankAccount)->toBeTrue()
283
+        ->account->is($destinationBankAccount)->toBeTrue()
284
+        ->journalEntries->count()->toBe(2);
285
+});
286
+
287
+it('can add a journal transaction', function () {
288
+    $defaultDebitAccount = Transactions::getUncategorizedAccountByType(TransactionType::Withdrawal);
289
+    $defaultCreditAccount = Transactions::getUncategorizedAccountByType(TransactionType::Deposit);
290
+
291
+    $undoRepeaterFake = JournalEntryRepeater::fake();
292
+
293
+    livewire(Transactions::class)
294
+        ->mountAction('addJournalTransaction')
295
+        ->assertActionDataSet([
296
+            'posted_at' => now()->toDateTimeString(),
297
+            'journalEntries' => [
298
+                ['type' => JournalEntryType::Debit, 'account_id' => $defaultDebitAccount->id, 'amount' => '0.00'],
299
+                ['type' => JournalEntryType::Credit, 'account_id' => $defaultCreditAccount->id, 'amount' => '0.00'],
300
+            ],
301
+        ])
302
+        ->setActionData([
303
+            'journalEntries' => [
304
+                ['amount' => '1,000.00'],
305
+                ['amount' => '1,000.00'],
306
+            ],
307
+        ])
308
+        ->callMountedAction()
309
+        ->assertHasNoActionErrors();
310
+
311
+    $undoRepeaterFake();
312
+
313
+    $transaction = Transaction::first();
314
+
315
+    [$debitAccount, $creditAccount] = getTransactionDebitAndCreditAccounts($transaction);
316
+
317
+    expect($transaction)
318
+        ->not->toBeNull()
319
+        ->amount->toEqual('1,000.00')
320
+        ->type->isJournal()->toBeTrue()
321
+        ->bankAccount->toBeNull()
322
+        ->account->toBeNull()
323
+        ->journalEntries->count()->toBe(2)
324
+        ->journalEntries->sumDebits()->getValue()->toEqual(1000)
325
+        ->journalEntries->sumCredits()->getValue()->toEqual(1000)
326
+        ->and($debitAccount->is($defaultDebitAccount))->toBeTrue()
327
+        ->and($creditAccount->is($defaultCreditAccount))->toBeTrue();
328
+});
329
+
330
+it('can update a deposit or withdrawal transaction', function (TransactionType $transactionType) {
331
+    $defaultAccount = Transactions::getUncategorizedAccountByType($transactionType);
332
+
333
+    $transaction = Transaction::factory()
334
+        ->forDefaultBankAccount()
335
+        ->forAccount($defaultAccount)
336
+        ->forType($transactionType, 1000)
337
+        ->create();
338
+
339
+    $newDescription = 'Updated Description';
340
+
341
+    livewire(Transactions::class)
342
+        ->mountTableAction('updateTransaction', $transaction)
343
+        ->assertTableActionDataSet([
344
+            'type' => $transactionType->value,
345
+            'description' => $transaction->description,
346
+            'amount' => $transaction->amount,
347
+        ])
348
+        ->setTableActionData([
349
+            'description' => $newDescription,
350
+            'amount' => '1,500.00',
351
+        ])
352
+        ->callMountedTableAction()
353
+        ->assertHasNoTableActionErrors();
354
+
355
+    $transaction->refresh();
356
+
357
+    expect($transaction->description)->toBe($newDescription)
195 358
         ->and($transaction->amount)->toEqual('1,500.00');
359
+})->with([
360
+    TransactionType::Deposit,
361
+    TransactionType::Withdrawal,
362
+]);
363
+
364
+it('does not show Edit Transfer or Edit Journal Transaction for deposit or withdrawal transactions', function (TransactionType $transactionType) {
365
+    $defaultAccount = Transactions::getUncategorizedAccountByType($transactionType);
366
+
367
+    $transaction = Transaction::factory()
368
+        ->forDefaultBankAccount()
369
+        ->forAccount($defaultAccount)
370
+        ->forType($transactionType, 1000)
371
+        ->create();
372
+
373
+    livewire(Transactions::class)
374
+        ->assertTableActionHidden('updateTransfer', $transaction)
375
+        ->assertTableActionHidden('updateJournalTransaction', $transaction);
376
+})->with([
377
+    TransactionType::Deposit,
378
+    TransactionType::Withdrawal,
379
+]);
380
+
381
+it('can update a transfer transaction', function () {
382
+    $transaction = Transaction::factory()
383
+        ->forDefaultBankAccount()
384
+        ->forDestinationBankAccount()
385
+        ->asTransfer(1500)
386
+        ->create();
387
+
388
+    $newDescription = 'Updated Transfer Description';
389
+
390
+    livewire(Transactions::class)
391
+        ->mountTableAction('updateTransfer', $transaction)
392
+        ->assertTableActionDataSet([
393
+            'type' => TransactionType::Transfer->value,
394
+            'description' => $transaction->description,
395
+            'amount' => $transaction->amount,
396
+        ])
397
+        ->setTableActionData([
398
+            'description' => $newDescription,
399
+            'amount' => '2,000.00',
400
+        ])
401
+        ->callMountedTableAction()
402
+        ->assertHasNoTableActionErrors();
403
+
404
+    $transaction->refresh();
405
+
406
+    expect($transaction->description)->toBe($newDescription)
407
+        ->and($transaction->amount)->toEqual('2,000.00');
408
+});
409
+
410
+it('does not show Edit Transaction or Edit Journal Transaction for transfer transactions', function () {
411
+    $transaction = Transaction::factory()
412
+        ->forDefaultBankAccount()
413
+        ->forDestinationBankAccount()
414
+        ->asTransfer(1500)
415
+        ->create();
416
+
417
+    livewire(Transactions::class)
418
+        ->assertTableActionHidden('updateTransaction', $transaction)
419
+        ->assertTableActionHidden('updateJournalTransaction', $transaction);
420
+});
421
+
422
+it('replicates a transaction with correct journal entries', function () {
423
+    $originalTransaction = Transaction::factory()
424
+        ->forDefaultBankAccount()
425
+        ->forUncategorizedRevenue()
426
+        ->asDeposit(1000)
427
+        ->create();
428
+
429
+    livewire(Transactions::class)
430
+        ->callTableAction(ReplicateAction::class, $originalTransaction);
431
+
432
+    $replicatedTransaction = Transaction::whereKeyNot($originalTransaction->getKey())->first();
433
+
434
+    expect($replicatedTransaction)->not->toBeNull();
435
+
436
+    [$originalDebitAccount, $originalCreditAccount] = getTransactionDebitAndCreditAccounts($originalTransaction);
437
+
438
+    [$replicatedDebitAccount, $replicatedCreditAccount] = getTransactionDebitAndCreditAccounts($replicatedTransaction);
439
+
440
+    expect($replicatedTransaction)
441
+        ->journalEntries->count()->toBe(2)
442
+        ->journalEntries->sumDebits()->getValue()->toEqual(1000)
443
+        ->journalEntries->sumCredits()->getValue()->toEqual(1000)
444
+        ->description->toBe('(Copy of) ' . $originalTransaction->description)
445
+        ->and($replicatedDebitAccount->name)->toBe($originalDebitAccount->name)
446
+        ->and($replicatedCreditAccount->name)->toBe($originalCreditAccount->name);
447
+});
448
+
449
+it('bulk replicates transactions with correct journal entries', function () {
450
+    $originalTransactions = Transaction::factory()
451
+        ->forDefaultBankAccount()
452
+        ->forUncategorizedRevenue()
453
+        ->asDeposit(1000)
454
+        ->count(3)
455
+        ->create();
456
+
457
+    livewire(Transactions::class)
458
+        ->callTableBulkAction(ReplicateBulkAction::class, $originalTransactions);
459
+
460
+    $replicatedTransactions = Transaction::whereKeyNot($originalTransactions->modelKeys())->get();
461
+
462
+    expect($replicatedTransactions->count())->toBe(3);
463
+
464
+    $originalTransactions->each(function (Transaction $originalTransaction) use ($replicatedTransactions) {
465
+        /** @var Transaction $replicatedTransaction */
466
+        $replicatedTransaction = $replicatedTransactions->firstWhere('description', '(Copy of) ' . $originalTransaction->description);
467
+
468
+        expect($replicatedTransaction)->not->toBeNull();
469
+
470
+        [$originalDebitAccount, $originalCreditAccount] = getTransactionDebitAndCreditAccounts($originalTransaction);
471
+
472
+        [$replicatedDebitAccount, $replicatedCreditAccount] = getTransactionDebitAndCreditAccounts($replicatedTransaction);
473
+
474
+        expect($replicatedTransaction)
475
+            ->journalEntries->count()->toBe(2)
476
+            ->journalEntries->sumDebits()->getValue()->toEqual(1000)
477
+            ->journalEntries->sumCredits()->getValue()->toEqual(1000)
478
+            ->and($replicatedDebitAccount->name)->toBe($originalDebitAccount->name)
479
+            ->and($replicatedCreditAccount->name)->toBe($originalCreditAccount->name);
480
+    });
481
+});
482
+
483
+it('can delete a transaction with journal entries', function () {
484
+    $transaction = Transaction::factory()
485
+        ->forDefaultBankAccount()
486
+        ->forUncategorizedRevenue()
487
+        ->asDeposit(1000)
488
+        ->create();
489
+
490
+    expect($transaction->journalEntries()->count())->toBe(2);
491
+
492
+    livewire(Transactions::class)
493
+        ->callTableAction(DeleteAction::class, $transaction);
494
+
495
+    $this->assertModelMissing($transaction);
496
+
497
+    $this->assertDatabaseEmpty('journal_entries');
498
+});
499
+
500
+it('can bulk delete transactions with journal entries', function () {
501
+    $transactions = Transaction::factory()
502
+        ->forDefaultBankAccount()
503
+        ->forUncategorizedRevenue()
504
+        ->asDeposit(1000)
505
+        ->count(3)
506
+        ->create();
507
+
508
+    expect($transactions->count())->toBe(3);
509
+
510
+    livewire(Transactions::class)
511
+        ->callTableBulkAction(DeleteBulkAction::class, $transactions);
512
+
513
+    $this->assertDatabaseEmpty('transactions');
514
+    $this->assertDatabaseEmpty('journal_entries');
196 515
 });

Laden…
Annuleren
Opslaan