-
Notifications
You must be signed in to change notification settings - Fork 0
/
testCustom.php
76 lines (61 loc) · 1.88 KB
/
testCustom.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
use Application\Database\Connection;
use Application\Database\Pagination;
use Application\Database\QueryBuilder;
use Application\Entity\Customer;
use Application\Entity\CustomerService;
require_once __DIR__ . '/bootstrap.php';
$con = new Connection($dbconfig);
$cs = new CustomerService($con);
$customer = $cs->findById(9);
// --- Test update customer
// $customer->setLevel('XLL');
// $update = $cs->update($customer);
// --- Test update customer
// --- Test new customer
// $data = [
// 'name' => 'Mahfuzur rahman',
// 'balance' => 300.50,
// 'email' => '[email protected]',
// 'password' => '505050k',
// 'status' => 3,
// 'security_question' => 'Donno yet',
// 'confirm_code' => 'z0z0z0z0',
// 'profile_id' => 3,
// 'level' => 'XOX'
// ];
// $new = Customer::arrayToEntity($data, new Customer());
// $cs->insert($new);
// --- Test new customer
// --- Test entity
// $builder = QueryBuilder::select('customers')->where('id = 1');
// $stmt = $con->pdo->prepare($builder->getQuery());
// $stmt->execute();
// $result = $stmt->fetch(PDO::FETCH_ASSOC);
// $customer = Customer::arrayToEntity($result, new Customer());
// var_dump($customer);
// --- Test entity
// --- Test pagination
// $pagination = new Pagination($builder::getQuery(), 0, 10);
// foreach ($pagination->paginate($con, PDO::FETCH_ASSOC) as $row) {
// echo $row['id'] . ' ' . $row['name'] . PHP_EOL;
// }
// --- Test pagination
// --- Test autoloader
// $test = new TestClass();
// echo $test->getTest();
// $test = new \Application\Test\FakeClass();
// echo $test->getTest();
// --- Test autoloader
// --- Test query builder
// $sql = QB::select('project')
// ->where()
// ->like('name', '%secret%')
// ->and('priority > 9')
// ->or('code')
// ->not('bla')
// ->in(['one', 'two'])
// ->limit(10)
// ->offset(10);
// echo QB::getSql();
// --- Test query builder