Update .gitignore

This commit is contained in:
David Bomba
2026-03-24 12:59:26 +11:00
parent 2df9e25eeb
commit 379479589f
7 changed files with 153 additions and 175 deletions

14
.gitignore vendored
View File

@@ -30,14 +30,22 @@ _ide_helper.php
# Ignore local migrations
storage/migrations
nbproject
.php_cs.cache
public/test.pdf
public/storage/test.pdf
/Modules
Modules/
_ide_helper_models.php
_ide_helper.php
/composer.phar
.tx/
.phpunit.cache
.phpunit.cache
CLAUDE.md
boost.json
AGENTS.md
junie/
.agents/
.claude/
.codex/
.cursor/
.mcp.json

View File

@@ -14966,9 +14966,9 @@
<!--ASSERT -->
<xsl:choose>
<xsl:when test="((not(contains(normalize-space(@schemeID), ' ')) and contains(' 0001 0002 0003 0004 0005 0006 0007 0008 0009 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 0090 0091 0093 0094 0095 0096 0097 0098 0099 0100 0101 0102 0104 0105 0106 0107 0108 0109 0110 0111 0112 0113 0114 0115 0116 0117 0118 0119 0120 0121 0122 0123 0124 0125 0126 0127 0128 0129 0130 0131 0132 0133 0134 0135 0136 0137 0138 0139 0140 0141 0142 0143 0144 0145 0146 0147 0148 0149 0150 0151 0152 0153 0154 0155 0156 0157 0158 0159 0160 0161 0162 0163 0164 0165 0166 0167 0168 0169 0170 0171 0172 0173 0174 0175 0176 0177 0178 0179 0180 0183 0184 0185 0186 0187 0188 0189 0190 0191 0192 0193 0194 0195 0196 0197 0198 0199 0200 0201 0202 0203 0204 ', concat(' ', normalize-space(@schemeID), ' ')))) or ((not(contains(normalize-space(@schemeID), ' ')) and contains(' SEPA ', concat(' ', normalize-space(@schemeID), ' '))) and ((ancestor::cac:AccountingSupplierParty) or (ancestor::cac:PayeeParty)))" />
<xsl:when test="((not(contains(normalize-space(@schemeID), ' ')) and contains(' 0001 0002 0003 0004 0005 0006 0007 0008 0009 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 0090 0091 0093 0094 0095 0096 0097 0098 0099 0100 0101 0102 0104 0105 0106 0107 0108 0109 0110 0111 0112 0113 0114 0115 0116 0117 0118 0119 0120 0121 0122 0123 0124 0125 0126 0127 0128 0129 0130 0131 0132 0133 0134 0135 0136 0137 0138 0139 0140 0141 0142 0143 0144 0145 0146 0147 0148 0149 0150 0151 0152 0153 0154 0155 0156 0157 0158 0159 0160 0161 0162 0163 0164 0165 0166 0167 0168 0169 0170 0171 0172 0173 0174 0175 0176 0177 0178 0179 0180 0183 0184 0185 0186 0187 0188 0189 0190 0191 0192 0193 0194 0195 0196 0197 0198 0199 0200 0201 0202 0203 0204 0205 0206 0207 0208 0209 0210 0211 0212 0213 0215 0216 0218 0221 0230 ', concat(' ', normalize-space(@schemeID), ' ')))) or ((not(contains(normalize-space(@schemeID), ' ')) and contains(' SEPA ', concat(' ', normalize-space(@schemeID), ' '))) and ((ancestor::cac:AccountingSupplierParty) or (ancestor::cac:PayeeParty)))" />
<xsl:otherwise>
<svrl:failed-assert test="((not(contains(normalize-space(@schemeID), ' ')) and contains(' 0001 0002 0003 0004 0005 0006 0007 0008 0009 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 0090 0091 0093 0094 0095 0096 0097 0098 0099 0100 0101 0102 0104 0105 0106 0107 0108 0109 0110 0111 0112 0113 0114 0115 0116 0117 0118 0119 0120 0121 0122 0123 0124 0125 0126 0127 0128 0129 0130 0131 0132 0133 0134 0135 0136 0137 0138 0139 0140 0141 0142 0143 0144 0145 0146 0147 0148 0149 0150 0151 0152 0153 0154 0155 0156 0157 0158 0159 0160 0161 0162 0163 0164 0165 0166 0167 0168 0169 0170 0171 0172 0173 0174 0175 0176 0177 0178 0179 0180 0183 0184 0185 0186 0187 0188 0189 0190 0191 0192 0193 0194 0195 0196 0197 0198 0199 0200 0201 0202 0203 0204 ', concat(' ', normalize-space(@schemeID), ' ')))) or ((not(contains(normalize-space(@schemeID), ' ')) and contains(' SEPA ', concat(' ', normalize-space(@schemeID), ' '))) and ((ancestor::cac:AccountingSupplierParty) or (ancestor::cac:PayeeParty)))">
<svrl:failed-assert test="((not(contains(normalize-space(@schemeID), ' ')) and contains(' 0001 0002 0003 0004 0005 0006 0007 0008 0009 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 0090 0091 0093 0094 0095 0096 0097 0098 0099 0100 0101 0102 0104 0105 0106 0107 0108 0109 0110 0111 0112 0113 0114 0115 0116 0117 0118 0119 0120 0121 0122 0123 0124 0125 0126 0127 0128 0129 0130 0131 0132 0133 0134 0135 0136 0137 0138 0139 0140 0141 0142 0143 0144 0145 0146 0147 0148 0149 0150 0151 0152 0153 0154 0155 0156 0157 0158 0159 0160 0161 0162 0163 0164 0165 0166 0167 0168 0169 0170 0171 0172 0173 0174 0175 0176 0177 0178 0179 0180 0183 0184 0185 0186 0187 0188 0189 0190 0191 0192 0193 0194 0195 0196 0197 0198 0199 0200 0201 0202 0203 0204 0205 0206 0207 0208 0209 0210 0211 0212 0213 0215 0216 0218 0221 0230 ', concat(' ', normalize-space(@schemeID), ' ')))) or ((not(contains(normalize-space(@schemeID), ' ')) and contains(' SEPA ', concat(' ', normalize-space(@schemeID), ' '))) and ((ancestor::cac:AccountingSupplierParty) or (ancestor::cac:PayeeParty)))">
<xsl:attribute name="id">BR-CL-10</xsl:attribute>
<xsl:attribute name="flag">fatal</xsl:attribute>
<xsl:attribute name="location">
@@ -15262,9 +15262,9 @@
<!--ASSERT -->
<xsl:choose>
<xsl:when test="((not(contains(normalize-space(@schemeID), ' ')) and contains(' 0002 0007 0009 0037 0060 0088 0096 0097 0106 0130 0135 0142 0151 0183 0184 0190 0191 0192 0193 0195 0196 0198 0199 0200 0201 0202 0203 0204 9901 9902 9904 9905 9906 9907 9910 9913 9914 9915 9918 9919 9920 9922 9923 9924 9925 9926 9927 9928 9929 9930 9931 9932 9933 9934 9935 9936 9937 9938 9939 9940 9941 9942 9943 9944 9945 9946 9947 9948 9949 9950 9951 9952 9953 9955 9956 9957 9958 AN AQ AS AU EM ', concat(' ', normalize-space(@schemeID), ' '))))" />
<xsl:when test="((not(contains(normalize-space(@schemeID), ' ')) and contains(' 0002 0007 0009 0037 0060 0088 0096 0097 0106 0130 0135 0142 0151 0183 0184 0190 0191 0192 0193 0195 0196 0198 0199 0200 0201 0202 0203 0204 0205 0206 0207 0208 0209 0210 0211 0212 0213 0215 0216 0218 0221 0230 9901 9902 9904 9905 9906 9907 9910 9913 9914 9915 9918 9919 9920 9922 9923 9924 9925 9926 9927 9928 9929 9930 9931 9932 9933 9934 9935 9936 9937 9938 9939 9940 9941 9942 9943 9944 9945 9946 9947 9948 9949 9950 9951 9952 9953 9955 9956 9957 9958 AN AQ AS AU EM ', concat(' ', normalize-space(@schemeID), ' '))))" />
<xsl:otherwise>
<svrl:failed-assert test="((not(contains(normalize-space(@schemeID), ' ')) and contains(' 0002 0007 0009 0037 0060 0088 0096 0097 0106 0130 0135 0142 0151 0183 0184 0190 0191 0192 0193 0195 0196 0198 0199 0200 0201 0202 0203 0204 9901 9902 9904 9905 9906 9907 9910 9913 9914 9915 9918 9919 9920 9922 9923 9924 9925 9926 9927 9928 9929 9930 9931 9932 9933 9934 9935 9936 9937 9938 9939 9940 9941 9942 9943 9944 9945 9946 9947 9948 9949 9950 9951 9952 9953 9955 9956 9957 9958 AN AQ AS AU EM ', concat(' ', normalize-space(@schemeID), ' '))))">
<svrl:failed-assert test="((not(contains(normalize-space(@schemeID), ' ')) and contains(' 0002 0007 0009 0037 0060 0088 0096 0097 0106 0130 0135 0142 0151 0183 0184 0190 0191 0192 0193 0195 0196 0198 0199 0200 0201 0202 0203 0204 0205 0206 0207 0208 0209 0210 0211 0212 0213 0215 0216 0218 0221 0230 9901 9902 9904 9905 9906 9907 9910 9913 9914 9915 9918 9919 9920 9922 9923 9924 9925 9926 9927 9928 9929 9930 9931 9932 9933 9934 9935 9936 9937 9938 9939 9940 9941 9942 9943 9944 9945 9946 9947 9948 9949 9950 9951 9952 9953 9955 9956 9957 9958 AN AQ AS AU EM ', concat(' ', normalize-space(@schemeID), ' '))))">
<xsl:attribute name="id">BR-CL-25</xsl:attribute>
<xsl:attribute name="flag">fatal</xsl:attribute>
<xsl:attribute name="location">

