Skip to content

Commit

Permalink
[#13578] - Updated README; Adjusted tests after the merge
Browse files Browse the repository at this point in the history
  • Loading branch information
niden committed Dec 4, 2018
1 parent 859e0e1 commit 9edd819
Show file tree
Hide file tree
Showing 127 changed files with 2,400 additions and 23,339 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ script:
- vendor/bin/phpcs
- vendor/bin/codecept build
# TODO: Add `cli' suite and refactor current cli-tests
- vendor/bin/codecept run -v -n tests/cli/
- vendor/bin/codecept run -v
# - vendor/bin/codecept run -v -n tests/cli/
# - vendor/bin/codecept run -v -n tests/integration/
- vendor/bin/codecept run -v -n tests/unit/
# TODO: Refactor legacy unit tests from the "unit-tests" directory
# - vendor/bin/codecept run -v -n tests/unit/
- phpenv config-rm xdebug.ini || true
- tests/_ci/volt-tests.sh

Expand Down
12 changes: 12 additions & 0 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,18 @@ After the compilation is completed, you can check if the extension is loaded:
/app $ php -m | grep phalcon
```

## Setup databases
The SQL dump files are located under `tests/_data/assets/db/schemas`. When importing your Postgresql database, please make sure you use the file suffixed with `*nanobox`. You can run the following commands from your nanobox environment

```sh
/app $ cat ./tests/_data/assets/db/schemas/mysql_schema.sql" | mysql -u root gonano
/app $ psql -U nanobox gonanophalcon_test -q -f ./tests/_data/assets/db/schemas/postgresql_schema.sql
/app $ sqlite3 ./tests/_output/phalcon_test.sqlite < ./tests/_data/assets/db/schemas/sqlite_schema.sql
/app $ sqlite3 ./tests/_output/translations.sqlite < ./tests/_data/assets/db/schemas/sqlite_translations_schema.sql
```
## Run tests
First you need to re-generate base classes for all suites:
Expand Down
69 changes: 69 additions & 0 deletions tests/_data/assets/db/schemas/mysql_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -12718,3 +12718,72 @@ VALUES
(1, 'String one'),
(2, 'String two'),
(3, 'Another one string');

drop table if exists `dialect_table`;
create table dialect_table
(
field_primary int auto_increment
primary key,
field_blob blob null,
field_bit bit null,
field_bit_default bit default b'1' null,
field_bigint bigint null,
field_bigint_default bigint default 1 null,
field_boolean tinyint(1) null,
field_boolean_default tinyint(1) default 1 null,
field_char char(10) null,
field_char_default char(10) default 'ABC' null,
field_decimal decimal(10,4) null,
field_decimal_default decimal(10,4) default 14.5678 null,
field_enum enum('xs', 's', 'm', 'l', 'xl') null,
field_integer int(10) null,
field_integer_default int(10) default 1 null,
field_json json null,
field_float float(10,4) null,
field_float_default float(10,4) default 14.5678 null,
field_date date null,
field_date_default date default '2018-10-01' null,
field_datetime datetime null,
field_datetime_default datetime default '2018-10-01 12:34:56' null,
field_time time null,
field_time_default time default '12:34:56' null,
field_timestamp timestamp null,
field_timestamp_default timestamp default '2018-10-01 12:34:56' null,
field_mediumint mediumint(10) null,
field_mediumint_default mediumint(10) default 1 null,
field_smallint smallint(10) null,
field_smallint_default smallint(10) default 1 null,
field_tinyint tinyint(10) null,
field_tinyint_default tinyint(10) default 1 null,
field_longtext longtext null,
field_mediumtext mediumtext null,
field_tinytext tinytext null,
field_text text null,
field_varchar varchar(10) null,
field_varchar_default varchar(10) default 'D' null,
unique key dialect_table_unique (field_integer),
key dialect_table_index (field_bigint),
key dialect_table_two_fields (field_char, field_char_default)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

drop table if exists `dialect_table_remote`;
create table dialect_table_remote
(
field_primary int auto_increment
primary key,
field_text varchar(20) null
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


drop table if exists `dialect_table_intermediate`;
create table dialect_table_intermediate
(
field_primary_id int null,
field_remote_id int null,
constraint dialect_table_intermediate_primary__fk
foreign key (field_primary_id) references dialect_table (field_primary),
constraint dialect_table_intermediate_remote__fk
foreign key (field_remote_id) references dialect_table_remote (field_primary)
on update cascade on delete set null
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

96 changes: 96 additions & 0 deletions tests/_data/assets/db/schemas/postgresql_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6937,6 +6937,102 @@ CREATE TABLE table_with_string_field (
field character varying(70) NOT NULL
);


drop type if exists type_enum_size;
create type type_enum_size as enum
(
'xs',
's',
'm',
'l',
'xl'
);

drop table if exists dialect_table;
create table dialect_table
(
field_primary serial not null
constraint dialect_table_pk
primary key,
field_blob text,
field_bit bit,
field_bit_default bit default B'1'::"bit",
field_bigint bigint,
field_bigint_default bigint default 1,
field_boolean boolean,
field_boolean_default boolean default true,
field_char char(10),
field_char_default char(10) default 'ABC'::bpchar,
field_decimal numeric(10,4),
field_decimal_default numeric(10,4) default 14.5678,
field_enum type_enum_size,
field_integer integer,
field_integer_default integer default 1,
field_json json,
field_float numeric(10,4),
field_float_default numeric(10,4) default 14.5678,
field_date date,
field_date_default date default '2018-10-01':: date,
field_datetime timestamp,
field_datetime_default timestamp default '2018-10-01 12:34:56':: timestamp without time zone,
field_time time,
field_time_default time default '12:34:56':: time without time zone,
field_timestamp timestamp,
field_timestamp_default timestamp default '2018-10-01 12:34:56':: timestamp without time zone,
field_mediumint integer,
field_mediumint_default integer default 1,
field_smallint smallint,
field_smallint_default smallint default 1,
field_tinyint smallint,
field_tinyint_default smallint default 1,
field_longtext text,
field_mediumtext text,
field_tinytext text,
field_text text,
field_varchar varchar(10),
field_varchar_default varchar(10) default 'D':: character varying
);

alter table public.dialect_table OWNER TO postgres;

create index dialect_table_index
on dialect_table (field_bigint);

create index dialect_table_two_fields
on dialect_table (field_char, field_char_default);

create unique index dialect_table_unique
on dialect_table (field_integer);

drop table if exists dialect_table_remote;
create table dialect_table_remote
(
field_primary serial not null
constraint dialect_table_remote_pk
primary key,
field_text varchar(20)
);
alter table public.dialect_table_remote OWNER TO postgres;

drop table if exists dialect_table_intermediate;
create table dialect_table_intermediate
(
field_primary_id integer,
field_remote_id integer
);
alter table public.dialect_table_intermediate OWNER TO postgres;

alter table only dialect_table_intermediate
add constraint dialect_table_intermediate_primary__fk
foreign key (field_primary_id);
references dialect_table (field_primary)
on update cascade on delete restrict;

alter table only dialect_table_intermediate
add constraint dialect_table_intermediate_remote__fk
foreign key (field_remote_id);
references dialect_table_remote (field_primary);

--
-- Name: public; Type: ACL; Schema: -; Owner: postgres
--
Expand Down
98 changes: 98 additions & 0 deletions tests/_data/assets/db/schemas/postgresql_schema_nanobox.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6937,6 +6937,104 @@ CREATE TABLE table_with_string_field (
field character varying(70) NOT NULL
);



drop type if exists type_enum_size;
create type type_enum_size as enum
(
'xs',
's',
'm',
'l',
'xl'
);

drop table if exists dialect_table;
create table dialect_table
(
field_primary serial not null
constraint dialect_table_pk
primary key,
field_blob text,
field_bit bit,
field_bit_default bit default B'1'::"bit",
field_bigint bigint,
field_bigint_default bigint default 1,
field_boolean boolean,
field_boolean_default boolean default true,
field_char char(10),
field_char_default char(10) default 'ABC'::bpchar,
field_decimal numeric(10,4),
field_decimal_default numeric(10,4) default 14.5678,
field_enum type_enum_size,
field_integer integer,
field_integer_default integer default 1,
field_json json,
field_float numeric(10,4),
field_float_default numeric(10,4) default 14.5678,
field_date date,
field_date_default date default '2018-10-01':: date,
field_datetime timestamp,
field_datetime_default timestamp default '2018-10-01 12:34:56':: timestamp without time zone,
field_time time,
field_time_default time default '12:34:56':: time without time zone,
field_timestamp timestamp,
field_timestamp_default timestamp default '2018-10-01 12:34:56':: timestamp without time zone,
field_mediumint integer,
field_mediumint_default integer default 1,
field_smallint smallint,
field_smallint_default smallint default 1,
field_tinyint smallint,
field_tinyint_default smallint default 1,
field_longtext text,
field_mediumtext text,
field_tinytext text,
field_text text,
field_varchar varchar(10),
field_varchar_default varchar(10) default 'D':: character varying
);

alter table public.dialect_table OWNER TO nanobox;

create index dialect_table_index
on dialect_table (field_bigint);

create index dialect_table_two_fields
on dialect_table (field_char, field_char_default);

create unique index dialect_table_unique
on dialect_table (field_integer);

drop table if exists dialect_table_remote;
create table dialect_table_remote
(
field_primary serial not null
constraint dialect_table_remote_pk
primary key,
field_text varchar(20)
);
alter table public.dialect_table_remote OWNER TO nanobox;

drop table if exists dialect_table_intermediate;
create table dialect_table_intermediate
(
field_primary_id integer,
field_remote_id integer
);
alter table public.dialect_table_intermediate OWNER TO nanobox;

-- @TODO - Check the constraints
-- alter table only dialect_table_intermediate
-- add constraint dialect_table_intermediate_primary__fk
-- foreign key (field_primary_id);
-- references dialect_table (field_primary)
-- on update cascade on delete restrict;
--
-- alter table only dialect_table_intermediate
-- add constraint dialect_table_intermediate_remote__fk
-- foreign key (field_remote_id);
-- references dialect_table_remote (field_primary);

--
-- Name: public; Type: ACL; Schema: -; Owner: nanobox
--
Expand Down
11 changes: 0 additions & 11 deletions tests/_data/db/DateTime.php

This file was deleted.

40 changes: 0 additions & 40 deletions tests/_data/fixtures/Traits/ConnectionCheckerTrait.php

This file was deleted.

Loading

0 comments on commit 9edd819

Please sign in to comment.