Skip to content

Commit 4fc8c85

Browse files
committed
Release 4.0.0-beta.3
1 parent 5b5ccfe commit 4fc8c85

File tree

240 files changed

+2957
-1651
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

240 files changed

+2957
-1651
lines changed

README.md

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,26 +31,12 @@ The user guide updating and deployment is a bit awkward at the moment, but we ar
3131

3232
## Repository Management
3333

34-
We use Github issues to track **BUGS** and to track approved **DEVELOPMENT** work packages.
34+
We use Github issues, in our main repository, to track **BUGS** and to track approved **DEVELOPMENT** work packages.
3535
We use our [forum](http://forum.codeigniter.com) to provide SUPPORT and to discuss
3636
FEATURE REQUESTS.
3737

38-
If you raise an issue here that pertains to support or a feature request, it will
39-
be closed! If you are not sure if you have found a bug, raise a thread on the forum first -
40-
someone else may have encountered the same thing.
41-
42-
Before raising a new Github issue, please check that your bug hasn't already
43-
been reported or fixed.
44-
45-
We use pull requests (PRs) for CONTRIBUTIONS to the repository.
46-
We are looking for contributions that address one of the reported bugs or
47-
approved work packages.
48-
49-
Do not use a PR as a form of feature request.
50-
Unsolicited contributions will only be considered if they fit nicely
51-
into the framework roadmap.
52-
Remember that some components that were part of CodeIgniter 3 are being moved
53-
to optional packages, with their own repository.
38+
This repository is a "distribution" one, built by our release preparation script.
39+
Problems with it can be raised on our forum, or as issues in the main repository.
5440

5541
## Contributing
5642

_support/Controllers/Popcorn.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,23 @@ public function index3()
5555
return $response;
5656
}
5757

58+
public function canyon()
59+
{
60+
echo 'Hello-o-o';
61+
}
62+
63+
public function cat()
64+
{
65+
}
66+
67+
public function json()
68+
{
69+
$this->responsd(['answer' => 42]);
70+
}
71+
72+
public function xml()
73+
{
74+
$this->respond('<my><pet>cat</pet></my>');
75+
}
76+
5877
}

_support/Database/Migrations/20160428212500_Create_test_tables.php

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ public function up()
3131
'constraint' => 1,
3232
'default' => '0',
3333
],
34+
'created_at' => [
35+
'type' => 'DATETIME',
36+
'null' => true,
37+
],
38+
'updated_at' => [
39+
'type' => 'DATETIME',
40+
'null' => true,
41+
],
3442
]);
3543
$this->forge->addKey('id', true);
3644
$this->forge->createTable('user', true);
@@ -46,11 +54,25 @@ public function up()
4654
'type' => 'VARCHAR',
4755
'constraint' => 40,
4856
],
49-
'description' => ['type' => 'TEXT'],
50-
'created_at' => [
51-
'type' => 'DATETIME',
57+
'description' => [
58+
'type' => 'TEXT',
5259
'null' => true,
5360
],
61+
'deleted' => [
62+
'type' => 'TINYINT',
63+
'constraint' => 1,
64+
'default' => '0',
65+
],
66+
'created_at' => [
67+
'type' => 'INTEGER',
68+
'constraint' => 11,
69+
'null' => true,
70+
],
71+
'updated_at' => [
72+
'type' => 'INTEGER',
73+
'constraint' => 11,
74+
'null' => true,
75+
],
5476
]);
5577
$this->forge->addKey('id', true);
5678
$this->forge->createTable('job', true);
@@ -82,6 +104,14 @@ public function up()
82104
'type' => 'VARCHAR',
83105
'constraint' => 40,
84106
],
107+
'created_at' => [
108+
'type' => 'DATE',
109+
'null' => true,
110+
],
111+
'updated_at' => [
112+
'type' => 'DATE',
113+
'null' => true,
114+
],
85115
]);
86116
$this->forge->addKey('id', true);
87117
$this->forge->createTable('empty', true);

_support/Database/MockConnection.php

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php namespace Tests\Support\Database;
22

3+
use CodeIgniter\CodeIgniter;
34
use CodeIgniter\Database\BaseConnection;
45