View File

@@ -1448,7 +1448,7 @@
<xsl:variable name="UNCL5189" select="tokenize('41 42 60 62 63 64 65 66 67 68 70 71 88 95 100 102 103 104 105', '\s')" />
<xsl:variable name="UNCL7161" select="tokenize('AA AAA AAC AAD AAE AAF AAH AAI AAS AAT AAV AAY AAZ ABA ABB ABC ABD ABF ABK ABL ABN ABR ABS ABT ABU ACF ACG ACH ACI ACJ ACK ACL ACM ACS ADC ADE ADJ ADK ADL ADM ADN ADO ADP ADQ ADR ADT ADW ADY ADZ AEA AEB AEC AED AEF AEH AEI AEJ AEK AEL AEM AEN AEO AEP AES AET AEU AEV AEW AEX AEY AEZ AJ AU CA CAB CAD CAE CAF CAI CAJ CAK CAL CAM CAN CAO CAP CAQ CAR CAS CAT CAU CAV CAW CD CG CS CT DAB DAD DL EG EP ER FAA FAB FAC FC FH FI GAA HAA HD HH IAA IAB ID IF IR IS KO L1 LA LAA LAB LF MAE MI ML NAA OA PA PAA PC PL RAB RAC RAD RAF RE RF RH RV SA SAA SAD SAE SAI SG SH SM SU TAB TAC TT TV V1 V2 WH XAA YY ZZZ', '\s')" />
<xsl:variable name="UNCL5305" select="tokenize('AE E S Z G O K L M', '\s')" />
<xsl:variable name="eaid" select="tokenize('0002 0007 0009 0037 0060 0088 0096 0097 0106 0135 0142 0151 0183 0184 0190 0191 0192 0193 0195 0196 0198 0199 0200 0201 0202 9901 9902 9904 9905 9906 9907 9910 9913 9914 9915 9917 9918 9919 9920 9921 9922 9923 9924 9925 9926 9927 9928 9929 9930 9931 9932 9933 9934 9935 9936 9937 9938 9939 9940 9941 9942 9943 9944 9945 9946 9947 9948 9949 9950 9951 9952 9953 9955 9956 9957 9958', '\s')" />
<xsl:variable name="eaid" select="tokenize('0002 0007 0009 0037 0060 0088 0096 0097 0106 0130 0135 0142 0151 0183 0184 0190 0191 0192 0193 0195 0196 0198 0199 0200 0201 0202 0203 0204 0205 0206 0207 0208 0209 0210 0211 0212 0213 0215 0216 0218 0221 0230 9901 9902 9904 9905 9906 9907 9910 9913 9914 9915 9917 9918 9919 9920 9921 9922 9923 9924 9925 9926 9927 9928 9929 9930 9931 9932 9933 9934 9935 9936 9937 9938 9939 9940 9941 9942 9943 9944 9945 9946 9947 9948 9949 9950 9951 9952 9953 9955 9956 9957 9958', '\s')" />
<!--RULE -->
<xsl:template match="cbc:EmbeddedDocumentBinaryObject[@mimeCode]" mode="M19" priority="1008">

