diff --git a/app/Http/Controllers/PHP/PHPController.php b/app/Http/Controllers/PHP/PHPController.php
index 503419d..1a17b33 100644
--- a/app/Http/Controllers/PHP/PHPController.php
+++ b/app/Http/Controllers/PHP/PHPController.php
@@ -192,6 +192,8 @@ function task_submission(Request $request){
$testing_number_one = "testing_number_four";
}elseif($_POST['testing_number_one'] == 5){
$testing_number_one = "testing_number_five";
+ }elseif($_POST['testing_number_one'] == 6){
+ $testing_number_one = "testing_number_six";
}
$fileContent = str_replace("'", '"', $fileContent);
@@ -284,62 +286,61 @@ function unittesting(){
$pa = "vendor\bin\phpunit -c $path_test --filter HomepageLayoutTest::$unitesting_run";
$path = base_path($pa);
$output = shell_exec($path);
+
//echo "
$pa
";
$sql = DB::select("SELECT * FROM php_testing_rule WHERE testing_name = '$testing_number_one'");
- $row = $sql[0];
- $html = $row->testing_rule;
+ $row = $sql[0];
+ $html = $row->testing_rule;
- $test = str_replace(array("\r\n","\r","\n"," "),"",$html);
- $result_test = htmlspecialchars($test);
+ $test = str_replace(array("\r\n","\r","\n"," "),"",$html);
+ $result_test = htmlspecialchars($test);
- $string = json_encode($output);
+ $string = json_encode($output);
- $text = str_replace("\n", ' ', $output);
- $cleaned = preg_replace('/\e\[[;?\d]*m/', '', $string);
+ $text = str_replace("\n", ' ', $output);
+ $cleaned = preg_replace('/\e\[[;?\d]*m/', '', $string);
- // Pola regex untuk mengekstrak versi Codeception
- $pattern = '/Codeception PHP Testing Framework v([\d.]+)/';
+ $pattern = '/Codeception PHP Testing Framework v([\d.]+)/';
- // Define patterns to extract relevant information
- $pattern_phpunit_version = '/PHPUnit\s+([\d.]+)\s+by/';
- $pattern_php_runtime = '/Runtime:\s+PHP\s+([\d.]+)/';
- $pattern_configuration = '/Configuration:\s+(.+)/';
- $pattern_failure_count = '/There was (\d+) failure/';
- $pattern_failure_test_case = '/Failed asserting that \'(.*?)\' contains \'(.*?)\'./';
- $pattern_failure_location = '/(C:\\\\.*?\\.php):(\d+)/';
- $pattern_path = 'C:\\xampp\\htdocs\\iclop\\phpunit.xml';
- $pattern_time = '/Time:\s+([0-9:.]+)/';
- $pattern_memory = '/Memory:\s+([\d.]+)\s+(MB|KB|GB)/';
- $pattern_ok = '/OK\s+\((\d+)\s+test(?:s)?,\s+(\d+)\s+assertion(?:s)?\)/';
- $pattern_failures = '/Tests:\s+(\d+),\s+Assertions:\s+(\d+),\s+Failures:\s+(\d+)/';
- // Perform matching
- preg_match($pattern_phpunit_version, $text, $matches_phpunit_version);
- preg_match($pattern_php_runtime, $text, $matches_php_runtime);
- preg_match($pattern_configuration, $text, $matches_configuration);
- preg_match($pattern_failure_count, $text, $matches_failure_count);
- preg_match($pattern_failure_test_case, $text, $matches_failure_test_case);
- preg_match($pattern_failure_location, $text, $matches_failure_location);
- preg_match($pattern_ok, $text, $matches_ok);
- preg_match($pattern_time, $text, $matches_time);
- preg_match($pattern_memory, $text, $matches_memory);
- preg_match($pattern_failures, $text, $matches_failures);
- preg_match($pattern, $cleaned, $matches);
- // Extracted information
- $phpunit_version = $matches_phpunit_version[1] ?? 'Not found';
- $phpunit_stat = isset($matches_ok[0]) ? $matches_ok[0] : "Not found";
- $phpunit_time = isset($matches_time[1]) ? $matches_time[1] : "Not found";
- $phpunit_memory = isset($matches_memory[0]) ? $matches_memory[0] : "Not found";
- $php_runtime = isset($matches_php_runtime[1]) ? $matches_php_runtime[1] : "Not found";
- $configuration_path = isset($matches_configuration[1]) ? $matches_configuration[1] : "Not found";
- $num_failures = isset($matches_failure_count[1]) ? $matches_failure_count[1] : "Not found";
- $failed_assertion = isset($matches_failure_test_case[1]) ? htmlspecialchars($matches_failure_test_case[1]) : "Not found";
- $expected_content = isset($matches_failure_test_case[2]) ? htmlspecialchars($matches_failure_test_case[2]) : "Not found";
- $failure_location = isset($matches_failure_location[1]) ? $matches_failure_location[1] : "Not found";
- $failure_line = isset($matches_failure_location[2]) ? $matches_failure_location[2] : "Not found";
- if (!empty($matches_failures)) {
- $tests_assertions_failures = "FAILURES!
Tests: " . $matches_failures[1] . ", Assertions: " . $matches_failures[2] . ", Failures: " . $matches_failures[3];
- }
+ $pattern_phpunit_version = '/PHPUnit\s+([\d.]+)\s+by/';
+ $pattern_php_runtime = '/Runtime:\s+PHP\s+([\d.]+)/';
+ $pattern_configuration = '/Configuration:\s+(.+)/';
+ $pattern_failure_count = '/There was (\d+) failure/';
+ $pattern_failure_test_case = '/Failed asserting that \'(.*?)\' contains \'(.*?)\'./';
+ $pattern_failure_location = '/(C:\\\\.*?\\.php):(\d+)/';
+ $pattern_path = 'C:\\xampp\\htdocs\\iclop\\phpunit.xml';
+ $pattern_time = '/Time:\s+([0-9:.]+)/';
+ $pattern_memory = '/Memory:\s+([\d.]+)\s+(MB|KB|GB)/';
+ $pattern_ok = '/OK\s+\((\d+)\s+test(?:s)?,\s+(\d+)\s+assertion(?:s)?\)/';
+ $pattern_failures = '/Tests:\s+(\d+),\s+Assertions:\s+(\d+),\s+Failures:\s+(\d+)/';
+
+ preg_match($pattern_phpunit_version, $text, $matches_phpunit_version);
+ preg_match($pattern_php_runtime, $text, $matches_php_runtime);
+ preg_match($pattern_configuration, $text, $matches_configuration);
+ preg_match($pattern_failure_count, $text, $matches_failure_count);
+ preg_match($pattern_failure_test_case, $text, $matches_failure_test_case);
+ preg_match($pattern_failure_location, $text, $matches_failure_location);
+ preg_match($pattern_ok, $text, $matches_ok);
+ preg_match($pattern_time, $text, $matches_time);
+ preg_match($pattern_memory, $text, $matches_memory);
+ preg_match($pattern_failures, $text, $matches_failures);
+ preg_match($pattern, $cleaned, $matches);
+
+ $phpunit_version = $matches_phpunit_version[1] ?? 'Not found';
+ $phpunit_stat = isset($matches_ok[0]) ? $matches_ok[0] : "Not found";
+ $phpunit_time = isset($matches_time[1]) ? $matches_time[1] : "Not found";
+ $phpunit_memory = isset($matches_memory[0]) ? $matches_memory[0] : "Not found";
+ $php_runtime = isset($matches_php_runtime[1]) ? $matches_php_runtime[1] : "Not found";
+ $configuration_path = isset($matches_configuration[1]) ? $matches_configuration[1] : "Not found";
+ $num_failures = isset($matches_failure_count[1]) ? $matches_failure_count[1] : "Not found";
+ $failed_assertion = isset($matches_failure_test_case[1]) ? htmlspecialchars($matches_failure_test_case[1]) : "Not found";
+ $expected_content = isset($matches_failure_test_case[2]) ? htmlspecialchars($matches_failure_test_case[2]) : "Not found";
+ $failure_location = isset($matches_failure_location[1]) ? $matches_failure_location[1] : "Not found";
+ $failure_line = isset($matches_failure_location[2]) ? $matches_failure_location[2] : "Not found";
+ if (!empty($matches_failures)) {
+ $tests_assertions_failures = "FAILURES!
Tests: " . $matches_failures[1] . ", Assertions: " . $matches_failures[2] . ", Failures: " . $matches_failures[3];
+ }
if($num_failures == 1){
$username = Session::get('user_name');
@@ -363,10 +364,11 @@ function unittesting(){
$diff_err = "";
// Memecah string HTML menjadi array per baris
- $html1_lines = explode("\n", $html1);
- $html2_lines = explode("\n", $html2);
- $result_content = str_replace(array("\r\n","\r"," "),"", $html1_lines);
- $result_content2 = str_replace(array("\r\n","\r"," "),"", $html2_lines);
+ $html1_lines = explode("\n", $html1);
+ $html2_lines = explode("\n", $html2);
+ $result_content = str_replace(array("\r\n","\r"," "),"", $html1_lines);
+ $result_content2 = str_replace(array("\r\n","\r"," "),"", $html2_lines);
+
// Membandingkan setiap baris
for ($i = 0; $i < count($result_content) && $i < count($result_content2); $i++) {
if ($result_content[$i] != $result_content2[$i]) {
diff --git a/iclop.sql b/iclop.sql
index f2f9fa2..b1881c7 100644
--- a/iclop.sql
+++ b/iclop.sql
@@ -11,7 +11,7 @@
Target Server Version : 100425 (10.4.25-MariaDB)
File Encoding : 65001
- Date: 07/05/2025 12:51:16
+ Date: 09/05/2025 05:03:52
*/
SET NAMES utf8mb4;
@@ -87591,7 +87591,7 @@ CREATE TABLE `php_submits_submission` (
PRIMARY KEY (`id`) USING BTREE,
INDEX `user_id`(`task_id` ASC) USING BTREE,
INDEX `android_topic_id`(`testing_type` ASC) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 268 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = DYNAMIC;
+) ENGINE = InnoDB AUTO_INCREMENT = 310 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of php_submits_submission
@@ -87847,6 +87847,48 @@ INSERT INTO `php_submits_submission` VALUES (264, NULL, 3, 14, 2, 'Amal Dermawan
INSERT INTO `php_submits_submission` VALUES (265, NULL, 4, 14, 2, 'Amal Dermawan Udjir', NULL, 'testing_number_four', 'github', 'update.php', 'connect_error) {\r\n die(\"Connection failed: \" . $conn->connect_error);\r\n}\r\n\r\n\r\n// Mengambil data berdasarkan ID\r\nif (isset($_GET[\"id\"])) {\r\n $id = $_GET[\"id\"];\r\n $query = \"SELECT * FROM users WHERE id = \"$id\"\";\r\n $result = $conn->query($query);\r\n \r\n if ($row = $result->fetch_assoc()) {\r\n $name = $row[\"name\"];\r\n $email = $row[\"email\"];\r\n $prodi = $row[\"prodi\"];\r\n }\r\n}\r\n\r\n// Proses update data\r\nif (isset($_POST[\"update\"])) {\r\n $id = $_POST[\"id\"];\r\n $name = $_POST[\"nama\"];\r\n $email = $_POST[\"email\"];\r\n $prodi = $_POST[\"prodi\"];\r\n\r\n $sql = \"UPDATE users SET name = \"$name\", email = \"$email\", prodi = \"$prodi\" WHERE id = \"$id\"\";\r\n\r\n if ($conn->query($sql) === TRUE) {\r\n echo \"Data berhasil diperbarui! Kembali ke daftar mahasiswa\";\r\n } else {\r\n echo \"Error: \" . $sql . \"
\" . $conn->error;\r\n }\r\n}\r\n?>\r\n\r\n\r\n\r\n\r\n \r\n \r\n Formulir Update Mahasiswa\r\n\r\n\r\n Formulir Update Mahasiswa
\r\n \r\n\r\n\r\n', NULL, NULL, NULL, NULL, NULL);
INSERT INTO `php_submits_submission` VALUES (266, NULL, 2, 14, 2, 'Amal Dermawan Udjir', NULL, 'testing_number_two', 'github', 'index.php', 'connect_error) {\r\n die(\"Connection failed: \" . $conn->connect_error);\r\n}\r\n\r\n$sql = \"SELECT * FROM users\";\r\n$result = $conn->query($sql);\r\n\r\nif ($result->num_rows > 0) {\r\n echo \"Insert Data
\";\r\n echo \"\";\r\n echo \"\r\n | Name | \r\n Email | \r\n study program | \r\n By | \r\n Action | \r\n
\";\r\n\r\n while ($row = $result->fetch_assoc()) {\r\n echo \"\";\r\n echo \"| \" . $row[\"name\"] . \" | \";\r\n echo \"\" . $row[\"email\"] . \" | \";\r\n echo \"\" . $row[\"prodi\"] . \" | \";\r\n echo \"\" . $row[\"username\"] . \" | \";\r\n echo \"Edit | Delete | \";\r\n echo \"
\";\r\n }\r\n\r\n echo \"
\";\r\n} else {\r\n echo \"Insert Data
\";\r\n echo \"0 results\";\r\n}\r\n\r\n?>\r\n', NULL, NULL, NULL, NULL, NULL);
INSERT INTO `php_submits_submission` VALUES (267, NULL, 5, 14, 2, 'Amal Dermawan Udjir', NULL, 'testing_number_five', 'github', 'delete.php', 'connect_error) {\r\ndie(\"Connection failed: \" . $conn->connect_error);\r\n}\r\n\r\n$id = $_GET[\"id\"];\r\n$sql = \"DELETE FROM users WHERE id = $id\";\r\n\r\n\r\nif ($conn->query($sql) === TRUE) {\r\necho \"Record deleted successfully\";\r\n} else {\r\necho \"Error: \" . $sql . \"
\" . $conn->error;\r\n}\r\n\r\n$conn->close();\r\n?>\r\n', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `php_submits_submission` VALUES (268, NULL, 2, 8, 1, 'Amal Dermawan Udjir', NULL, 'testing_number_two', 'github', 'GuideA2.php', '', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `php_submits_submission` VALUES (269, NULL, 2, 8, 1, 'Amal Dermawan Udjir', NULL, 'testing_number_two', 'github', 'GuideA2.php', '', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `php_submits_submission` VALUES (270, NULL, 2, 8, 1, 'Amal Dermawan Udjir', NULL, 'testing_number_two', 'github', 'GuideA2.php', '', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `php_submits_submission` VALUES (271, NULL, 2, 8, 1, 'Amal Dermawan Udjir', NULL, 'testing_number_two', 'github', 'GuideA2.php', '', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `php_submits_submission` VALUES (272, NULL, 2, 8, 1, 'Amal Dermawan Udjir', NULL, 'testing_number_two', 'github', 'GuideA2.php', '', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `php_submits_submission` VALUES (273, NULL, 2, 8, 1, 'Amal Dermawan Udjir', NULL, 'testing_number_two', 'github', 'GuideA2.php', '', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `php_submits_submission` VALUES (274, NULL, 2, 8, 1, 'Amal Dermawan Udjir', NULL, 'testing_number_two', 'github', 'GuideA2.php', '', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `php_submits_submission` VALUES (275, NULL, 2, 8, 1, 'Amal Dermawan Udjir', NULL, 'testing_number_two', 'github', 'GuideA2.php', '', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `php_submits_submission` VALUES (276, NULL, 2, 8, 1, 'Amal Dermawan Udjir', NULL, 'testing_number_two', 'github', 'GuideA2.php', '', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `php_submits_submission` VALUES (277, NULL, 2, 8, 1, 'Amal Dermawan Udjir', NULL, 'testing_number_two', 'github', 'GuideA2.php', '', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `php_submits_submission` VALUES (278, NULL, 2, 8, 1, 'Amal Dermawan Udjir', NULL, 'testing_number_two', 'github', 'GuideA2.php', '', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `php_submits_submission` VALUES (279, NULL, 2, 8, 1, 'Amal Dermawan Udjir', NULL, 'testing_number_two', 'github', 'GuideA2.php', '', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `php_submits_submission` VALUES (280, NULL, 2, 8, 1, 'Amal Dermawan Udjir', NULL, 'testing_number_two', 'github', 'GuideA2.php', '', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `php_submits_submission` VALUES (281, NULL, 2, 8, 1, 'Amal Dermawan Udjir', NULL, 'testing_number_two', 'github', 'GuideA2.php', '', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `php_submits_submission` VALUES (282, NULL, 2, 8, 1, 'Amal Dermawan Udjir', NULL, 'testing_number_two', 'github', 'GuideA2.php', '', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `php_submits_submission` VALUES (283, NULL, 2, 8, 1, 'Amal Dermawan Udjir', NULL, 'testing_number_two', 'github', 'GuideA2.php', '', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `php_submits_submission` VALUES (284, NULL, 2, 8, 1, 'Amal Dermawan Udjir', NULL, 'testing_number_two', 'github', 'GuideA2.php', '', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `php_submits_submission` VALUES (285, NULL, 2, 8, 1, 'Amal Dermawan Udjir', NULL, 'testing_number_two', 'github', 'GuideA2.php', '', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `php_submits_submission` VALUES (286, NULL, 2, 8, 1, 'Amal Dermawan Udjir', NULL, 'testing_number_two', 'github', 'GuideA2.php', '', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `php_submits_submission` VALUES (287, NULL, 2, 8, 1, 'Amal Dermawan Udjir', NULL, 'testing_number_two', 'github', 'GuideA2.php', '', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `php_submits_submission` VALUES (288, NULL, 2, 8, 1, 'Amal Dermawan Udjir', NULL, 'testing_number_two', 'github', 'GuideA2.php', '', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `php_submits_submission` VALUES (289, NULL, 2, 8, 1, 'Amal Dermawan Udjir', NULL, 'testing_number_two', 'github', 'GuideA2.php', '', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `php_submits_submission` VALUES (290, NULL, 2, 8, 1, 'Amal Dermawan Udjir', NULL, 'testing_number_two', 'github', 'GuideA2.php', '', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `php_submits_submission` VALUES (291, NULL, 1, 7, 1, 'Amal Dermawan Udjir', NULL, 'testing_number_one', 'github', 'GuideA1.php', '\r\n\r\n\r\nBelajar Membuat Heading dan Paragraph\r\n\r\n\r\nHeading ke-1
\r\nHeading ke-2
\r\nHeading ke-3
\r\nHeading ke-4
\r\nHeading ke-5
\r\nHeading ke-6
\r\n ini contoh paragraph
\r\n\r\n\r\n', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `php_submits_submission` VALUES (292, NULL, 1, 7, 1, 'Amal Dermawan Udjir', NULL, 'testing_number_one', 'github', 'GuideA1.php', '\r\n\r\n\r\nBelajar Membuat Heading dan Paragraph\r\n\r\n\r\nHeading ke-2
\r\nHeading ke-2
\r\nHeading ke-3
\r\nHeading ke-4
\r\nHeading ke-5
\r\nHeading ke-6
\r\n ini contoh paragraph
\r\n\r\n\r\n', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `php_submits_submission` VALUES (293, NULL, 1, 7, 1, 'Amal Dermawan Udjir', NULL, 'testing_number_one', 'github', 'GuideA1.php', '\r\n\r\n\r\nBelajar Membuat Heading dan Paragraph\r\n\r\n\r\nHeading ke-1\";\r\necho $h1;\r\n?>\r\nHeading ke-2
\r\nHeading ke-3
\r\nHeading ke-4
\r\nHeading ke-5
\r\nHeading ke-6
\r\n ini contoh paragraph
\r\n\r\n\r\n', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `php_submits_submission` VALUES (294, NULL, 2, 8, 1, 'Amal Dermawan Udjir', NULL, 'testing_number_two', 'github', 'GuideA2.php', '', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `php_submits_submission` VALUES (295, NULL, 1, 7, 1, 'Amal Dermawan Udjir', NULL, 'testing_number_one', 'github', 'GuideA1.php', '\r\n\r\n\r\nBelajar Membuat Heading dan Paragraph\r\n\r\n\r\nHeading ke-1\";\r\necho $h1;\r\n?>\r\nHeading ke-2
\r\nHeading ke-3
\r\nHeading ke-4
\r\nHeading ke-5
\r\nHeading ke-6
\r\n ini contoh paragraph
\r\n\r\n\r\n', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `php_submits_submission` VALUES (296, NULL, 1, 7, 1, 'Amal Dermawan Udjir', NULL, 'testing_number_one', 'github', 'GuideA1.php', '\r\n\r\n\r\nBelajar Membuat Heading dan Paragraph\r\n\r\n\r\nHeading ke-1\";\r\necho $h1;\r\n?>\r\nHeading ke-2
\r\nHeading ke-3
\r\nHeading ke-4
\r\nHeading ke-5
\r\nHeading ke-6
\r\n ini contoh paragraph
\r\n\r\n\r\n', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `php_submits_submission` VALUES (297, NULL, 1, 7, 1, 'Amal Dermawan Udjir', NULL, 'testing_number_one', 'github', 'GuideA1.php', '\r\n\r\n\r\nBelajar Membuat Heading dan Paragraph\r\n\r\n\r\nHeading ke-1\";\r\necho $h1;\r\n?>\r\nHeading ke-2
\r\nHeading ke-3
\r\nHeading ke-4
\r\nHeading ke-5
\r\nHeading ke-6
\r\n ini contoh paragraph
\r\n\r\n\r\n', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `php_submits_submission` VALUES (298, NULL, 1, 7, 1, 'Amal Dermawan Udjir', NULL, 'testing_number_one', 'github', 'GuideA1.php', '\r\n\r\n\r\nBelajar Membuat Heading dan Paragraph\r\n\r\n\r\nHeading ke-1\";\r\necho $h1;\r\n?>\r\nHeading ke-2
\r\nHeading ke-3
\r\nHeading ke-4
\r\nHeading ke-5
\r\nHeading ke-6
\r\n ini contoh paragraph
\r\n\r\n\r\n', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `php_submits_submission` VALUES (299, NULL, 2, 8, 1, 'Amal Dermawan Udjir', NULL, 'testing_number_two', 'github', 'GuideA2.php', '', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `php_submits_submission` VALUES (300, NULL, 1, 7, 1, 'Amal Dermawan Udjir', NULL, 'testing_number_one', 'github', 'GuideA1.php', '\r\n\r\n\r\nBelajar Membuat Heading dan Paragraph\r\n\r\n\r\nHeading ke-1\";\r\necho $h1;\r\n?>\r\nHeading ke-2
\r\nHeading ke-3
\r\nHeading ke-4
\r\nHeading ke-5
\r\nHeading ke-6
\r\n ini contoh paragraph
\r\n\r\n\r\n', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `php_submits_submission` VALUES (301, NULL, 1, 7, 1, 'Amal Dermawan Udjir', NULL, 'testing_number_one', 'github', 'GuideA1.php', '\r\n\r\n\r\nBelajar Membuat Heading dan Paragraph\r\n\r\n\r\nHeading ke-1\";\r\necho $h1;\r\n?>\r\nHeading \r\n ke-2
\r\nHeading ke-3
\r\nHeading ke-4
\r\nHeading ke-5
\r\nHeading ke-6
\r\n ini contoh paragraph
\r\n\r\n\r\n', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `php_submits_submission` VALUES (302, NULL, 3, 9, 1, 'Amal Dermawan Udjir', NULL, 'testing_number_three', 'github', 'GuideA3.php', '\";\r\necho \"Umur : $umur
\";\r\necho \"Tinggi : $tinggi
\";\r\necho \"Aktif : $aktif
\";\r\necho \"Gaji Pokok : $gaji_pokok
\";\r\necho \"Gaji Bulanan : $gaji_bulanan
\";\r\necho \"Gaji Per Tahun : $gaji_per_tahun
\";\r\necho \"PPN : $ppn
\";\r\necho \"Gaji Setelah PPN : $gaji_setelah_ppn
\";', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `php_submits_submission` VALUES (303, NULL, 3, 9, 1, 'Amal Dermawan Udjir', NULL, 'testing_number_three', 'github', 'GuideA3.php', '\";\r\necho \"Umur : $umur
\";\r\necho \"Tinggi : $tinggi
\";\r\necho \"Aktif : $aktif
\";\r\necho \"Gaji Pokok : $gaji_pokok
\";\r\necho \"Gaji Bulanan : $gaji_bulanan
\";\r\necho \"Gaji Per Tahun : $gaji_per_tahun
\";\r\necho \"PPN : $ppn
\";\r\necho \"Gaji Setelah PPN : $gaji_setelah_ppn
\";\r\n\r\n?>', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `php_submits_submission` VALUES (304, NULL, 3, 9, 1, 'Amal Dermawan Udjir', NULL, 'testing_number_three', 'github', 'GuideA3.php', '\";\r\necho \"Umur : $umur
\";\r\necho \"Tinggi : $tinggi
\";\r\necho \"Aktif : $aktif
\";\r\necho \"Gaji Pokok : \r\n$gaji_pokok
\";\r\necho \"Gaji Bulanan : $gaji_bulanan
\";\r\necho \"Gaji Per Tahun : $gaji_per_tahun
\";\r\necho \"PPN : $ppn
\";\r\necho \"Gaji Setelah PPN : $gaji_setelah_ppn
\";\r\n\r\n?>', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `php_submits_submission` VALUES (305, NULL, 3, 9, 1, 'Amal Dermawan Udjir', NULL, 'testing_number_three', 'github', 'GuideA3.php', '\";\r\necho \"Umur : $umur
\";\r\necho \"Tinggi : $tinggi
\";\r\necho \"Aktif : $aktif
\";\r\necho \"Gaji Pokok : $gaji_pokok
\";\r\necho \"Gaji Bulanan : $gaji_bulanan
\";\r\necho \"Gaji Per Tahun : $gaji_per_tahun
\";\r\necho \"PPN : $ppn
\";\r\necho \"Gaji Setelah PPN : $gaji_setelah_ppn
\";\r\n\r\n?>', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `php_submits_submission` VALUES (306, NULL, 3, 9, 1, 'Amal Dermawan Udjir', NULL, 'testing_number_three', 'github', 'GuideA3.php', '\";\r\necho \"Umur : $umur
\";\r\necho \"Tinggi : $tinggi
\";\r\necho \"Aktif : $aktif
\";\r\necho \"Gaji Pokok : $gaji_pokok
\";\r\necho \"Gaji Bulanan : $gaji_bulanan
\";\r\necho \"Gaji Per Tahun : $gaji_per_tahun
\";\r\necho \"PPN : $ppn
\";\r\necho \"Gaji Setelah PPN : $gaji_setelah_ppn
\";\r\n\r\n?>', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `php_submits_submission` VALUES (307, NULL, 4, 10, 1, 'Amal Dermawan Udjir', NULL, 'testing_number_four', 'github', 'GuideA4.php', '= 70) {\r\n echo \"Nilai Anda: \" . $nilai . \"
\";\r\n echo \"Anda lulus!\";\r\n}\r\n\r\necho \"
\";\r\n$nilai = 55;\r\nif ($nilai >= 70) {\r\n echo \"Nilai Anda: \" . $nilai . \"
\";\r\n echo \"Anda lulus!\";\r\n} else {\r\n echo \"Nilai Anda:\".$nilai.\"
\";\r\n echo \"Anda tidak lulus.\";\r\n}\r\n\r\necho \"
\";\r\n$nilai = \"B\";\r\nswitch ($nilai){\r\n case \"A\":\r\n echo \"Nilai Anda: \" . $nilai . \"
\";\r\n echo \"Pertahankan prestasi!\";\r\n break;\r\n case \"B\":\r\n echo \"Nilai Anda: \" . $nilai . \"
\";\r\n echo \"Cukup baik, terus tingkatkan!\";\r\n break;\r\n case \"C\":\r\n echo \"Nilai Anda: \" . $nilai . \"
\";\r\n echo \"Perlu lebih banyak belajar.\";\r\n break;\r\n default:\r\n echo \"Nilai Anda: \" . $nilai . \"
\";\r\n echo \"Maaf, tidak ada keterangan.\";\r\n}\r\n?>', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `php_submits_submission` VALUES (308, NULL, 5, 11, 1, 'Amal Dermawan Udjir', NULL, 'testing_number_five', 'github', 'GuideA5.php', '\";\r\nwhile ($angka <= 5) {\r\n echo \"Angka: $angka
\";\r\n $angka++;\r\n}\r\necho \"
\";\r\n\r\necho \"Perulangan for:
\";\r\nfor ($i = 1; $i <= 5; $i++) {\r\n echo \"Angka: $i
\";\r\n}\r\necho \"
\";\r\n\r\n$angka = 1;\r\necho \"Perulangan do-while:
\";\r\ndo {\r\n echo \"Angka: $angka
\";\r\n $angka++;\r\n} while ($angka <= 5);\r\n\r\n?>', NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `php_submits_submission` VALUES (309, NULL, 6, 12, 1, 'Amal Dermawan Udjir', NULL, 'testing_number_six', 'github', 'GuideA6.php', '\";\r\necho \"Status kedua: \" . ($status[1] ? \"Aktif\" : \"Tidak Aktif\") . \"
\";\r\n\r\n$bilangan[] = 6;\r\nunset($nama[0]);\r\n\r\n$posisi = array_search(\"Doe\", $nama);\r\necho \"Posisi Nama Doe Terletak Pada Array Ke : \". $posisi . \"
\";;\r\n\r\n$jumlah_nama = count($nama);\r\necho \"Jumlah Nama Pada Array Adalah : \". $jumlah_nama . \"
\";\r\n\r\narray_push($nama, \"Smith\");\r\n$elemen_terakhir = array_pop($nama);\r\necho \"Elemen baru ditambahkan ke Array adalah : \". $elemen_terakhir . \"
\";\r\n?>', NULL, NULL, NULL, NULL, NULL);
-- ----------------------------
-- Table structure for php_task
@@ -87893,19 +87935,21 @@ DROP TABLE IF EXISTS `php_testing_rule`;
CREATE TABLE `php_testing_rule` (
`id` int NOT NULL AUTO_INCREMENT,
`testing_rule` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL,
+ `output` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL,
`testing_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;
+) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of php_testing_rule
-- ----------------------------
-INSERT INTO `php_testing_rule` VALUES (1, '\r\n\r\n\r\nBelajar Membuat Heading dan Paragraph\r\n\r\n\r\nHeading ke-1
\r\nHeading ke-2
\r\nHeading ke-3
\r\nHeading ke-4
\r\nHeading ke-5
\r\nHeading ke-6
\r\n ini contoh paragraph
\r\n\r\n', 'testing_number_one');
-INSERT INTO `php_testing_rule` VALUES (2, '', 'testing_number_two');
-INSERT INTO `php_testing_rule` VALUES (4, 'php_testing_rule', 'testMethodPOST');
-INSERT INTO `php_testing_rule` VALUES (5, '= 70) {\r\n echo \"Nilai Anda: \" . $nilai . \"
\";\r\n echo \"Anda lulus!\";\r\n}\r\n\r\necho \"
\";\r\n$nilai = 55;\r\nif ($nilai >= 70) {\r\n echo \"Nilai Anda: \" . $nilai . \"
\";\r\n echo \"Anda lulus!\";\r\n} else {\r\n echo \"Nilai Anda:\".$nilai.\"
\";\r\n echo \"Anda tidak lulus.\";\r\n}\r\n\r\necho \"
\";\r\n$nilai = \"B\";\r\nswitch ($nilai){\r\n case \"A\":\r\n echo \"Nilai Anda: \" . $nilai . \"
\";\r\n echo \"Pertahankan prestasi!\";\r\n break;\r\n case \"B\":\r\n echo \"Nilai Anda: \" . $nilai . \"
\";\r\n echo \"Cukup baik, terus tingkatkan!\";\r\n break;\r\n case \"C\":\r\n echo \"Nilai Anda: \" . $nilai . \"
\";\r\n echo \"Perlu lebih banyak belajar.\";\r\n break;\r\n default:\r\n echo \"Nilai Anda: \" . $nilai . \"
\";\r\n echo \"Maaf, tidak ada keterangan.\";\r\n}\r\n?>', 'testing_number_three');
-INSERT INTO `php_testing_rule` VALUES (6, '\";\r\nwhile ($angka <= 5) {\r\n echo \"Angka: $angka
\";\r\n $angka++;\r\n}\r\necho \"
\";\r\n\r\necho \"Perulangan for:
\";\r\nfor ($i = 1; $i <= 5; $i++) {\r\n echo \"Angka: $i
\";\r\n}\r\necho \"
\";\r\n\r\n$angka = 1;\r\necho \"Perulangan do-while:
\";\r\ndo {\r\n echo \"Angka: $angka
\";\r\n $angka++;\r\n} while ($angka <= 5);\r\n\r\n?>', 'testing_number_four');
-INSERT INTO `php_testing_rule` VALUES (7, '\";\r\necho \"Status kedua: \" . ($status[1] ? \"Aktif\" : \"Tidak Aktif\") . \"
\";\r\n\r\n$bilangan[] = 6;\r\nunset($nama[0]);\r\n\r\n$posisi = array_search(\"Doe\", $nama);\r\necho \"Posisi Nama Doe Terletak Pada Array Ke : \". $posisi . \"
\";;\r\n\r\n$jumlah_nama = count($nama);\r\necho \"Jumlah Nama Pada Array Adalah : \". $jumlah_nama . \"
\";\r\n\r\narray_push($nama, \"Smith\");\r\n$elemen_terakhir = array_pop($nama);\r\necho \"Elemen baru ditambahkan ke Array adalah : \". $elemen_terakhir . \"
\";\r\n?>', 'testing_number_five');
+INSERT INTO `php_testing_rule` VALUES (1, '\r\n\r\n\r\nBelajar Membuat Heading dan Paragraph\r\n\r\n\r\nHeading ke-1
\r\nHeading ke-2
\r\nHeading ke-3
\r\nHeading ke-4
\r\nHeading ke-5
\r\nHeading ke-6
\r\n ini contoh paragraph
\r\n\r\n', '1', 'testing_number_one');
+INSERT INTO `php_testing_rule` VALUES (2, '', '9', 'testing_number_two');
+INSERT INTO `php_testing_rule` VALUES (3, '\";\r\necho \"Umur : $umur
\";\r\necho \"Tinggi : $tinggi
\";\r\necho \"Aktif : $aktif
\";\r\necho \"Gaji Pokok : $gaji_pokok
\";\r\necho \"Gaji Bulanan : $gaji_bulanan
\";\r\necho \"Gaji Per Tahun : $gaji_per_tahun
\";\r\necho \"PPN : $ppn
\";\r\necho \"Gaji Setelah PPN : $gaji_setelah_ppn
\";\r\n\r\n?>', 'Nama : Ali Akbar\r\nUmur : 20\r\nTinggi : 172.5\r\nAktif : 1\r\nGaji Pokok : 1000000\r\nGaji Bulanan : 500000\r\nGaji Per Tahun : 6000000\r\nPPN : 600000\r\nGaji Setelah PPN : 5400000', 'testing_number_three');
+INSERT INTO `php_testing_rule` VALUES (4, 'php_testing_rule', NULL, 'testMethodPOST');
+INSERT INTO `php_testing_rule` VALUES (5, '= 70) {\r\n echo \"Nilai Anda: \" . $nilai . \"
\";\r\n echo \"Anda lulus!\";\r\n}\r\n\r\necho \"
\";\r\n$nilai = 55;\r\nif ($nilai >= 70) {\r\n echo \"Nilai Anda: \" . $nilai . \"
\";\r\n echo \"Anda lulus!\";\r\n} else {\r\n echo \"Nilai Anda:\".$nilai.\"
\";\r\n echo \"Anda tidak lulus.\";\r\n}\r\n\r\necho \"
\";\r\n$nilai = \"B\";\r\nswitch ($nilai){\r\n case \"A\":\r\n echo \"Nilai Anda: \" . $nilai . \"
\";\r\n echo \"Pertahankan prestasi!\";\r\n break;\r\n case \"B\":\r\n echo \"Nilai Anda: \" . $nilai . \"
\";\r\n echo \"Cukup baik, terus tingkatkan!\";\r\n break;\r\n case \"C\":\r\n echo \"Nilai Anda: \" . $nilai . \"
\";\r\n echo \"Perlu lebih banyak belajar.\";\r\n break;\r\n default:\r\n echo \"Nilai Anda: \" . $nilai . \"
\";\r\n echo \"Maaf, tidak ada keterangan.\";\r\n}\r\n?>', NULL, 'testing_number_four');
+INSERT INTO `php_testing_rule` VALUES (6, '\";\r\nwhile ($angka <= 5) {\r\n echo \"Angka: $angka
\";\r\n $angka++;\r\n}\r\necho \"
\";\r\n\r\necho \"Perulangan for:
\";\r\nfor ($i = 1; $i <= 5; $i++) {\r\n echo \"Angka: $i
\";\r\n}\r\necho \"
\";\r\n\r\n$angka = 1;\r\necho \"Perulangan do-while:
\";\r\ndo {\r\n echo \"Angka: $angka
\";\r\n $angka++;\r\n} while ($angka <= 5);\r\n\r\n', NULL, 'testing_number_five');
+INSERT INTO `php_testing_rule` VALUES (8, '\";\r\necho \"Status kedua: \" . ($status[1] ? \"Aktif\" : \"Tidak Aktif\") . \"
\";\r\n\r\n$bilangan[] = 6;\r\nunset($nama[0]);\r\n\r\n$posisi = array_search(\"Doe\", $nama);\r\necho \"Posisi Nama Doe Terletak Pada Array Ke : \". $posisi . \"
\";;\r\n\r\n$jumlah_nama = count($nama);\r\necho \"Jumlah Nama Pada Array Adalah : \". $jumlah_nama . \"
\";\r\n\r\narray_push($nama, \"Smith\");\r\n$elemen_terakhir = array_pop($nama);\r\necho \"Elemen baru ditambahkan ke Array adalah : \". $elemen_terakhir . \"
\";\r\n', NULL, 'testing_number_six');
-- ----------------------------
-- Table structure for php_topics
@@ -88019,7 +88063,7 @@ CREATE TABLE `php_user_submits` (
-- ----------------------------
-- Records of php_user_submits
-- ----------------------------
-INSERT INTO `php_user_submits` VALUES ('Amal Dermawan Udjir', 14, 5, 2);
+INSERT INTO `php_user_submits` VALUES ('Amal Dermawan Udjir', NULL, NULL, NULL);
-- ----------------------------
-- Table structure for projects
diff --git a/resources/views/php/teacher/crooms.blade.php b/resources/views/php/teacher/crooms.blade.php
index 3f53d19..edcecb7 100644
--- a/resources/views/php/teacher/crooms.blade.php
+++ b/resources/views/php/teacher/crooms.blade.php
@@ -62,7 +62,7 @@
id_meteri' group by username");
+ $sql_kelas = DB::select("SElECt count(*) as total from php_submits_submission where id_materi = '$materi->id_meteri' group by email");
$row_count = count($sql_kelas);
echo $row_count;
?>
diff --git a/tests/Functional/LoginTest.php b/tests/Functional/LoginTest.php
index 371f0fa..6f82180 100644
--- a/tests/Functional/LoginTest.php
+++ b/tests/Functional/LoginTest.php
@@ -10,8 +10,7 @@ class LoginTest extends \Codeception\Test\Unit
protected FunctionalTester $tester;
- protected function _before()
- {
+ protected function _before(){
}
// tests
diff --git a/tests/Unit/HomepageLayoutTest.php b/tests/Unit/HomepageLayoutTest.php
index d152166..580e5ab 100644
--- a/tests/Unit/HomepageLayoutTest.php
+++ b/tests/Unit/HomepageLayoutTest.php
@@ -105,38 +105,136 @@ public function testLatihanNumberThree():void{
public function testLatihanNumberFour():void{
- $response = $this->get("/phpunit/result-test-student/");
-
- $sql = DB::select("SELECT * FROM php_testing_rule WHERE testing_name = 'testing_number_four'");
- $row = $sql[0];
- $html = $row->testing_rule;
-
- $test = str_replace(array("\r\n","\r","\n"," "),"",$html);
- $result_test = htmlspecialchars($test);
-
- $result_content = str_replace(array("\r\n","\r"," "),"", $response->content());
- $this->assertStringContainsString($result_test, $result_content);
+ $response = $this->get("/phpunit/result-test-student/");
+
+ $sql = DB::select("SELECT * FROM php_testing_rule WHERE testing_name = 'testing_number_four'");
+ $row = $sql[0];
+ $html = $row->testing_rule;
+ $hasil_output = $row->output;
+
+ $test = str_replace(array("\r\n","\r","\n"," "),"",$html);
+ $result_test = htmlspecialchars($test);
+
+ $result_content = str_replace(array("\r\n","\r"," "),"", $response->content());
+ if($result_test == $result_content){
+ $this->assertStringContainsString($result_test, $result_content);
+ }else{
+ $response = $this->get("/phpunit/result-test-student-output/");
+ $nilai = 75;
+ if ($nilai >= 70) {
+ $response->assertSeeText($nilai);
+ $response->assertSeeText('Anda lulus!');
+ }
+
+ $nilai = 55;
+ if ($nilai >= 70) {
+ $response->assertSeeText($nilai);
+ $response->assertSeeText('Anda lulus!');
+ } else {
+ $response->assertSeeText($nilai);
+ $response->assertSeeText('Anda tidak lulus.');
+ }
+
+ $nilai = "B";
+ switch ($nilai){
+ case "A":
+ $response->assertSeeText($nilai);
+ $response->assertSeeText('Pertahankan prestasi!');
+ break;
+ case "B":
+ $response->assertSeeText($nilai);
+ $response->assertSeeText('Cukup baik, terus tingkatkan!');
+ break;
+ case "C":
+ $response->assertSeeText($nilai);
+ $response->assertSeeText('Kurang baik, terus tingkatkan!');
+ break;
+ default:
+ $response->assertSeeText($nilai);
+ $response->assertSeeText('Anda tidak lulus.');
+ }
+
+ }
}
public function testLatihanNumberFive():void{
- $response = $this->get("/phpunit/result-test-student/");
-
- $sql = DB::select("SELECT * FROM php_testing_rule WHERE testing_name = 'testing_number_five'");
- $row = $sql[0];
- $html = $row->testing_rule;
-
- $test = str_replace(array("\r\n","\r","\n"," "),"",$html);
- $result_test = htmlspecialchars($test);
-
- $result_content = str_replace(array("\r\n","\r"," "),"", $response->content());
- $this->assertStringContainsString($result_test, $result_content);
+ $response = $this->get("/phpunit/result-test-student/");
+ $sql = DB::select("SELECT * FROM php_testing_rule WHERE testing_name = 'testing_number_five'");
+ $row = $sql[0];
+ $html = $row->testing_rule;
+ $hasil_output = $row->output;
+
+ $test = str_replace(array("\r\n","\r","\n"," "),"",$html);
+ $result_test = htmlspecialchars($test);
+
+ $result_content = str_replace(array("\r\n","\r"," "),"", $response->content());
+ if($result_test == $result_content){
+ $this->assertStringContainsString($result_test, $result_content);
+ }else{
+
+ $response = $this->get("/phpunit/result-test-student-output/");
+ $angka = 1;
+ while ($angka <= 5) {
+ $response->assertSeeText((string)$angka);
+ $angka++;
+ }
+
+ for ($i = 1; $i <= 5; $i++) {
+ $response->assertSeeText((string)$i);
+ }
+
+ $angka = 1;
+ do {
+ $response->assertSeeText((string)$angka);
+ $angka++;
+ } while ($angka <= 5);
+ }
}
+
+ public function testLatihanNumberSix():void{
+
+
+ $response = $this->get("/phpunit/result-test-student/");
+
+ $sql = DB::select("SELECT * FROM php_testing_rule WHERE testing_name = 'testing_number_six'");
+ $row = $sql[0];
+ $html = $row->testing_rule;
+ $hasil_output = $row->output;
+
+ $test = str_replace(array("\r\n","\r","\n"," "),"",$html);
+ $result_test = htmlspecialchars($test);
+
+ $result_content = str_replace(array("\r\n","\r"," "),"", $response->content());
+ if($result_test == $result_content){
+ $this->assertStringContainsString($result_test, $result_content);
+ }else{
+ $response = $this->get("/phpunit/result-test-student-output/");
+ $bilangan = array(1, 2, 3, 4, 5);
+ $nama = array("John", "Doe", "Jane");
+ $status = array(true, false, true);
+ $response->assertSeeText($bilangan[0]);
+ $response->assertSeeText($nama[0]);
+ $response->assertSeeText($status[1] ? "Aktif" : "Tidak Aktif");
+ $response->assertSeeText($nama[0]);
+ $bilangan[] = 6;
+ unset($nama[0]);
+ $posisi = array_search("Doe", $nama);
+ $response->assertSeeText($posisi);
+ $jumlah_nama = count($nama);
+ $response->assertSeeText($jumlah_nama);
+ array_push($nama, "Smith");
+
+ $elemen_terakhir = array_pop($nama);
+ $response->assertSeeText($elemen_terakhir);
+ }
+
+ }
public function testConditions(): void
{