Skip to content

Commit

Permalink
Merge branch '4.0.x' into fix/#14858-dir-from-file-tests
Browse files Browse the repository at this point in the history
# Conflicts:
#	composer.json
  • Loading branch information
Jeckerson committed Feb 25, 2020
2 parents b497e3e + da573f5 commit d6a6f1f
Show file tree
Hide file tree
Showing 229 changed files with 2,032 additions and 2,281 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -228,19 +228,26 @@ jobs:
DATA_MEMCACHED_PORT: ${{ job.services.memcached.ports['11211'] }}
run: vendor/bin/codecept run --ext DotReporter integration

- name: Run database tests Common
env:
DATA_REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
DATA_MEMCACHED_PORT: ${{ job.services.memcached.ports['11211'] }}
DATA_MYSQL_USER: root
run: vendor/bin/codecept run --ext DotReporter database -g common

- name: Run database tests MySQL
env:
DATA_MYSQL_PORT: ${{ job.services.mysql.ports['3306'] }}
DATA_REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
DATA_MEMCACHED_PORT: ${{ job.services.memcached.ports['11211'] }}
DATA_MYSQL_USER: root
run: vendor/bin/codecept run --ext DotReporter database --env mysql
run: vendor/bin/codecept run --ext DotReporter database --env mysql -g mysql

- name: Run database tests Sqlite
env:
DATA_REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
DATA_MEMCACHED_PORT: ${{ job.services.memcached.ports['11211'] }}
run: vendor/bin/codecept run --ext DotReporter database --env sqlite
run: vendor/bin/codecept run --ext DotReporter database --env sqlite -g sqlite

# # TODO Enable these one at a time and also for MacOS/Windows
# - name: Run database tests Postgres
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/codecoverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,9 @@ jobs:
vendor/bin/codecept run --ext DotReporter cli
vendor/bin/codecept run --ext DotReporter unit
vendor/bin/codecept run --ext DotReporter integration
vendor/bin/codecept run --ext DotReporter database --env mysql
vendor/bin/codecept run --ext DotReporter database --env sqlite
vendor/bin/codecept run --ext DotReporter database -g common
vendor/bin/codecept run --ext DotReporter database -g mysql --env mysql
vendor/bin/codecept run --ext DotReporter database -g sqlite --env sqlite
- name: Upload codecoverage on 7.4
uses: codecov/codecov-action@v1
Expand Down
1 change: 1 addition & 0 deletions BACKERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ Thanks for the support

<a href="https://github.com/ninjapanzer"><img src="https://avatars1.githubusercontent.com/u/159591?s=460&v=4" title="Paul Scarrone" width="60" height="60"></a>
<a href="https://github.com/vlad-light"><img src="https://avatars1.githubusercontent.com/u/277235?s=460&v=4" title="Vladimir L" width="60" height="60"></a>
<a href="https://github.com/alrieckert"><img src="https://avatars1.githubusercontent.com/u/452786?s=460&v=4" title="Anton Rieckert" width="60" height="60"></a>
<a href="https://github.com/sinbadxiii"><img src="https://avatars2.githubusercontent.com/u/900273?s=460&v=4" title="Sergey Mukhin" width="60" height="60"></a>
<a href="https://github.com/niden"><img src="https://avatars2.githubusercontent.com/u/1073784?s=460&v=4" title="Nikolaos Dimopoulos" width="60" height="60"></a>
<a href="https://github.com/qmegas"><img src="https://avatars3.githubusercontent.com/u/2444896?s=460&v=4" title="qmegas" width="60" height="60"></a>
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG-4.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
## Changed

## Fixed