View File

@@ -127,7 +127,7 @@
"friendsofphp/php-cs-fixer": "^3.14",
"laracasts/cypress": "^3.0",
"larastan/larastan": "^2|^3",
"laravel/boost": "^1.8",
"laravel/boost": "^2",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^8.1",
"phpstan/phpstan": "^2.0",

72
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "8a50c2fe501dee5e823dc1d72ad78fc4",
"content-hash": "deac431061a71a45433f6202449167bc",
"packages": [
{
"name": "apimatic/core",
@@ -18749,33 +18749,33 @@
},
{
"name": "laravel/boost",
"version": "v1.8.12",
"version": "v2.3.4",
"source": {
"type": "git",
"url": "https://github.com/laravel/boost.git",
"reference": "5a0bf68e48e6d159182859f9ed6e404313103309"
"reference": "9e3dd5f05b59394e463e78853067dc36c63a0394"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/boost/zipball/5a0bf68e48e6d159182859f9ed6e404313103309",
"reference": "5a0bf68e48e6d159182859f9ed6e404313103309",
"url": "https://api.github.com/repos/laravel/boost/zipball/9e3dd5f05b59394e463e78853067dc36c63a0394",
"reference": "9e3dd5f05b59394e463e78853067dc36c63a0394",
"shasum": ""
},
"require": {
"guzzlehttp/guzzle": "^7.9",
"illuminate/console": "^10.49.0|^11.45.3|^12.41.1",
"illuminate/contracts": "^10.49.0|^11.45.3|^12.41.1",
"illuminate/routing": "^10.49.0|^11.45.3|^12.41.1",
"illuminate/support": "^10.49.0|^11.45.3|^12.41.1",
"laravel/mcp": "^0.5.1",
"laravel/prompts": "0.1.25|^0.3.6",
"laravel/roster": "^0.2.9",
"php": "^8.1"
"illuminate/console": "^11.45.3|^12.41.1|^13.0",
"illuminate/contracts": "^11.45.3|^12.41.1|^13.0",
"illuminate/routing": "^11.45.3|^12.41.1|^13.0",
"illuminate/support": "^11.45.3|^12.41.1|^13.0",
"laravel/mcp": "^0.5.1|^0.6.0",
"laravel/prompts": "^0.3.10",
"laravel/roster": "^0.5.0",
"php": "^8.2"
},
"require-dev": {
"laravel/pint": "^1.20.0",
"laravel/pint": "^1.27.0",
"mockery/mockery": "^1.6.12",
"orchestra/testbench": "^8.36.0|^9.15.0|^10.6",
"orchestra/testbench": "^9.15.0|^10.6|^11.0",
"pestphp/pest": "^2.36.0|^3.8.4|^4.1.5",
"phpstan/phpstan": "^2.1.27",
"rector/rector": "^2.1"
@@ -18811,20 +18811,20 @@
"issues": "https://github.com/laravel/boost/issues",
"source": "https://github.com/laravel/boost"
},
"time": "2026-03-12T07:25:30+00:00"
"time": "2026-03-17T16:42:14+00:00"
},
{
"name": "laravel/mcp",
"version": "v0.5.9",
"version": "v0.6.3",
"source": {
"type": "git",
"url": "https://github.com/laravel/mcp.git",
"reference": "39e8da60eb7bce4737c5d868d35a3fe78938c129"
"reference": "8a2c97ec1184e16029080e3f6172a7ca73de4df9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/mcp/zipball/39e8da60eb7bce4737c5d868d35a3fe78938c129",
"reference": "39e8da60eb7bce4737c5d868d35a3fe78938c129",
"url": "https://api.github.com/repos/laravel/mcp/zipball/8a2c97ec1184e16029080e3f6172a7ca73de4df9",
"reference": "8a2c97ec1184e16029080e3f6172a7ca73de4df9",
"shasum": ""
},
"require": {
@@ -18884,35 +18884,35 @@
"issues": "https://github.com/laravel/mcp/issues",
"source": "https://github.com/laravel/mcp"
},
"time": "2026-02-17T19:05:53+00:00"
"time": "2026-03-12T12:46:43+00:00"
},
{
"name": "laravel/roster",
"version": "v0.2.9",
"version": "v0.5.1",
"source": {
"type": "git",
"url": "https://github.com/laravel/roster.git",
"reference": "82bbd0e2de614906811aebdf16b4305956816fa6"
"reference": "5089de7615f72f78e831590ff9d0435fed0102bb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/roster/zipball/82bbd0e2de614906811aebdf16b4305956816fa6",
"reference": "82bbd0e2de614906811aebdf16b4305956816fa6",
"url": "https://api.github.com/repos/laravel/roster/zipball/5089de7615f72f78e831590ff9d0435fed0102bb",
"reference": "5089de7615f72f78e831590ff9d0435fed0102bb",
"shasum": ""
},
"require": {
"illuminate/console": "^10.0|^11.0|^12.0",
"illuminate/contracts": "^10.0|^11.0|^12.0",
"illuminate/routing": "^10.0|^11.0|^12.0",
"illuminate/support": "^10.0|^11.0|^12.0",
"php": "^8.1|^8.2",
"symfony/yaml": "^6.4|^7.2"
"illuminate/console": "^11.0|^12.0|^13.0",
"illuminate/contracts": "^11.0|^12.0|^13.0",
"illuminate/routing": "^11.0|^12.0|^13.0",
"illuminate/support": "^11.0|^12.0|^13.0",
"php": "^8.2",
"symfony/yaml": "^7.2|^8.0"
},
"require-dev": {
"laravel/pint": "^1.14",
"mockery/mockery": "^1.6",
"orchestra/testbench": "^8.22.0|^9.0|^10.0",
"pestphp/pest": "^2.0|^3.0",
"orchestra/testbench": "^9.0|^10.0|^11.0",
"pestphp/pest": "^3.0|^4.1",
"phpstan/phpstan": "^2.0"
},
"type": "library",
@@ -18945,7 +18945,7 @@
"issues": "https://github.com/laravel/roster/issues",
"source": "https://github.com/laravel/roster"
},
"time": "2025-10-20T09:56:46+00:00"
"time": "2026-03-05T07:58:43+00:00"
},
{
"name": "mockery/mockery",
@@ -22147,6 +22147,6 @@
"ext-libxml": "*",
"ext-simplexml": "*"
},
"platform-dev": {},
"plugin-api-version": "2.9.0"
"platform-dev": [],
"plugin-api-version": "2.6.0"
}

