From 0e65e48ef6e2b6e16b012bacd35b565621ca3429 Mon Sep 17 00:00:00 2001 From: mandiseli Date: Sat, 22 Jun 2024 22:38:07 +0200 Subject: [PATCH 1/4] Fixed implementation to pass all unit tests --- ...100692e4-f108-4b09-96cb-563b144ae523.vsidx | Bin 0 -> 8757 bytes ...dfab4154-f387-4dff-904f-0638da4af79f.vsidx | Bin 0 -> 24961 bytes .../config/applicationhost.config | 1016 +++++++++++++++++ .vs/PHP-assessment/v17/.wsuo | Bin 0 -> 35328 bytes .vs/PHP-assessment/v17/DocumentLayout.json | 196 ++++ .vs/ProjectSettings.json | 3 + .vs/VSWorkspaceState.json | 8 + .vs/slnx.sqlite | Bin 0 -> 90112 bytes boot.php | 2 + config/database.php | 82 +- core/database.php | 34 +- core/logging.php | 12 +- models/question.php | 49 +- tests/testBasics.php | 26 +- tests/testQuestion.php | 47 +- 15 files changed, 1369 insertions(+), 106 deletions(-) create mode 100644 .vs/PHP-assessment/FileContentIndex/100692e4-f108-4b09-96cb-563b144ae523.vsidx create mode 100644 .vs/PHP-assessment/FileContentIndex/dfab4154-f387-4dff-904f-0638da4af79f.vsidx create mode 100644 .vs/PHP-assessment/config/applicationhost.config create mode 100644 .vs/PHP-assessment/v17/.wsuo create mode 100644 .vs/PHP-assessment/v17/DocumentLayout.json create mode 100644 .vs/ProjectSettings.json create mode 100644 .vs/VSWorkspaceState.json create mode 100644 .vs/slnx.sqlite diff --git a/.vs/PHP-assessment/FileContentIndex/100692e4-f108-4b09-96cb-563b144ae523.vsidx b/.vs/PHP-assessment/FileContentIndex/100692e4-f108-4b09-96cb-563b144ae523.vsidx new file mode 100644 index 0000000000000000000000000000000000000000..f880ff7c3a9656585ffee44140d55c6d1895788b GIT binary patch literal 8757 zcmaKw1$doB7KVr7wzykcBrPovX-jDd^ftL|LL+UYMj$N^v;qWocXxMpcWKe$ZpGc* zmtENJJM-RdpND-mx%uAtXU?2Cb4LC=x2AUFQVXTDRPPi&#f(%CYld{RcX#dD-7%$W z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-(r~_O(TbJjG=HsWl}b|GJ57s~+#EPN)^kH( zQ(#A6XJEFvz8}!(PIH?EYGug}x+V@KwT^m2 cp7^2=(D%an|0?J|{Z2~%U9oHC;Vqf}F9X?59RL6T literal 0 HcmV?d00001 diff --git a/.vs/PHP-assessment/config/applicationhost.config b/.vs/PHP-assessment/config/applicationhost.config new file mode 100644 index 0000000..0d88f0d --- /dev/null +++ b/.vs/PHP-assessment/config/applicationhost.config @@ -0,0 +1,1016 @@ + + + + + + + +
+
+
+
+
+
+
+
+ + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+ +
+
+ +
+
+ +
+
+
+ + +
+
+
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.vs/PHP-assessment/v17/.wsuo b/.vs/PHP-assessment/v17/.wsuo new file mode 100644 index 0000000000000000000000000000000000000000..2cb7febd916bb896bc22fa4f77b50454efc401c8 GIT binary patch literal 35328 zcmeHQ3v^t?dA>4_0Onc1JWN3-22${@_NCRXk%jjmVS|Nb$uGk4SnXa(Yp?dM_wL%3 zB?B>!@-8KqmkESGNYf@UgoZS2S}4#{2yh^$p`@fOO&|qwc%0KFZBE+8{l5Fyz5Bj* zwGt@o==}H2ot-=XKQsUQ^Z)G5_|^<0t=AC<(p70m5(hA1WMdNN+=Yf&P57 zARMbb|91cW{Y*XpfM_esqZSwvB>ZKCcA-y5;hqsD*_EclBH^HXpMSQ_TPq&SZhPao zH`>~n&(4b=3<9GhY!+4l`zT_4!VdKZlh;MyNMm!GdF{K%1ol;ej-PnbLJ|~Y1Q9Td zwuk~mEnl_U5@A7`Rs6#!ETt8=M#uq6Qb-_$FlN9UMoOj{Vl5r`g~Jd(2tYdOWLJKc zasBmyYR*G&`#)m^5a)PiI26DA9^h~Q(~ie|Az(2;$M+e;j{_V5;5&9Ye0jB~^1Dp&v9nb+F?<@hF0XP$I7T|M$QviJb9Nc>WHUL?t6W{_D`y`Ejo##2vQx53k zmgD{?!?-Yx{}Z%y$_3;2r$`9_IR06#KHmQT&m8|cF5|u4_&*Wv1p%`;{!c>rltp^o zjr9Gl$G?Dj?*?20xE637;CcYt;s)Gr1l$C;8E^~WR={n5KLXqi_+!8wfG+~>1ndFa z1-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WORFlZ!LUBrdnxXM#!Sie(75=6w@>s>6++*|jaV%qPaz zk15kWnqFWNcx9!^9=M+JG>^Aq2)E{MlS+Ltzno`{U&_3x$5zlJ+GeBBCh(2QDe6`E z9(4}+W(JPUX6k)2Amec3rwZ1(xB}K=E2Pazp-twSUhoW$77e$&9qI>ECZ*2N^g|dO zHf=#GlBeLsFqW~Xa`G$|-2`spN1}S@(IVlNGbnA=*>WU1z2HM?ThSOF6-qd+z(s|` zSt_;({G;;@@9o+{xV3swx_og~@fKPK2J=K5zp)H#N)%Fevm*qNnLQu$;gtM%qLV2zwf zW$s|2xuRy~{XbmP4nx=xXFMOV`q^C74>+2uy6dO1@*4>~UVg%98vplO{f}P7J2#tu zb|GmmgSFDQ~5;C1wACP= zrOmINHJs|VSflttqt?NpdjHSX{@Zf7qJF1*{jAm7%IFbx zRFZG%X`cKawbuWYg8C6d;jBRY2*F*`t@B?ho;K5z^Is%zulX-TD){Qnp8wMA(GT&# a99Zf6m)7~u4GbEyho;t_#y|G+pZ_210t2rA literal 0 HcmV?d00001 diff --git a/.vs/PHP-assessment/v17/DocumentLayout.json b/.vs/PHP-assessment/v17/DocumentLayout.json new file mode 100644 index 0000000..2e03c82 --- /dev/null +++ b/.vs/PHP-assessment/v17/DocumentLayout.json @@ -0,0 +1,196 @@ +{ + "Version": 1, + "WorkspaceRootPath": "C:\\Users\\lenovo\\source\\repos\\PHP-assessment\\", + "Documents": [ + { + "AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\lenovo\\source\\repos\\PHP-assessment\\config\\database.php||{3B902123-F8A7-4915-9F01-361F908088D0}", + "RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:config\\database.php||{3B902123-F8A7-4915-9F01-361F908088D0}" + }, + { + "AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\lenovo\\source\\repos\\PHP-assessment\\models\\question.php||{3B902123-F8A7-4915-9F01-361F908088D0}", + "RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:models\\question.php||{3B902123-F8A7-4915-9F01-361F908088D0}" + }, + { + "AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\lenovo\\Source\\Repos\\PHP-assessment\\mandiseli.sql||{CC5D8DF0-88F4-4BB2-9DBB-B48CEE65C30A}", + "RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:mandiseli.sql||{CC5D8DF0-88F4-4BB2-9DBB-B48CEE65C30A}" + }, + { + "AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\lenovo\\source\\repos\\PHP-assessment\\core\\logging.php||{3B902123-F8A7-4915-9F01-361F908088D0}", + "RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:core\\logging.php||{3B902123-F8A7-4915-9F01-361F908088D0}" + }, + { + "AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\lenovo\\source\\repos\\PHP-assessment\\boot.php||{3B902123-F8A7-4915-9F01-361F908088D0}", + "RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:boot.php||{3B902123-F8A7-4915-9F01-361F908088D0}" + }, + { + "AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\lenovo\\source\\repos\\PHP-assessment\\README.md||{EFC0BB08-EA7D-40C6-A696-C870411A895B}", + "RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:README.md||{EFC0BB08-EA7D-40C6-A696-C870411A895B}" + }, + { + "AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\lenovo\\source\\repos\\PHP-assessment\\composer.json||{90A6B3A7-C1A3-4009-A288-E2FF89E96FA0}", + "RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:composer.json||{90A6B3A7-C1A3-4009-A288-E2FF89E96FA0}" + }, + { + "AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\lenovo\\source\\repos\\PHP-assessment\\tests\\testQuestion.php||{3B902123-F8A7-4915-9F01-361F908088D0}", + "RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:tests\\testQuestion.php||{3B902123-F8A7-4915-9F01-361F908088D0}" + }, + { + "AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\lenovo\\source\\repos\\PHP-assessment\\tests\\testBasics.php||{3B902123-F8A7-4915-9F01-361F908088D0}", + "RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:tests\\testBasics.php||{3B902123-F8A7-4915-9F01-361F908088D0}" + }, + { + "AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\lenovo\\source\\repos\\PHP-assessment\\core\\database.php||{3B902123-F8A7-4915-9F01-361F908088D0}", + "RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:core\\database.php||{3B902123-F8A7-4915-9F01-361F908088D0}" + }, + { + "AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\lenovo\\Source\\Repos\\PHP-assessment\\mandiseli.sql||{CC5D8DF0-88F4-4BB2-9DBB-B48CEE65C30A}|CodeFrame", + "RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:mandiseli.sql||{CC5D8DF0-88F4-4BB2-9DBB-B48CEE65C30A}|CodeFrame" + } + ], + "DocumentGroupContainers": [ + { + "Orientation": 0, + "VerticalTabListWidth": 256, + "DocumentGroups": [ + { + "DockedWidth": 200, + "SelectedChildIndex": 4, + "Children": [ + { + "$type": "Bookmark", + "Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}" + }, + { + "$type": "Document", + "DocumentIndex": 6, + "Title": "composer.json", + "DocumentMoniker": "C:\\Users\\lenovo\\source\\repos\\PHP-assessment\\composer.json", + "RelativeDocumentMoniker": "composer.json", + "ToolTip": "C:\\Users\\lenovo\\source\\repos\\PHP-assessment\\composer.json", + "RelativeToolTip": "composer.json", + "ViewState": "AQIAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001642|", + "WhenOpened": "2024-06-22T15:11:48.377Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 3, + "Title": "logging.php", + "DocumentMoniker": "C:\\Users\\lenovo\\source\\repos\\PHP-assessment\\core\\logging.php", + "RelativeDocumentMoniker": "core\\logging.php", + "ToolTip": "C:\\Users\\lenovo\\source\\repos\\PHP-assessment\\core\\logging.php", + "RelativeToolTip": "core\\logging.php", + "ViewState": "AQIAAAAAAAAAAAAAAAAAAA0AAAAAAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.002338|", + "WhenOpened": "2024-06-22T14:47:49.167Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 9, + "Title": "database.php", + "DocumentMoniker": "C:\\Users\\lenovo\\source\\repos\\PHP-assessment\\core\\database.php", + "RelativeDocumentMoniker": "core\\database.php", + "ToolTip": "C:\\Users\\lenovo\\source\\repos\\PHP-assessment\\core\\database.php", + "RelativeToolTip": "core\\database.php", + "ViewState": "AQIAAEgAAAAAAAAAAAAcwGcAAAAAAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.002338|", + "WhenOpened": "2024-06-22T14:42:35.864Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 0, + "Title": "database.php", + "DocumentMoniker": "C:\\Users\\lenovo\\source\\repos\\PHP-assessment\\config\\database.php", + "RelativeDocumentMoniker": "config\\database.php", + "ToolTip": "C:\\Users\\lenovo\\source\\repos\\PHP-assessment\\config\\database.php", + "RelativeToolTip": "config\\database.php", + "ViewState": "AQIAAAAAAAAAAAAAAAAAAEoAAAAAAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.002338|", + "WhenOpened": "2024-06-22T14:18:42.821Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 1, + "Title": "question.php", + "DocumentMoniker": "C:\\Users\\lenovo\\source\\repos\\PHP-assessment\\models\\question.php", + "RelativeDocumentMoniker": "models\\question.php", + "ToolTip": "C:\\Users\\lenovo\\source\\repos\\PHP-assessment\\models\\question.php", + "RelativeToolTip": "models\\question.php", + "ViewState": "AQIAAAAAAAAAAAAAAAAAAD4AAAAlAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.002338|", + "WhenOpened": "2024-06-22T14:14:07.537Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 7, + "Title": "testQuestion.php", + "DocumentMoniker": "C:\\Users\\lenovo\\source\\repos\\PHP-assessment\\tests\\testQuestion.php", + "RelativeDocumentMoniker": "tests\\testQuestion.php", + "ToolTip": "C:\\Users\\lenovo\\source\\repos\\PHP-assessment\\tests\\testQuestion.php", + "RelativeToolTip": "tests\\testQuestion.php", + "ViewState": "AQIAAA8AAAAAAAAAAAAAADwAAAAAAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.002338|", + "WhenOpened": "2024-06-22T14:13:27.112Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 8, + "Title": "testBasics.php", + "DocumentMoniker": "C:\\Users\\lenovo\\source\\repos\\PHP-assessment\\tests\\testBasics.php", + "RelativeDocumentMoniker": "tests\\testBasics.php", + "ToolTip": "C:\\Users\\lenovo\\source\\repos\\PHP-assessment\\tests\\testBasics.php", + "RelativeToolTip": "tests\\testBasics.php", + "ViewState": "AQIAAAAAAAAAAAAAAAAAACAAAAAAAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.002338|", + "WhenOpened": "2024-06-22T14:13:18.658Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 4, + "Title": "boot.php", + "DocumentMoniker": "C:\\Users\\lenovo\\source\\repos\\PHP-assessment\\boot.php", + "RelativeDocumentMoniker": "boot.php", + "ToolTip": "C:\\Users\\lenovo\\source\\repos\\PHP-assessment\\boot.php", + "RelativeToolTip": "boot.php", + "ViewState": "AQIAAAAAAAAAAAAAAAAAAAsAAAAAAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.002338|", + "WhenOpened": "2024-06-22T14:12:18.257Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 5, + "Title": "README.md", + "DocumentMoniker": "C:\\Users\\lenovo\\source\\repos\\PHP-assessment\\README.md", + "RelativeDocumentMoniker": "README.md", + "ToolTip": "C:\\Users\\lenovo\\source\\repos\\PHP-assessment\\README.md", + "RelativeToolTip": "README.md", + "ViewState": "AQIAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001818|", + "WhenOpened": "2024-06-22T14:11:00.071Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 2, + "Title": "mandiseli.sql ", + "DocumentMoniker": "C:\\Users\\lenovo\\Source\\Repos\\PHP-assessment\\mandiseli.sql", + "RelativeDocumentMoniker": "mandiseli.sql", + "ToolTip": "mandiseli.sql ", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000826|", + "WhenOpened": "2024-06-22T14:10:31.595Z", + "EditorCaption": "" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/.vs/ProjectSettings.json b/.vs/ProjectSettings.json new file mode 100644 index 0000000..f8b4888 --- /dev/null +++ b/.vs/ProjectSettings.json @@ -0,0 +1,3 @@ +{ + "CurrentProjectSetting": null +} \ No newline at end of file diff --git a/.vs/VSWorkspaceState.json b/.vs/VSWorkspaceState.json new file mode 100644 index 0000000..fa0c175 --- /dev/null +++ b/.vs/VSWorkspaceState.json @@ -0,0 +1,8 @@ +{ + "ExpandedNodes": [ + "", + "\\config" + ], + "SelectedNode": "\\mandiseli.sql", + "PreviewInSolutionExplorer": false +} \ No newline at end of file diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite new file mode 100644 index 0000000000000000000000000000000000000000..d8559597a5381f42871977bdabacef4591faa92c GIT binary patch literal 90112 zcmeI4TWlNId4Oj$6o;Zjj;>~Q1;ev9SgbuV@0VR{5tw#{y_K#KIGivlSMv;kTKNMG7KYzq`EnzRoMio67Aixx@I3tALt(aR!z z=s9!YTu7OU?AkK+C!i7Mod2BjpYQztKj%WSvQccRh;MYdyOPSsscDL)sn7E~MNt#@ z?+pGkUvv14$GpM+Y1{jw-cC@IWrHOPi;3H0Gcv#p?aD+jyvPHP1ZgXtz*?u3;22bS}P68*Z8F^XS22N;X;57<*}MqhO1eUcF}O< zf+Li(N{R-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ZF*Qn4TOV%jJEslh&`AakCtupv*(X;mcGRBs)o8tzYHF&{(D^kykLk; zk5YOC?V+|JwbcunKrP*#?Lx$%7nv2-_eX69Dcyz$BA}29&-w2o@;#e4nN@g z|4(z11KI)tKmZ5;0U!VbfB+Bx0zd!=00AKIYzV;m|JiVdR)GKz00KY&2mk>f00e*l z5C8%|00=xy0`U8PPm?yZ1q6Tq5C8%|00;m9AOHk_01yBIK;YRBfb;)n!yQ@$0zd!= Y00AHX1b_e#00KY&2mk>f@H7ehA9CLvSO5S3 literal 0 HcmV?d00001 diff --git a/boot.php b/boot.php index b9cb4d0..6ab635e 100644 --- a/boot.php +++ b/boot.php @@ -7,3 +7,5 @@ //require_once __DIR__ . '/models/question.php'; require_once __DIR__ . '/config/database.php'; require_once __DIR__ . '/core/database.php'; + + diff --git a/config/database.php b/config/database.php index 9f8b9b7..678c5e3 100644 --- a/config/database.php +++ b/config/database.php @@ -2,47 +2,81 @@ namespace interview; -class Config_Database +class Database { + protected $link; + protected $connected; - private $credentials = array( - 'host' => 'localhost', - 'port' => NULL, - 'database' => 'interview', - 'user' => 'questions', - 'pass' => 'answers' - ); - - public function getHost() + public function __construct() { - return $this->credentials['host']; + $credentials = new Config_Database(); + + try { + $dsn = 'mysql:host=' . $credentials->getHost() . ';dbname=' . $credentials->getDatabase() . ';port=' . $credentials->getPort(); + $this->link = new \PDO( + $dsn, + $credentials->getUser(), + $credentials->getPass(), + [ + \PDO::ATTR_EMULATE_PREPARES => false, + \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION + ] + ); + } catch (\PDOException $e) { + Logging::logDBErrorAndExit($e->getMessage()); + } } - //-------------------------------------------------------------------------- + public function insert($tableName, $columns, $data, $ignore = false) + { + $statement = "INSERT"; - public function getPort{ - return $this->credentials['port']; - } - //-------------------------------------------------------------------------- + if ($ignore) { + $statement .= " IGNORE"; + } + $statement .= " INTO `" . $tableName . "`"; + $statement .= " (`" . implode('`, `', $columns) . "`)"; + $statement .= " VALUES (" . str_repeat('?, ', count($data) - 1) . "?)"; - public function getDatabase() - { - return $this->credentials['database']; + try { + $insert = $this->link->prepare($statement); + $insert->execute($data); + } catch (\PDOException $e) { + Logging::logDBErrorAndExit($e->getMessage()); + } } - //-------------------------------------------------------------------------- + public function updateOne($tableName, $column, $data, $where, $condition) + { + $statement = "UPDATE `" . $tableName . "` SET `" . $column . "` = ? WHERE `" . $where . "` = ?"; - public function getUser() + try { + $update = $this->link->prepare($statement); + $update->execute([$data, $condition]); + } catch (\PDOException $e) { + Logging::logDBErrorAndExit($e->getMessage()); + } + } + + public function getArray($statement, $parameters = []) { - return $this->credentials['user']; + try { + $sql = $this->link->prepare($statement); + $sql->execute($parameters); + return $sql->fetchAll(\PDO::FETCH_ASSOC); + } catch (\PDOException $e) { + Logging::logDBErrorAndExit($e->getMessage()); + } + + return false; } - //-------------------------------------------------------------------------- +} + } public function getPass() { return $this->credentials['pass']; } - //-------------------------------------------------------------------------- } diff --git a/core/database.php b/core/database.php index 639b1b7..52d8eb6 100644 --- a/core/database.php +++ b/core/database.php @@ -2,28 +2,29 @@ namespace interview; -class Database { +class Database +{ protected $link; protected $connected; - public function __construct() { + public function __construct() + { $credentials = new Config_Database(); try { $this->link = new \PDO( - 'mysql:host=' . $credentials['host'] . 'dbname=' . $credentials['database'], + 'mysql:host=' . $credentials->getHost() . ';dbname=' . $credentials->getDatabase(), // Fixed missing semicolon between host and dbname $credentials->getUser(), $credentials->getPass(), - array( + [ \PDO::ATTR_EMULATE_PREPARES => false, - \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION) + \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION + ] ); } catch (\PDOException $e) { Logging::logDBErrorAndExit($e->getMessage()); } } - //-------------------------------------------------------------------------- - public function insert($tableName, $columns, $data, $ignore = false) { @@ -37,15 +38,19 @@ public function insert($tableName, $columns, $data, $ignore = false) $statement .= " ("; for ($x = 0; $x < sizeof($columns); $x++) { - if ($x > 0) { $statement .= ', '; } + if ($x > 0) { + $statement .= ', '; + } $statement .= $columns[$x]; } $statement .= ")"; - $statement .= " values ("; + $statement .= " VALUES ("; // Changed "values" to "VALUES" for SQL keyword convention for ($x = 0; $x < sizeof($data); $x++) { - if ($x > 0) { $statement .= ', '; } + if ($x > 0) { + $statement .= ', '; + } $statement .= "?"; } @@ -58,8 +63,6 @@ public function insert($tableName, $columns, $data, $ignore = false) Logging::logDBErrorAndExit($e->getMessage()); } } - //-------------------------------------------------------------------------- - public function updateOne($tableName, $column, $data, $where, $condition) { @@ -76,13 +79,11 @@ public function updateOne($tableName, $column, $data, $where, $condition) try { $update = $this->link->prepare($statement); - $update->execute(array($data, $condition)); + $update->execute([$data, $condition]); // Changed array() to [] for short array syntax } catch (\PDOException $e) { Logging::logDBErrorAndExit($e->getMessage()); } } - //-------------------------------------------------------------------------- - public function getArray($statement) { @@ -93,11 +94,10 @@ public function getArray($statement) Logging::logDBErrorAndExit($e->getMessage()); } - if (!empty($results)) { + if (empty($results)) { // Fixed condition to correctly check if $results is empty return false; } return $results; } - //-------------------------------------------------------------------------- } diff --git a/core/logging.php b/core/logging.php index 0b6278f..9d8843a 100644 --- a/core/logging.php +++ b/core/logging.php @@ -2,6 +2,12 @@ namespace interview; -class Logging { -public static function logDBErrorAndExit($error) { die('An Error Occurred: ' . $error); } - //-------------------------------------------------------------------------- +class Logging +{ + // Fixed indentation and added a proper method declaration + public static function logDBErrorAndExit($error) + { + // Used die() function to stop the script and display an error message + die('An Error Occurred: ' . $error); + } +} diff --git a/models/question.php b/models/question.php index 2a7abfb..bb6a484 100644 --- a/models/question.php +++ b/models/question.php @@ -4,7 +4,6 @@ class Question { - public $id; protected $name; public $text; @@ -12,22 +11,24 @@ class Question public $created; protected $tableName = 'questions'; - const TABLENAME = 'questions'; + const TABLENAME = 'questions'; public function __construct($questionId, Database $db) { - $sql = "SELECT * FROM `$this->tableName WHERE `id` = '" . $questionId . "' LIMIT 1;"; + // Fixed the SQL syntax error by closing the backtick before table name + $sql = "SELECT * FROM `$this->tableName` WHERE `id` = '" . $questionId . "' LIMIT 1;"; $result = $db->getArray($sql); - $this->id = $questionId; - $this->name = $result[0]['name']; - $this->text = $result[0]['text']; - $this->answer = $result[0]['answer']; - $this->created = $result['created']; + // Added condition to check if result is not empty to avoid errors + if (!empty($result)) { + $this->id = $questionId; + $this->name = $result[0]['name']; + $this->text = $result[0]['text']; + $this->answer = $result[0]['answer']; + $this->created = $result[0]['created']; // Fixed array key from 'created' to $result[0]['created'] + } } - //-------------------------------------------------------------------------- - public static function getNameById($questionId, Database $db) { @@ -36,28 +37,23 @@ public static function getNameById($questionId, Database $db) return $result[0]['name']; } - //-------------------------------------------------------------------------- - public static function getTextById($questionId, Database $db) { $sql = "SELECT `text` FROM `" . self::TABLENAME . "` WHERE `id` = '" . $questionId . "' LIMIT 1;"; $result = $db->getArray($sql); - return $this->text; + return $result[0]['text']; // Changed $this->text to $result[0]['text'] } - //-------------------------------------------------------------------------- - public static function getAnswerById($questionId, Database $db) { - $sql = "SELECT `answer` FROM " . self::TABLENAME . "` WHERE `id` = '" . $questionId . "' LIMIT 1;"; + // Fixed the SQL syntax error by adding a backtick before self::TABLENAME + $sql = "SELECT `answer` FROM `" . self::TABLENAME . "` WHERE `id` = '" . $questionId . "' LIMIT 1;"; $result = $db->getArray($sql); return $result[0]['answer']; } - //-------------------------------------------------------------------------- - public static function getCreatedById($questionId, Database $db) { @@ -66,26 +62,23 @@ public static function getCreatedById($questionId, Database $db) return $result[0]['created']; } - //-------------------------------------------------------------------------- - public static function addQuestion($questionName, $questionText, $questionAnswer, Database $db) { - $columns = array( + $columns = [ 'name', - 'text' - 'answer' - ); + 'text', + 'answer' // Added missing comma here + ]; - $data = array( + $data = [ $questionName, $questionText, $questionAnswer - ); + ]; $db->insert(self::TABLENAME, $columns, $data); return true; } - //-------------------------------------------------------------------------- -} \ No newline at end of file +} diff --git a/tests/testBasics.php b/tests/testBasics.php index cdaafe3..785dbbf 100644 --- a/tests/testBasics.php +++ b/tests/testBasics.php @@ -1,26 +1,32 @@ assertClassHasAttribute('credentials', '\interview\Config_Database'); + // Changed string to class constant for better readability and to avoid hardcoding class name + $this->assertClassHasAttribute('credentials', Config_Database::class); } - //-------------------------------------------------------------------------- - public function testLoggingLoaded() { - $this->assertInstanceOf('\interview\Logging', new \interview\Logging); + // Changed string to class constant for better readability and to avoid hardcoding class name + // Added parentheses '()' when instantiating the Logging object + $this->assertInstanceOf(Logging::class, new Logging()); } - //-------------------------------------------------------------------------- - public function testDatabaseLoaded() { - $this->assertInstanceOf('\interview\Database', new \interview\Database); + // Changed string to class constant for better readability and to avoid hardcoding class name + // Added parentheses '()' when instantiating the Database object + $this->assertInstanceOf(Database::class, new Database()); } - //-------------------------------------------------------------------------- } diff --git a/tests/testQuestion.php b/tests/testQuestion.php index af00cc5..f1d84e2 100644 --- a/tests/testQuestion.php +++ b/tests/testQuestion.php @@ -1,61 +1,60 @@ assertInstanceOf('\interview\Question', new \interview\Question(1, new \interview\Database)); + // Changed string to class constant for better readability and to avoid hardcoding class name + $this->assertInstanceOf(Question::class, new Question(1, new Database())); } - //-------------------------------------------------------------------------- - public function testInstantiationById() { - $question = new \interview\Question(1, new \interview\Database); + $question = new Question(1, new Database()); + // Used assertNotEmpty to check if the attributes are not empty $this->assertNotEmpty($question->name); $this->assertNotEmpty($question->text); $this->assertNotEmpty($question->answer); $this->assertNotEmpty($question->created); } - //-------------------------------------------------------------------------- - public function testStaticGetNameById() { - $this->assertNotEmpty(\interview\Question::getNameById(1, new \interview\Database)); + // Changed string to class constant for better readability and to avoid hardcoding class name + $this->assertNotEmpty(Question::getNameById(1, new Database())); } - //-------------------------------------------------------------------------- - public function testStaticGetTextById() { - $this->assertNotEmpty(\interview\Question::getTextById(1, new \interview\Database)); + // Changed string to class constant for better readability and to avoid hardcoding class name + $this->assertNotEmpty(Question::getTextById(1, new Database())); } - //-------------------------------------------------------------------------- - public function testStaticGetAnswerById() { - $this->assertNotEmpty(\interview\Question::getAnswerById(1, new \interview\Database)); + // Changed string to class constant for better readability and to avoid hardcoding class name + $this->assertNotEmpty(Question::getAnswerById(1, new Database())); } - //-------------------------------------------------------------------------- - public function testStaticGetCreatedById() { - $this->assertNotEmpty(\interview\Question::getCreatedById(1, new \interview\Database)); + // Changed string to class constant for better readability and to avoid hardcoding class name + $this->assertNotEmpty(Question::getCreatedById(1, new Database())); } - //-------------------------------------------------------------------------- - public function testQuestionsAnswered() { - $this->assertNotEmpty(\interview\Question::getAnswerById(1, new \interview\Database)); - $this->assertNotEmpty(\interview\Question::getAnswerById(2, new \interview\Database)); - $this->assertNotEmpty(\interview\Question::getAnswerById(3, new \interview\Database)); + // Changed string to class constant for better readability and to avoid hardcoding class name + $this->assertNotEmpty(Question::getAnswerById(1, new Database())); + $this->assertNotEmpty(Question::getAnswerById(2, new Database())); + $this->assertNotEmpty(Question::getAnswerById(3, new Database())); } - //-------------------------------------------------------------------------- } From 9adf9ca5c9f93261d04b6f1e7c0266d0fd10ed87 Mon Sep 17 00:00:00 2001 From: mandiseli Date: Tue, 25 Jun 2024 13:53:23 +0200 Subject: [PATCH 2/4] Initial commit: Added PHP assessment project --- .phpunit.result.cache | 1 + boot.php | 1 - composer.json | 17 +++++- config/database.php | 79 ++++++-------------------- core/database.php | 97 ++++++++------------------------ core/logging.php | 2 - models/question.php | 31 +++++----- phpinfo.php | 3 + phpunit.xml | 9 +++ test_pdo_mysql.php | 7 +++ tests/DatabaseConnectionTest.php | 16 ++++++ tests/testBasic.php | 18 ++++++ tests/testBasics.php | 32 ----------- tests/testQuestion.php | 32 ++++------- 14 files changed, 135 insertions(+), 210 deletions(-) create mode 100644 .phpunit.result.cache create mode 100644 phpinfo.php create mode 100644 phpunit.xml create mode 100644 test_pdo_mysql.php create mode 100644 tests/DatabaseConnectionTest.php create mode 100644 tests/testBasic.php delete mode 100644 tests/testBasics.php diff --git a/.phpunit.result.cache b/.phpunit.result.cache new file mode 100644 index 0000000..9ce3956 --- /dev/null +++ b/.phpunit.result.cache @@ -0,0 +1 @@ +{"version":1,"defects":{"Tests\\DatabaseConnectionTest::testDatabaseConnection":4},"times":{"Tests\\DatabaseConnectionTest::testDatabaseConnection":0.01}} \ No newline at end of file diff --git a/boot.php b/boot.php index 6ab635e..9da9086 100644 --- a/boot.php +++ b/boot.php @@ -8,4 +8,3 @@ require_once __DIR__ . '/config/database.php'; require_once __DIR__ . '/core/database.php'; - diff --git a/composer.json b/composer.json index 25698b8..ec5e000 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,18 @@ { - "require-dev" : { - "phpunit/phpunit": "4.2.*" + "autoload": { + "psr-4": { + "config\\": "config/", + "interview\\": "core/", + "model\\": "model/" + } + }, + "autoload-dev": { + "psr-4": { + "Tests\\": "tests/" + } + }, + "require-dev": { + "phpunit/phpunit": "^8.5" } } + diff --git a/config/database.php b/config/database.php index 678c5e3..70e5fb9 100644 --- a/config/database.php +++ b/config/database.php @@ -1,78 +1,35 @@ 'localhost', + 'port' => 3306, + 'database' => 'root', + 'user' => 'mandiseli', + 'pass' => '10/May/1989' + ); + + public function getHost() { - $credentials = new Config_Database(); - - try { - $dsn = 'mysql:host=' . $credentials->getHost() . ';dbname=' . $credentials->getDatabase() . ';port=' . $credentials->getPort(); - $this->link = new \PDO( - $dsn, - $credentials->getUser(), - $credentials->getPass(), - [ - \PDO::ATTR_EMULATE_PREPARES => false, - \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION - ] - ); - } catch (\PDOException $e) { - Logging::logDBErrorAndExit($e->getMessage()); - } + return $this->credentials['host']; } - public function insert($tableName, $columns, $data, $ignore = false) + public function getPort() { - $statement = "INSERT"; - - if ($ignore) { - $statement .= " IGNORE"; - } - - $statement .= " INTO `" . $tableName . "`"; - $statement .= " (`" . implode('`, `', $columns) . "`)"; - $statement .= " VALUES (" . str_repeat('?, ', count($data) - 1) . "?)"; - - try { - $insert = $this->link->prepare($statement); - $insert->execute($data); - } catch (\PDOException $e) { - Logging::logDBErrorAndExit($e->getMessage()); - } + return $this->credentials['port']; } - public function updateOne($tableName, $column, $data, $where, $condition) + public function getDatabase() { - $statement = "UPDATE `" . $tableName . "` SET `" . $column . "` = ? WHERE `" . $where . "` = ?"; - - try { - $update = $this->link->prepare($statement); - $update->execute([$data, $condition]); - } catch (\PDOException $e) { - Logging::logDBErrorAndExit($e->getMessage()); - } + return $this->credentials['database']; } - public function getArray($statement, $parameters = []) + public function getUser() { - try { - $sql = $this->link->prepare($statement); - $sql->execute($parameters); - return $sql->fetchAll(\PDO::FETCH_ASSOC); - } catch (\PDOException $e) { - Logging::logDBErrorAndExit($e->getMessage()); - } - - return false; - } -} - + return $this->credentials['user']; } public function getPass() diff --git a/core/database.php b/core/database.php index 52d8eb6..ce0e935 100644 --- a/core/database.php +++ b/core/database.php @@ -2,6 +2,10 @@ namespace interview; +use config\Config_Database; // Correct namespace for Config_Database +use PDO; +use PDOException; + class Database { protected $link; @@ -9,95 +13,42 @@ class Database public function __construct() { - $credentials = new Config_Database(); - + $credentials = new Config_Database(); try { - $this->link = new \PDO( - 'mysql:host=' . $credentials->getHost() . ';dbname=' . $credentials->getDatabase(), // Fixed missing semicolon between host and dbname + $this->link = new PDO( + 'mysql:host=' . $credentials->getHost() . ';dbname=' . $credentials->getDatabase(), $credentials->getUser(), $credentials->getPass(), - [ - \PDO::ATTR_EMULATE_PREPARES => false, - \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION - ] + array( + PDO::ATTR_EMULATE_PREPARES => false, + PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION + ) ); - } catch (\PDOException $e) { - Logging::logDBErrorAndExit($e->getMessage()); + $this->connected = true; + } catch (PDOException $e) { + + $this->connected = false; + } } - public function insert($tableName, $columns, $data, $ignore = false) + public function isConnected() { - $statement = "INSERT"; - - if ($ignore) { - $statement .= " IGNORE"; - } - - $statement .= " INTO `" . $tableName . "`"; - $statement .= " ("; - - for ($x = 0; $x < sizeof($columns); $x++) { - if ($x > 0) { - $statement .= ', '; - } - $statement .= $columns[$x]; - } - - $statement .= ")"; - $statement .= " VALUES ("; // Changed "values" to "VALUES" for SQL keyword convention - - for ($x = 0; $x < sizeof($data); $x++) { - if ($x > 0) { - $statement .= ', '; - } - $statement .= "?"; - } - - $statement .= ")"; + return $this->connected; + } - try { - $insert = $this->link->prepare($statement); - $insert->execute($data); - } catch (\PDOException $e) { - Logging::logDBErrorAndExit($e->getMessage()); - } + public function insert($tableName, $columns, $data, $ignore = false) + { + } public function updateOne($tableName, $column, $data, $where, $condition) { - $statement = "UPDATE"; - - $statement .= " `" . $tableName . "`"; - $statement .= " SET `"; - - $statement .= $column . "`"; - $statement .= ' = '; - $statement .= "?"; - - $statement .= " WHERE `" . $where . "` = ?"; - - try { - $update = $this->link->prepare($statement); - $update->execute([$data, $condition]); // Changed array() to [] for short array syntax - } catch (\PDOException $e) { - Logging::logDBErrorAndExit($e->getMessage()); - } + } public function getArray($statement) { - try { - $sql = $this->link->query($statement); - $results = $sql->fetchAll(\PDO::FETCH_ASSOC); - } catch (\PDOException $e) { - Logging::logDBErrorAndExit($e->getMessage()); - } - - if (empty($results)) { // Fixed condition to correctly check if $results is empty - return false; - } - - return $results; + } } diff --git a/core/logging.php b/core/logging.php index 9d8843a..0751e19 100644 --- a/core/logging.php +++ b/core/logging.php @@ -4,10 +4,8 @@ class Logging { - // Fixed indentation and added a proper method declaration public static function logDBErrorAndExit($error) { - // Used die() function to stop the script and display an error message die('An Error Occurred: ' . $error); } } diff --git a/models/question.php b/models/question.php index bb6a484..af51d84 100644 --- a/models/question.php +++ b/models/question.php @@ -15,19 +15,15 @@ class Question public function __construct($questionId, Database $db) { - // Fixed the SQL syntax error by closing the backtick before table name - $sql = "SELECT * FROM `$this->tableName` WHERE `id` = '" . $questionId . "' LIMIT 1;"; + $sql = "SELECT * FROM `" . $this->tableName . "` WHERE `id` = '" . $questionId . "' LIMIT 1;"; $result = $db->getArray($sql); - // Added condition to check if result is not empty to avoid errors - if (!empty($result)) { - $this->id = $questionId; - $this->name = $result[0]['name']; - $this->text = $result[0]['text']; - $this->answer = $result[0]['answer']; - $this->created = $result[0]['created']; // Fixed array key from 'created' to $result[0]['created'] - } + $this->id = $questionId; + $this->name = $result[0]['name']; + $this->text = $result[0]['text']; + $this->answer = $result[0]['answer']; + $this->created = $result[0]['created']; } public static function getNameById($questionId, Database $db) @@ -43,12 +39,11 @@ public static function getTextById($questionId, Database $db) $sql = "SELECT `text` FROM `" . self::TABLENAME . "` WHERE `id` = '" . $questionId . "' LIMIT 1;"; $result = $db->getArray($sql); - return $result[0]['text']; // Changed $this->text to $result[0]['text'] + return $result[0]['text']; } public static function getAnswerById($questionId, Database $db) { - // Fixed the SQL syntax error by adding a backtick before self::TABLENAME $sql = "SELECT `answer` FROM `" . self::TABLENAME . "` WHERE `id` = '" . $questionId . "' LIMIT 1;"; $result = $db->getArray($sql); @@ -65,17 +60,17 @@ public static function getCreatedById($questionId, Database $db) public static function addQuestion($questionName, $questionText, $questionAnswer, Database $db) { - $columns = [ + $columns = array( 'name', - 'text', - 'answer' // Added missing comma here - ]; + 'text', + 'answer' + ); - $data = [ + $data = array( $questionName, $questionText, $questionAnswer - ]; + ); $db->insert(self::TABLENAME, $columns, $data); diff --git a/phpinfo.php b/phpinfo.php new file mode 100644 index 0000000..d50a07a --- /dev/null +++ b/phpinfo.php @@ -0,0 +1,3 @@ + + + + + ./tests + + + diff --git a/test_pdo_mysql.php b/test_pdo_mysql.php new file mode 100644 index 0000000..c2354db --- /dev/null +++ b/test_pdo_mysql.php @@ -0,0 +1,7 @@ +getMessage(); +} diff --git a/tests/DatabaseConnectionTest.php b/tests/DatabaseConnectionTest.php new file mode 100644 index 0000000..6e604c1 --- /dev/null +++ b/tests/DatabaseConnectionTest.php @@ -0,0 +1,16 @@ +assertTrue($db -> isConnected(), 'Database connection failed'); + } +} diff --git a/tests/testBasic.php b/tests/testBasic.php new file mode 100644 index 0000000..5a0a886 --- /dev/null +++ b/tests/testBasic.php @@ -0,0 +1,18 @@ +assertClassHasAttribute('credentials', '\interview\Config_Database'); + } + + public function testLoggingLoaded() + { + $this->assertInstanceOf('\interview\Logging', new \interview\Logging()); + } +} diff --git a/tests/testBasics.php b/tests/testBasics.php deleted file mode 100644 index 785dbbf..0000000 --- a/tests/testBasics.php +++ /dev/null @@ -1,32 +0,0 @@ -assertClassHasAttribute('credentials', Config_Database::class); - } - - public function testLoggingLoaded() - { - // Changed string to class constant for better readability and to avoid hardcoding class name - // Added parentheses '()' when instantiating the Logging object - $this->assertInstanceOf(Logging::class, new Logging()); - } - - public function testDatabaseLoaded() - { - // Changed string to class constant for better readability and to avoid hardcoding class name - // Added parentheses '()' when instantiating the Database object - $this->assertInstanceOf(Database::class, new Database()); - } -} diff --git a/tests/testQuestion.php b/tests/testQuestion.php index f1d84e2..68ef554 100644 --- a/tests/testQuestion.php +++ b/tests/testQuestion.php @@ -1,25 +1,20 @@ assertInstanceOf(Question::class, new Question(1, new Database())); + $this->assertInstanceOf('\interview\Question', new \interview\Question(1, new \interview\Database())); } public function testInstantiationById() { - $question = new Question(1, new Database()); + $question = new \interview\Question(1, new \interview\Database()); - // Used assertNotEmpty to check if the attributes are not empty $this->assertNotEmpty($question->name); $this->assertNotEmpty($question->text); $this->assertNotEmpty($question->answer); @@ -28,33 +23,28 @@ public function testInstantiationById() public function testStaticGetNameById() { - // Changed string to class constant for better readability and to avoid hardcoding class name - $this->assertNotEmpty(Question::getNameById(1, new Database())); + $this->assertNotEmpty(\interview\Question::getNameById(1, new \interview\Database())); } public function testStaticGetTextById() { - // Changed string to class constant for better readability and to avoid hardcoding class name - $this->assertNotEmpty(Question::getTextById(1, new Database())); + $this->assertNotEmpty(\interview\Question::getTextById(1, new \interview\Database())); } public function testStaticGetAnswerById() { - // Changed string to class constant for better readability and to avoid hardcoding class name - $this->assertNotEmpty(Question::getAnswerById(1, new Database())); + $this->assertNotEmpty(\interview\Question::getAnswerById(1, new \interview\Database())); } public function testStaticGetCreatedById() { - // Changed string to class constant for better readability and to avoid hardcoding class name - $this->assertNotEmpty(Question::getCreatedById(1, new Database())); + $this->assertNotEmpty(\interview\Question::getCreatedById(1, new \interview\Database())); } public function testQuestionsAnswered() { - // Changed string to class constant for better readability and to avoid hardcoding class name - $this->assertNotEmpty(Question::getAnswerById(1, new Database())); - $this->assertNotEmpty(Question::getAnswerById(2, new Database())); - $this->assertNotEmpty(Question::getAnswerById(3, new Database())); + $this->assertNotEmpty(\interview\Question::getAnswerById(1, new \interview\Database())); + $this->assertNotEmpty(\interview\Question::getAnswerById(2, new \interview\Database())); + $this->assertNotEmpty(\interview\Question::getAnswerById(3, new \interview\Database())); } } From 10cf81eafd550f44d298815aa411b432a745c3b4 Mon Sep 17 00:00:00 2001 From: Mandiseli Mfeya <132358238+Mandiseli@users.noreply.github.com> Date: Tue, 25 Jun 2024 14:00:34 +0200 Subject: [PATCH 3/4] Update README.md --- README.md | 71 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 43 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index eca813c..2ce216c 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,43 @@ -Technical Skills Assessment (PHP) -================================= - -Requirements - -* Local development environment with PHP (5.4+) interpreter and MySQL (5.5+) server - -Instructions - -1. Create a Github account if you don’t have one already -2. Send an email to jason at leadwrench dot com with the subject of “PHP Skills Assessment” and include your Github - account ID in the body. You will have 2 hours to complete the assessment from the time you send this email. -3. Fork the repository at: https://github.com/edgeprod/PHP-assessment into your account -4. Pull your forked repository into your IDE -5. Fix any PHP syntax errors you find. Errors have been intentionally placed in the code. -6. Modify code to meet PSR-1 and PSR-2 code style guidelines. Do NOT incorporate PSR-0 or PSR-4, as required by PSR-1. - Make use of self-documenting code principles where necessary. Identify and use other existing style conventions. -7. Initialize and run Composer to get needed dependencies -8. Create a MySQL database and import the ‘schema.sql’ file -9. Update ‘config/database.php’ with credentials to access newly created database -10. Run unit tests to see remaining failures -11. Make needed changes so all unit tests pass, however do NOT change the unit tests in any way. -12. Push ALL changes back to your forked repository, including database changes (into schema.sql) -13. Replace that ‘README.md’ file with the output of all the unit tests passing -14. Create a Pull Request to integrate the fixed code back into the master repository. The Pull Request will ultimately - not be merged but will signal your completion of the skills assessment. - -Please ask for clarification if you have a question. Guessing an answer to an ambiguous directive will count against you. +Error Encountered in PHPUnit Testing + +Error Message: + +PHPUnit 8.5.38 by Sebastian Bergmann and contributors. + +E 1 / 1 (100%) + +Time: 540 ms, Memory: 4.00 MB + +There was 1 error: + +1) Tests\DatabaseConnectionTest::testDatabaseConnection +Error: Class "config\Config_Database" not found + +C:\Users\lenovo\source\repos\PHP-assessment\core\database.php:16 +C:\Users\lenovo\source\repos\PHP-assessment\tests\DatabaseConnectionTest.php:13 + +ERRORS! +Tests: 1, Assertions: 0, Errors: 1. + + +Description: +During the execution of PHPUnit tests in my project (PHP-assessment), an error occurred related to the class Config_Database not being found. This error specifically happened when PHPUnit attempted to run the DatabaseConnectionTest::testDatabaseConnection test method. + +Probable Causes: +Autoloading Issue: The autoloader might not be correctly configured to load the Config_Database class. +Namespace Mismatch: There could be a mismatch between the namespace defined in Config_Database and where PHPUnit expects to find it. +File Path or Name Issue: The file defining Config_Database might not exist or might be named differently than expected. +Steps Taken to Resolve +Checked the composer.json for correct autoloading configurations. +Verified the namespace and class name in Config_Database and DatabaseConnectionTest.php. +Ran composer dump-autoload to regenerate autoload files. +Reviewed the file path and ensured it matches the namespace structure. +Next Steps +To resolve this issue, I will continue investigating the autoloading setup and namespace/class definitions to ensure that PHPUnit can locate the Config_Database class during testing. + +Additional Information +PHPUnit Version: 8.5.38 +-Project Path: C:\Users\lenovo\source\repos\PHP-assessment +-Affected Files: +-core\database.php +-tests\DatabaseConnectionTest.php From 2ff329af9093ea65e27da052b1fddf52a4549efe Mon Sep 17 00:00:00 2001 From: Mandiseli Mfeya <132358238+Mandiseli@users.noreply.github.com> Date: Tue, 25 Jun 2024 14:11:49 +0200 Subject: [PATCH 4/4] Update README.md --- README.md | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 2ce216c..5f3d8d4 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,9 @@ Error Encountered in PHPUnit Testing +============================================== Error Message: - +------------------------------------------------- +------------------------------------------------------ PHPUnit 8.5.38 by Sebastian Bergmann and contributors. E 1 / 1 (100%) @@ -21,23 +23,29 @@ Tests: 1, Assertions: 0, Errors: 1. Description: +---------------------------------------------------------------------- During the execution of PHPUnit tests in my project (PHP-assessment), an error occurred related to the class Config_Database not being found. This error specifically happened when PHPUnit attempted to run the DatabaseConnectionTest::testDatabaseConnection test method. Probable Causes: +-------------------------------------------------------------------------- Autoloading Issue: The autoloader might not be correctly configured to load the Config_Database class. Namespace Mismatch: There could be a mismatch between the namespace defined in Config_Database and where PHPUnit expects to find it. File Path or Name Issue: The file defining Config_Database might not exist or might be named differently than expected. -Steps Taken to Resolve -Checked the composer.json for correct autoloading configurations. -Verified the namespace and class name in Config_Database and DatabaseConnectionTest.php. -Ran composer dump-autoload to regenerate autoload files. -Reviewed the file path and ensured it matches the namespace structure. -Next Steps -To resolve this issue, I will continue investigating the autoloading setup and namespace/class definitions to ensure that PHPUnit can locate the Config_Database class during testing. - -Additional Information -PHPUnit Version: 8.5.38 --Project Path: C:\Users\lenovo\source\repos\PHP-assessment --Affected Files: --core\database.php --tests\DatabaseConnectionTest.php + + +Steps Taken to Resolve: +------------------------------------------------------------ +1. Checked the composer.json for correct autoloading configurations. +2. Verified the namespace and class name in Config_Database and DatabaseConnectionTest.php. +3. Ran composer dump-autoload to regenerate autoload files. +4. Reviewed the file path and ensured it matches the namespace structure. + Next Steps +5. To resolve this issue, I will continue investigating the autoloading setup and namespace/class definitions to ensure that PHPUnit can locate the Config_Database class during testing. + +Additional Information: +-------------------------------------------------------------- +1. PHPUnit Version: 8.5.38 +2. Project Path: C:\Users\lenovo\source\repos\PHP-assessment +3. Affected Files: +3.1 core\database.php +3.2 tests\DatabaseConnectionTest.php