56
class MockConnection extends BaseConnection
@@ -21,7 +22,23 @@ public function shouldReturn(string $method, $return)
2122

2223
//--------------------------------------------------------------------
2324

24-
public function query(string $sql, $binds = null, bool $setEscapeFlags = true, $queryClass = 'CodeIgniter\\Database\\Query')
25+
/**
26+
* Orchestrates a query against the database. Queries must use
27+
* Database\Statement objects to store the query and build it.
28+
* This method works with the cache.
29+
*
30+
* Should automatically handle different connections for read/write
31+
* queries if needed.
32+
*
33+
* @param string $sql
34+
* @param mixed ...$binds
35+
* @param boolean $setEscapeFlags
36+
* @param string $queryClass
37+
*
38+
* @return \CodeIgniter\Database\BaseResult|\CodeIgniter\Database\Query|false
39+
*/
40+
41+
public function query(string $sql, $binds = null, bool $setEscapeFlags = true, string $queryClass = 'CodeIgniter\\Database\\Query')
2542
{
2643
$queryClass = str_replace('Connection', 'Query', get_class($this));
2744

@@ -60,9 +77,11 @@ public function query(string $sql, $binds = null, bool $setEscapeFlags = true, $
6077
/**
6178
* Connect to the database.
6279
*
80+
* @param boolean $persistent
81+
*
6382
* @return mixed
6483
*/
65-
public function connect($persistent = false)
84+
public function connect(bool $persistent = false)
6685
{
6786
$return = $this->returnValues['connect'] ?? true;
6887

@@ -82,9 +101,9 @@ public function connect($persistent = false)
82101
* Keep or establish the connection if no queries have been sent for
83102
* a length of time exceeding the server's idle timeout.
84103
*
85-
* @return mixed
104+
* @return boolean
86105
*/
87-
public function reconnect()
106+
public function reconnect(): bool
88107
{
89108
return true;
90109
}
@@ -110,23 +129,23 @@ public function setDatabase(string $databaseName)
110129
/**
111130
* Returns a string containing the version of the database being used.
112131
*
113-
* @return mixed
132+
* @return string
114133
*/
115-
public function getVersion()
134+
public function getVersion(): string
116135
{
117-
return \CodeIgniter\CodeIgniter::CI_VERSION;
136+
return CodeIgniter::CI_VERSION;
118137
}
119138

120139
//--------------------------------------------------------------------
121140

122141
/**
123142
* Executes the query against the database.
124143
*
125-
* @param $sql
144+
* @param string $sql
126145
*
127146
* @return mixed
128147
*/
129-
protected function execute($sql)
148+
protected function execute(string $sql)
130149
{
131150
return $this->returnValues['execute'];
132151
}
@@ -136,7 +155,7 @@ protected function execute($sql)
136155
/**
137156
* Returns the total number of rows affected by this query.
138157
*
139-
* @return mixed
158+
* @return int
140159
*/
141160
public function affectedRows(): int
142161
{
@@ -154,7 +173,7 @@ public function affectedRows(): int
154173
*
155174
* @return array
156175
*/
157-
public function error()
176+
public function error(): array
158177
{
159178
return [
160179
'code' => null,
@@ -169,7 +188,7 @@ public function error()
169188
*
170189
* @return integer
171190
*/
172-
public function insertID()
191+
public function insertID(): int
173192
{
174193
return $this->connID->insert_id;
175194
}
@@ -183,7 +202,7 @@ public function insertID()
183202
*
184203
* @return string
185204
*/
186-
protected function _listTables($constrainByPrefix = false): string
205+
protected function _listTables(bool $constrainByPrefix = false): string
187206
{
188207
return '';
189208
}

_support/Database/MockResult.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ public function dataSeek($n = 0)
6868
*
6969
* Overridden by driver classes.
7070
*
71-
* @return array
71+
* @return mixed
7272
*/
73-
protected function fetchAssoc(): array
73+
protected function fetchAssoc()
7474
{
7575
}
7676

_support/Database/MockTestClass.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
namespace Tests\Support\Database;
4+
5+
class MockTestClass
6+
{
7+
}

_support/Events/MockEvents.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
* @copyright 2014-2018 British Columbia Institute of Technology (https://bcit.ca/)
3333
* @license https://opensource.org/licenses/MIT MIT License
3434
* @link https://codeigniter.com
35-
* @since Version 3.0.0
35+
* @since Version 4.0.0
3636
* @filesource
3737
*/
3838

_support/Language/en/Core.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @copyright 2014-2018 British Columbia Institute of Technology (https://bcit.ca/)
88
* @license https://opensource.org/licenses/MIT MIT License
99
* @link https://codeigniter.com
10-
* @since Version 3.0.0
10+
* @since Version 4.0.0
1111
* @filesource
1212
*
1313
* @codeCoverageIgnore

_support/Models/EntityModel.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ class EntityModel extends Model
1010

1111
protected $useSoftDeletes = false;
1212

13-
protected $dateFormat = 'datetime';
13+
protected $dateFormat = 'int';
14+
15+
protected $deletedField = 'deleted';
1416

1517
protected $allowedFields = [
1618
'name',

_support/Models/EventModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class EventModel extends Model
1010

1111
protected $useSoftDeletes = false;
1212

13-
protected $dateFormat = 'integer';
13+
protected $dateFormat = 'datetime';
1414

1515
protected $allowedFields = [
1616
'name',

_support/Models/JobModel.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@ class JobModel extends Model
1010

1111
protected $useSoftDeletes = false;
1212

13-
protected $dateFormat = 'integer';
13+
protected $dateFormat = 'int';
1414

1515
protected $allowedFields = [
1616
'name',
1717
'description',
1818
];
19+
20+
public $name = '';
21+
22+
public $description = '';
1923
}

_support/Models/SecondaryModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class SecondaryModel extends Model
1212

1313
protected $useSoftDeletes = false;
1414

15-
protected $dateFormat = 'integer';
15+
protected $dateFormat = 'int';
1616

1717
protected $allowedFields = [
1818
'key',

_support/Models/SimpleEntity.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ class SimpleEntity extends Entity
1515
protected $id;
1616
protected $name;
1717
protected $description;
18+
protected $deleted;
1819
protected $created_at;
20+
protected $updated_at;
1921

2022
protected $_options = [
2123
'datamap' => [],

_support/Models/UserModel.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,11 @@ class UserModel extends Model
1717

1818
protected $useSoftDeletes = true;
1919

20-
protected $dateFormat = 'integer';
20+
protected $dateFormat = 'datetime';
21+
22+
public $name = '';
23+
24+
public $email = '';
25+
26+
public $country = '';
2127
}

_support/Models/ValidErrorsModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class ValidErrorsModel extends Model
1010

1111
protected $useSoftDeletes = false;
1212

13-
protected $dateFormat = 'integer';
13+
protected $dateFormat = 'int';
1414

1515
protected $allowedFields = [
1616
'name',

_support/Models/ValidModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class ValidModel extends Model
1010

1111
protected $useSoftDeletes = false;
1212

13-
protected $dateFormat = 'integer';
13+
protected $dateFormat = 'int';
1414

1515
protected $allowedFields = [
1616
'name',

_support/View/MockTable.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
namespace Tests\Support\View;
3+
4+
class MockTable extends \CodeIgniter\View\Table {
5+
6+
// Override inaccessible protected method
7+
public function __call($method, $params)
8+
{
9+
if (is_callable([$this, '_' . $method]))
10+
{
11+
return call_user_func_array([$this, '_' . $method], $params);
12+
}
13+
14+
throw new BadMethodCallException('Method ' . $method . ' was not found');
15+
}
16+
17+
}

app/Config/App.php

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -264,19 +264,4 @@ class App extends BaseConfig
264264
*/
265265
public $CSPEnabled = false;
266266

267-
/*
268-
|--------------------------------------------------------------------------
269-
| Application Salt
270-
|--------------------------------------------------------------------------
271-
|
272-
| The $salt can be used anywhere within the application that you need
273-
| to provide secure data. It should be different for every application
274-
| and can be of any length, though the more random the characters
275-
| the better.
276-
|
277-
*/
278-
public $salt = '';
279-
280-
//--------------------------------------------------------------------
281-
282267
}

0 commit comments

Comments
 (0)