View File

@@ -5906,6 +5906,7 @@ $lang = array(
'welcome_to_docuninja' => 'Welcome to DocuNinja',
'yodlee' => 'Yodlee',
'location_name' => 'Location Name',
'is_shipping_location' => 'Is Shipping Location',
'quote_rejected' => 'Quote Rejected',
'e_invoice_received_notification' => 'E-Invoice Received Notification',
'e_invoice_received_notification_help' => 'Send an email when an e-invoice has been received',

View File

@@ -13,6 +13,7 @@
namespace Tests\Feature\Export;
use App\DataMapper\CompanySettings;
use App\Export\CSV\ClientExport;
use App\Export\CSV\LocationExport;
use App\Factory\CompanyUserFactory;
use App\Models\Account;
@@ -26,7 +27,6 @@ use App\Utils\Traits\MakesHash;
use Illuminate\Routing\Middleware\ThrottleRequests;
use Illuminate\Support\Facades\Http;
use League\Csv\Reader;
use League\Csv\ResultSet;
use Tests\TestCase;
class LocationExportTest extends TestCase
@@ -165,7 +165,7 @@ class LocationExportTest extends TestCase
$reader = Reader::fromString($csv);
$reader->setHeaderOffset(0);
$res = ResultSet::from($reader)->fetchColumn($column);
$res = $reader->fetchColumnByName($column);
$res = iterator_to_array($res, true);
return $res[1];
@@ -182,7 +182,7 @@ class LocationExportTest extends TestCase
'user_id' => $this->user->id,
];
$response = $this->withHeaders([
$this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->postJson('/api/v1/reports/locations', $data)
@@ -202,7 +202,7 @@ class LocationExportTest extends TestCase
'user_id' => $this->user->id,
];
$response = $this->withHeaders([
$this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->postJson('/api/v1/reports/client_locations', $data)
@@ -225,20 +225,11 @@ class LocationExportTest extends TestCase
'date_range' => 'all',
'report_keys' => [],
'send_email' => false,
'user_id' => $this->user->id,
];
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/reports/locations', $data);
$response->assertStatus(200);
$arr = $response->json();
$hash = $arr['message'];
$response = $this->poll($hash);
$csv = $response->body();
$export = new LocationExport($this->company, $data);
$csv = $export->run();
$reader = Reader::fromString($csv);
$reader->setHeaderOffset(0);
@@ -246,50 +237,7 @@ class LocationExportTest extends TestCase
$headers = $reader->getHeader();
$this->assertNotEmpty($headers);
$this->account->forceDelete();
}
public function testLocationCsvWithCustomReportKeys()
{
$this->createLocation([
'name' => 'Warehouse',
'address1' => '789 Industrial Ave',
'city' => 'Houston',
'state' => 'TX',
'postal_code' => '77001',
]);
$data = [
'date_range' => 'all',
'report_keys' => [
'location.name',
'location.address1',
'location.city',
'location.state',
'location.postal_code',
'client.name',
'contact.email',
],
'send_email' => false,
];
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/reports/locations', $data);
$response->assertStatus(200);
$arr = $response->json();
$hash = $arr['message'];
$response = $this->poll($hash);
$csv = $response->body();
$reader = Reader::fromString($csv);
$reader->setHeaderOffset(0);
$records = iterator_to_array($reader->getRecords());
$this->assertCount(1, $records);
$this->account->forceDelete();
@@ -313,34 +261,19 @@ class LocationExportTest extends TestCase
'location.city',
'location.state',
'location.postal_code',
'client.name',
'contact.first_name',
'contact.email',
],
'send_email' => false,
'user_id' => $this->user->id,
];
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/reports/locations', $data);
$response->assertStatus(200);
$arr = $response->json();
$hash = $arr['message'];
$response = $this->poll($hash);
$csv = $response->body();
$export = new LocationExport($this->company, $data);
$csv = $export->run();
$this->assertEquals('Main Office', $this->getFirstValueByColumn($csv, 'Location Name'));
$this->assertEquals('100 Test Street', $this->getFirstValueByColumn($csv, 'Location Street'));
$this->assertEquals('Denver', $this->getFirstValueByColumn($csv, 'Location City'));
$this->assertEquals('CO', $this->getFirstValueByColumn($csv, 'Location State/Province'));
$this->assertEquals('80201', $this->getFirstValueByColumn($csv, 'Location Postal Code'));
$this->assertEquals('Test Client', $this->getFirstValueByColumn($csv, 'Client Name'));
$this->assertEquals('John', $this->getFirstValueByColumn($csv, 'Contact First Name'));
$this->assertEquals('john@example.com', $this->getFirstValueByColumn($csv, 'Contact Email'));
$this->account->forceDelete();
}
@@ -364,22 +297,13 @@ class LocationExportTest extends TestCase
$data = [
'date_range' => 'all',
'report_keys' => ['location.name', 'location.city', 'client.name'],
'report_keys' => ['location.name', 'location.city'],
'send_email' => false,
'user_id' => $this->user->id,
];
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/reports/locations', $data);
$response->assertStatus(200);
$arr = $response->json();
$hash = $arr['message'];
$response = $this->poll($hash);
$csv = $response->body();
$export = new LocationExport($this->company, $data);
$csv = $export->run();
$reader = Reader::fromString($csv);
$reader->setHeaderOffset(0);
@@ -392,11 +316,6 @@ class LocationExportTest extends TestCase
$this->assertContains('CityB', $cities);
$this->assertContains('CityC', $cities);
// All rows should reference the same client
$clientNames = array_unique(array_column($records, 'Client Name'));
$this->assertCount(1, $clientNames);
$this->assertEquals('Test Client', $clientNames[0]);
$this->account->forceDelete();
}
@@ -422,22 +341,13 @@ class LocationExportTest extends TestCase
$data = [
'date_range' => 'all',
'report_keys' => ['location.name', 'client.name'],
'report_keys' => ['location.name'],
'send_email' => false,
'user_id' => $this->user->id,
];
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/reports/locations', $data);
$response->assertStatus(200);
$arr = $response->json();
$hash = $arr['message'];
$response = $this->poll($hash);
$csv = $response->body();
$export = new LocationExport($this->company, $data);
$csv = $export->run();
$reader = Reader::fromString($csv);
$reader->setHeaderOffset(0);
@@ -460,20 +370,11 @@ class LocationExportTest extends TestCase
'date_range' => 'all',
'report_keys' => ['location.name', 'location.is_shipping_location'],
'send_email' => false,
'user_id' => $this->user->id,
];
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->post('/api/v1/reports/locations', $data);
$response->assertStatus(200);
$arr = $response->json();
$hash = $arr['message'];
$response = $this->poll($hash);
$csv = $response->body();
$export = new LocationExport($this->company, $data);
$csv = $export->run();
$reader = Reader::fromString($csv);
$reader->setHeaderOffset(0);
@@ -500,7 +401,6 @@ class LocationExportTest extends TestCase
'location.name',
'location.address1',
'location.city',
'client.name',
],
'send_email' => false,
'user_id' => $this->user->id,
@@ -519,7 +419,6 @@ class LocationExportTest extends TestCase
$this->assertEquals('Direct Test Location', $row['Location Name']);
$this->assertEquals('555 Export Ave', $row['Location Street']);
$this->assertEquals('Portland', $row['Location City']);
$this->assertEquals('Test Client', $row['Client Name']);
$this->account->forceDelete();
}
@@ -536,7 +435,6 @@ class LocationExportTest extends TestCase
'report_keys' => [
'location.name',
'location.city',
'client.name',
],
'send_email' => false,
'user_id' => $this->user->id,
@@ -546,9 +444,8 @@ class LocationExportTest extends TestCase
$result = $export->returnJson();
$this->assertArrayHasKey('columns', $result);
$this->assertCount(3, $result['columns']);
$this->assertCount(2, $result['columns']);
// Result should have data rows (array items beyond 'columns')
$dataRows = array_filter($result, fn($key) => $key !== 'columns', ARRAY_FILTER_USE_KEY);
$this->assertNotEmpty($dataRows);
@@ -557,12 +454,10 @@ class LocationExportTest extends TestCase
public function testVendorLocationsAreExcluded()
{
// Create a client location
$this->createLocation([
'name' => 'Client Location',
]);
// Create a vendor-only location (no client_id)
Location::factory()->create([
'company_id' => $this->company->id,
'user_id' => $this->user->id,
@@ -593,11 +488,9 @@ class LocationExportTest extends TestCase
public function testEmptyLocationExport()
{
// No locations created
$data = [
'date_range' => 'all',
'report_keys' => ['location.name', 'client.name'],
'report_keys' => ['location.name'],
'send_email' => false,
'user_id' => $this->user->id,
];
@@ -613,4 +506,80 @@ class LocationExportTest extends TestCase
$this->account->forceDelete();
}
public function testClientExportWithLocationFields()
{
$this->createLocation([
'name' => 'HQ Location',
'address1' => '999 Location Blvd',
'city' => 'Miami',
'state' => 'FL',
'postal_code' => '33101',
]);
$data = [
'date_range' => 'all',
'report_keys' => [
'client.name',
'location.name',
'location.address1',
'location.city',
'location.state',
'location.postal_code',
],
'send_email' => false,
'include_deleted' => false,
'user_id' => $this->user->id,
];
$export = new ClientExport($this->company, $data);
$csv = $export->run();
$reader = Reader::fromString($csv);
$reader->setHeaderOffset(0);
$records = iterator_to_array($reader->getRecords());
$this->assertCount(1, $records);
$row = reset($records);
$this->assertEquals('Test Client', $row['Name']);
$this->assertEquals('HQ Location', $row['Location Name']);
$this->assertEquals('999 Location Blvd', $row['Location Street']);
$this->assertEquals('Miami', $row['Location City']);
$this->assertEquals('FL', $row['Location State/Province']);
$this->assertEquals('33101', $row['Location Postal Code']);
$this->account->forceDelete();
}
public function testClientExportWithNoLocationReturnsEmptyLocationFields()
{
$data = [
'date_range' => 'all',
'report_keys' => [
'client.name',
'location.name',
'location.city',
],
'send_email' => false,
'include_deleted' => false,
'user_id' => $this->user->id,
];
$export = new ClientExport($this->company, $data);
$csv = $export->run();
$reader = Reader::fromString($csv);
$reader->setHeaderOffset(0);
$records = iterator_to_array($reader->getRecords());
$this->assertCount(1, $records);
$row = reset($records);
$this->assertEquals('Test Client', $row['Name']);
$this->assertEmpty($row['Location Name']);
$this->assertEmpty($row['Location City']);
$this->account->forceDelete();
}
}