- Fixed `Phalcon\Db::fetchAll` to correctly return data when `Enum::FETCH_COLUMN` is supplied. [#13321](https://github.com/phalcon/cphalcon/issues/13321)

# [4.0.4](https://github.com/phalcon/cphalcon/releases/tag/v4.0.4) (2020-02-15)
## Added
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ install:
- ps: >-
InstallPeclExtension `
-Name psr `
-Version 0.7.0 `
-Version 1.0.0 `
-PhpVersion $Env:PHP_VERSION `
-BuildType $Env:BUILD_TYPE `
-VC $Env:VC_VERSION `
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"ext-json": "*",
"ext-libxml": "*",
"ext-mbstring": "*",
"ext-psr": "^0.7|^1.0",
"ext-psr": "^0.7|1.0",
"ext-xml": "*",
"ext-redis": "*",
"ext-igbinary": "*",
Expand Down
4 changes: 4 additions & 0 deletions phalcon/Db/Adapter/AbstractAdapter.zep
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,10 @@ abstract class AbstractAdapter implements AdapterInterface, EventsAwareInterface
return [];
}

if unlikely fetchMode === Enum::FETCH_COLUMN {
return result->fetchAll(Enum::FETCH_COLUMN);
}

result->setFetchMode(fetchMode);

return result->fetchAll();
Expand Down
12 changes: 8 additions & 4 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ codecept build
codecept run unit
codecept run cli
codecept run integration
codecept run database --env mysql
codecept run database --env sqlite
codecept run database -g common
codecept run database -g mysql --env mysql
codecept run database -g sqlite --env sqlite
```

Note that certain tests are grouped as `common`. Those do not require a specific database connection. Any other type of test requires the group parameter for Codeception `-g` in order to run. There are certain tests that can only run in specific RDBMs, and for that our tests use the `@group` annotation from Codeception.

## Getting Started

Expand Down Expand Up @@ -187,10 +189,12 @@ Execute single test:
/app $ codecept run tests/unit/some/folder/some/test/file.php
```

To run database related tests you need to run the `database` suite specifying the RDBMS
To run database related tests you need to run the `database` suite specifying the RDBMS and group

```sh
/app $ codecept run tests/database --env mysql
/app $ codecept run tests/database -g common
/app $ codecept run tests/database -g mysql --env mysql
/app $ codecept run tests/database -g sqlite --env sqlite
```

Available options:
Expand Down
37 changes: 19 additions & 18 deletions tests/_data/assets/schemas/mysql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -55,33 +55,34 @@ create table objects



drop table if exists public.`robot`;
drop table if exists `co_orders`;

CREATE TABLE public.`robot` (
`robot_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`robot_name` VARCHAR(70) NULL,
PRIMARY KEY (`robot_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `co_orders` (
`ord_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`ord_name` VARCHAR(70) NULL,
PRIMARY KEY (`ord_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



drop table if exists public.`robot_part`;
drop table if exists private.`co_orders_x_products`;

CREATE TABLE public.`robot_part` (
`robot_part_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`robot_part_name` VARCHAR(70) NULL,
PRIMARY KEY (`robot_part_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE private.`co_orders_x_products` (
`oxp_ord_id` int(10) unsigned NOT NULL,
`oxp_prd_id` int(10) unsigned NOT NULL,
`oxp_quantity` int(10) unsigned NOT NULL,
PRIMARY KEY (`oxp_ord_id`, `oxp_prd_id` )
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



drop table if exists private.`robot_to_robot_part`;
drop table if exists `co_products`;

CREATE TABLE private.`robot_to_robot_part` (
`robot_id` int(10) unsigned NOT NULL,
`robot_part_id` int(10) unsigned NOT NULL,
PRIMARY KEY (`robot_id`, `robot_part_id` )
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `co_products` (
`prd_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`prd_name` VARCHAR(70) NULL,
PRIMARY KEY (`prd_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



Expand Down
37 changes: 19 additions & 18 deletions tests/_data/assets/schemas/pgsql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -29,43 +29,44 @@ create index co_invoices_inv_status_flag_index



drop table if exists public.robot;
drop table if exists co_orders;

create table public.robot
create table co_orders
(
robot_id serial not null
constraint robot_pk
ord_id serial not null
constraint ord_pk
primary key,
robot_name varchar(70)
ord_name varchar(70)
);

alter table public.robot owner to postgres;
alter table public.co_orders owner to postgres;



drop table if exists public.robot_part;
drop table if exists private.co_orders_x_products;

create table public.robot_part
create table private.co_orders_x_products
(
robot_part_id serial not null
constraint robot_part_pk
primary key,
robot_part_name varchar(70)
oxp_ord_id int not null,
oxp_prd_id int not null,
oxp_quantity int not null
);

alter table public.robot_part owner to postgres;
alter table private.co_orders_x_products owner to postgres;



drop table if exists private.robot_to_robot_part;
drop table if exists co_products;

create table private.robot_to_robot_part
create table co_products
(
robot_id int not null,
robot_part_id int not null
prd_id serial not null
constraint prd_pk
primary key,
prd_name varchar(70)
);

alter table private.robot_to_robot_part owner to postgres;
alter table public.co_products owner to postgres;



Expand Down
1 change: 1 addition & 0 deletions tests/_data/fixtures/Helpers/TagSetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public function _before(UnitTester $I)
$this->setDiService('escaper');
$this->setDiService('url');

Tag::setDI($this->container);
Tag::resetInput();

$this->doctype = $this->docTypeStringToConstant(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,29 @@
namespace Phalcon\Test\Fixtures\Migrations;

/**
* Class RobotMigration
* Class OrdersMigration
*/
class RobotMigration extends AbstractMigration
class OrdersMigration extends AbstractMigration
{
protected $table = "robot";
protected $table = "co_orders";

/**
* @param int $robot_id
* @param string|null $robot_name
* @param int $prdt_id
* @param string|null $prdt_name
*
* @return int
*/
public function insert(
$robot_id,
string $robot_name = null
$ord_id,
string $ord_name = null
): int {
$robot_id = $robot_id ?: 'null';
$robot_name = $robot_name ?: uniqid();
$ord_id = $ord_id ?: 'null';
$ord_name = $ord_name ?: uniqid();
$sql = <<<SQL
insert into robot (
robot_id, robot_name
insert into co_orders (
ord_id, ord_name
) values (
{$robot_id}, {$robot_name}
{$ord_id}, {$ord_name}
)
SQL;

Expand All @@ -47,14 +47,14 @@ protected function getSqlMysql(): array
{
return [
"
drop table if exists public.`robot`;
drop table if exists `co_orders`;
",
"
CREATE TABLE public.`robot` (
`robot_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`robot_name` VARCHAR(70) NULL,
PRIMARY KEY (`robot_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `co_orders` (
`ord_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`ord_name` VARCHAR(70) NULL,
PRIMARY KEY (`ord_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
"
];
}
Expand All @@ -68,19 +68,19 @@ protected function getSqlPgsql(): array
{
return [
"
drop table if exists public.robot;
drop table if exists co_orders;
",
"
create table public.robot
create table co_orders
(
robot_id serial not null
constraint robot_pk
ord_id serial not null
constraint ord_pk
primary key,
robot_name varchar(70)
ord_name varchar(70)
);
",
"
alter table public.robot owner to postgres;
alter table public.co_orders owner to postgres;
"
];
}
Expand Down
Loading

0 comments on commit d6a6f1f

Please sign in to comment.